build: Configure GitHub Actions

This commit is contained in:
Martin Polden 2021-01-24 14:56:53 +01:00
parent 994c2529e9
commit 4f071cd6a2
4 changed files with 34 additions and 25 deletions

29
.github/workflows/ci.yml vendored Normal file
View File

@ -0,0 +1,29 @@
name: ci
on:
push:
branches: [master]
pull_request:
branches: [master]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: install go
uses: actions/setup-go@v2
with:
go-version: 1.15
- name: build and test
run: make
- name: enable experimental docker features
run: |
echo '{"experimental":true}' | sudo tee /etc/docker/daemon.json ~/.docker/config.json
sudo service docker restart
- name: build docker image
run: make docker-build
- name: publish docker image
run: make docker-push
- name: publish multi-arch docker image
run: make docker-pushx

View File

@ -1,23 +0,0 @@
dist: bionic
language: minimal
services:
- docker
env:
global:
- DOCKER_CLI_EXPERIMENTAL=enabled
before_install:
- echo '{"experimental":true}' | sudo tee /etc/docker/daemon.json
- curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
- sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
- sudo apt-get update
- sudo apt-get -y -o Dpkg::Options::="--force-confnew" install docker-ce
script:
- make docker-build
deploy:
- provider: script
script: make docker-push

View File

@ -57,7 +57,10 @@ docker-test:
$(eval DOCKER_PORT=$(shell $(DOCKER) port $(CONTAINER) | cut -d ":" -f 2))
curl -fsS -m 5 localhost:$(DOCKER_PORT) > /dev/null; $(DOCKER) stop $(CONTAINER)
docker-push: docker-test docker-multiarch-builder docker-login
docker-push: docker-test docker-login
$(DOCKER) push $(DOCKER_IMAGE)
docker-pushx: docker-multiarch-builder docker-login
$(DOCKER) buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 -t $(DOCKER_IMAGE) --push .
xinstall:

View File

@ -1,6 +1,6 @@
# echoip
[![Build Status](https://travis-ci.org/mpolden/echoip.svg)](https://travis-ci.org/mpolden/echoip)
![Build Status](https://github.com/mpolden/echoip/workflows/ci/badge.svg)
A simple service for looking up your IP address. This is the code that powers
https://ifconfig.co.