-
Notifications
You must be signed in to change notification settings - Fork 7
96 lines (88 loc) · 2.9 KB
/
build-integration.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
name: build-integration
on:
pull_request:
types: [ opened, reopened, synchronize ]
push:
branches:
- master
concurrency:
# running pipeline per workflow per PR
group: ${{ github.head_ref || github.run_id }}-${{ github.workflow }}
# Running a new pipeline will cancel any running pipelines that belong to the above group
cancel-in-progress: true
jobs:
unit:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- uses: actions/setup-go@v3
with:
go-version: 1.17.3
- run: make test
rubocop:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- uses: ruby/setup-ruby@v1
with:
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
- run: bundle exec rubocop
check-deps-tidy:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- uses: actions/setup-go@v3
with:
go-version: 1.17.3
- run: go mod tidy
- run: |
if ! git diff --exit-code -- go.mod go.sum; then
echo "Modules not tidy; please run 'go mod tidy'";
fi;
check-deps-updated:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- uses: actions/setup-go@v3
with:
go-version: 1.17.3
- run: go mod download
- run: env GOPROXY=off go build -mod=readonly ./...
integration:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- uses: actions/setup-go@v3
with:
go-version: 1.17.3
- name: Build linux binary
run: make build-production
- uses: ruby/setup-ruby@v1
with:
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
- name: Run integration tests
run: make test-integration
release:
if: contains('refs/heads/master', github.ref)
needs: integration
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/[email protected]
- uses: actions/setup-go@v3
with:
go-version: 1.17.3
- name: Release
run: |-
CURRENT_VERSION="v$(cat DRAUPNIR_VERSION)"
if [[ $(git tag -l "${CURRENT_VERSION}") == "${CURRENT_VERSION}" ]]; then
echo "Version ${CURRENT_VERSION} is already released"
exit 0
fi
curl -L -o /tmp/goreleaser_Linux_x86_64.tar.gz https://github.com/goreleaser/goreleaser/releases/download/v1.10.2/goreleaser_Linux_x86_64.tar.gz
tar zxf /tmp/goreleaser_Linux_x86_64.tar.gz -C /tmp
git log --pretty=oneline --abbrev-commit --no-decorate --no-color "$(git describe --tags --abbrev=0)..HEAD" -- pkg cmd vendor internal > /tmp/release-notes
git tag "${CURRENT_VERSION}"
git push --tags
/tmp/goreleaser --rm-dist --release-notes /tmp/release-notes