...
1name: CI
2
3on:
4 push:
5 pull_request:
6
7jobs:
8 lint:
9 runs-on: ubuntu-latest
10 steps:
11 - uses: actions/checkout@v2
12
13 - name: golangci-lint
14 uses: golangci/golangci-lint-action@v2
15
16 test:
17 runs-on: ubuntu-latest
18 strategy:
19 matrix:
20 go: ["1.16.x", "1.17.x"]
21 steps:
22 - uses: actions/checkout@v2
23
24 - uses: actions/setup-go@v2
25 with:
26 go-version: ${{ matrix.go }}
27
28 - name: Run test
29 run: make test COVERAGE_DIR=/tmp/coverage
30
31 - name: Send goveralls coverage
32 uses: shogo82148/actions-goveralls@v1
33 with:
34 path-to-profile: /tmp/coverage/combined.txt
35 flag-name: Go-${{ matrix.go }}
36 parallel: true
37
38 check-coverage:
39 name: Check coverage
40 needs: [test]
41 runs-on: ubuntu-latest
42 steps:
43 - uses: shogo82148/actions-goveralls@v1
44 with:
45 parallel-finished: true
46
47 goreleaser:
48 name: Release a new version
49 needs: [lint, test]
50 runs-on: ubuntu-latest
51 environment: GoReleaser
52 # This job only runs when
53 # 1. When the previous `lint` and `test` jobs has completed successfully
54 # 2. When the repository is not a fork, i.e. it will only run on the official golang-migrate/migrate
55 # 3. When the workflow is triggered by a tag with `v` prefix
56 if: ${{ success() && github.repository == 'golang-migrate/migrate' && startsWith(github.ref, 'refs/tags/v') }}
57 steps:
58 - uses: actions/checkout@v2
59 with:
60 fetch-depth: 0
61 - uses: ruby/setup-ruby@v1
62 with:
63 ruby-version: 2.7
64 - uses: actions/setup-go@v2
65 with:
66 go-version: "1.17.x"
67
68 - uses: docker/setup-qemu-action@v1
69 - uses: docker/setup-buildx-action@v1
70 - uses: docker/login-action@v1
71 with:
72 username: golangmigrate
73 password: ${{ secrets.DOCKERHUB_TOKEN }}
74
75 - run: echo "SOURCE=$(make echo-source)" >> $GITHUB_ENV
76 - run: echo "DATABASE=$(make echo-database)" >> $GITHUB_ENV
77
78 - uses: goreleaser/goreleaser-action@v2
79 with:
80 version: latest
81 args: release --rm-dist
82 env:
83 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
84
85 - run: gem install package_cloud
86 - run: package_cloud push golang-migrate/migrate/ubuntu/bionic dist/migrate.linux-amd64.deb
87 env:
88 PACKAGECLOUD_TOKEN: ${{ secrets.PACKAGECLOUD_TOKEN }}
89 - run: package_cloud push golang-migrate/migrate/ubuntu/focal dist/migrate.linux-amd64.deb
90 env:
91 PACKAGECLOUD_TOKEN: ${{ secrets.PACKAGECLOUD_TOKEN }}
92 - run: package_cloud push golang-migrate/migrate/debian/buster dist/migrate.linux-amd64.deb
93 env:
94 PACKAGECLOUD_TOKEN: ${{ secrets.PACKAGECLOUD_TOKEN }}
95 - run: package_cloud push golang-migrate/migrate/debian/bullseye dist/migrate.linux-amd64.deb
96 env:
97 PACKAGECLOUD_TOKEN: ${{ secrets.PACKAGECLOUD_TOKEN }}
View as plain text