Skip to content

Commit

Permalink
ci: migrate from CircleCI to GitHub Actions (#605)
Browse files Browse the repository at this point in the history
* ci: migrate from CircleCI to GitHub Actions

Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>

* ci: merge release.yaml into ci.yaml

At the time of this commit, it is not possible to make the `goreleaser`
job run in a separate workflow and detect the tag push event, see [1].

[1]: https://stackoverflow.com/a/68078768/7902371
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
  • Loading branch information
Juneezee committed Aug 6, 2021
1 parent b2c89c7 commit 5aa3b3a
Showing 1 changed file with 51 additions and 5 deletions.
56 changes: 51 additions & 5 deletions .github/workflows/release.yaml → .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,59 @@
name: release
name: CI

on:
push:
tags:
- "v*"
pull_request:

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: golangci-lint
uses: golangci/golangci-lint-action@v2

test:
runs-on: ubuntu-latest
strategy:
matrix:
go: ["1.15.x", "1.16.x"]
steps:
- uses: actions/checkout@v2

- uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go }}

- name: Run test
run: make test COVERAGE_DIR=/tmp/coverage

- name: Send goveralls coverage
uses: shogo82148/actions-goveralls@v1
with:
path-to-profile: /tmp/coverage/combined.txt
flag-name: Go-${{ matrix.go }}
parallel: true

check-coverage:
name: Check coverage
needs: [test]
runs-on: ubuntu-latest
steps:
- uses: shogo82148/actions-goveralls@v1
with:
parallel-finished: true

goreleaser:
name: Release a new version
environment: GoReleaser
needs: [lint, test]
runs-on: ubuntu-latest
environment: GoReleaser
# This job only runs when
# 1. When the previous `lint` and `test` jobs has completed successfully
# 2. When the repository is not a fork, i.e. it will only run on the official golang-migrate/migrate
# 3. When the workflow is triggered by a tag with `v` prefix
if: ${{ success() && github.repository == 'golang-migrate/migrate' && startsWith(github.ref, 'refs/tags/v') }}
steps:
- uses: actions/checkout@v2
with:
Expand Down Expand Up @@ -45,4 +91,4 @@ jobs:
PACKAGECLOUD_TOKEN: ${{ secrets.PACKAGECLOUD_TOKEN }}
- run: package_cloud push golang-migrate/migrate/debian/buster dist/migrate.linux-amd64.deb
env:
PACKAGECLOUD_TOKEN: ${{ secrets.PACKAGECLOUD_TOKEN }}
PACKAGECLOUD_TOKEN: ${{ secrets.PACKAGECLOUD_TOKEN }}

0 comments on commit 5aa3b3a

Please sign in to comment.