From b6c488b7d4f32af8136cabe64224de7e7898f411 Mon Sep 17 00:00:00 2001 From: Nicholas Thompson Date: Thu, 6 May 2021 22:46:27 +0200 Subject: [PATCH 1/3] Move to github builds Co-authored-by: Jedri Visser --- .github/workflows/docker-build.yml | 60 ++++++++++++++++++++++++++++++ .travis.yml | 28 -------------- 2 files changed, 60 insertions(+), 28 deletions(-) create mode 100644 .github/workflows/docker-build.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml new file mode 100644 index 0000000..959ce1e --- /dev/null +++ b/.github/workflows/docker-build.yml @@ -0,0 +1,60 @@ +name: inverter-gui-docker-builder +on: + push: + branches: + - "**" + tags: + - "v*" + pull_request: + +jobs: + inverter_gui_pipeline: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: "Setup" + uses: actions/setup-go@v2 + with: + go-version: '1.16' + + - name: Lint + uses: golangci/golangci-lint-action@v2 + with: + version: latest + + - name: Test + run: go test -v -race ./... + + - name: Generate docker image labels and tags + id: docker_meta + uses: crazy-max/ghaction-docker-meta@v2 + with: + images: ghcr.io/diebietse/invertergui + tags: | + type=ref,event=branch + type=semver,pattern={{version}} + type=semver,pattern={{major}}.{{minor}} + + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Login to GitHub Container Registry + if: github.event_name != 'pull_request' + uses: docker/login-action@v1 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.CR_PAT }} + + - name: Build and push to GitHub Container Registry + uses: docker/build-push-action@v2 + with: + platforms: linux/amd64,linux/arm64,linux/arm/v7 + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.docker_meta.outputs.tags }} + labels: ${{ steps.docker_meta.outputs.labels }} diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index e54b386..0000000 --- a/.travis.yml +++ /dev/null @@ -1,28 +0,0 @@ -sudo: false - -language: go - -env: - - GO111MODULE=on - -go: - - 1.16.x - -git: - depth: 1 - -install: true - -notifications: - email: false - -before_script: - - curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $(go env GOPATH)/bin v1.39.0 - - go mod vendor - -script: - - golangci-lint run - - go test -v -race -coverprofile=coverage.txt -covermode=atomic ./... - -after_success: - - bash <(curl -s https://codecov.io/bash) From 41b3db045745ec6cace24501e519cc2136501e03 Mon Sep 17 00:00:00 2001 From: Nicholas Thompson Date: Thu, 6 May 2021 22:46:43 +0200 Subject: [PATCH 2/3] Update workspace dictonary --- .vscode/settings.json | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 9de7f53..31a5bc1 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -10,5 +10,13 @@ "[go]": { "editor.insertSpaces": false, "editor.tabSize": 4 - } + }, + "cSpell.words": [ + "diebietse", + "ghaction", + "ghcr", + "golangci", + "invertergui", + "semver" + ] } From d02baa4e8dc821eb343c7452b9deef9818dfe025 Mon Sep 17 00:00:00 2001 From: Nicholas Thompson Date: Thu, 6 May 2021 22:50:23 +0200 Subject: [PATCH 3/3] Add codecov support --- .github/workflows/docker-build.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml index 959ce1e..d966b14 100644 --- a/.github/workflows/docker-build.yml +++ b/.github/workflows/docker-build.yml @@ -25,7 +25,10 @@ jobs: version: latest - name: Test - run: go test -v -race ./... + run: go test -v -race -coverprofile=coverage.txt -covermode=atomic ./... + + - name: Upload code coverage + uses: codecov/codecov-action@v1 - name: Generate docker image labels and tags id: docker_meta