-
Notifications
You must be signed in to change notification settings - Fork 119
124 lines (115 loc) · 3.46 KB
/
release.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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
---
name: Release pipeline
on:
release:
types:
- prereleased
tags:
- 'v*'
env:
TAG: ${{ github.event.release.tag_name }}
IS_RELEASE: true
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # needed for goreleaser
jobs:
test-nix:
strategy:
matrix:
os: [ ubuntu-20.04 ]
name: Run unit tests in ${{matrix.os}}
runs-on: ${{matrix.os}}
steps:
- name: checkout code
uses: actions/checkout@v2
- name: Install go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
- name: Run unit tests
run: make ci/test
- name: Coveralls Parallel
uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.github_token }}
path-to-lcov: ./coverage.out
flag-name: run-linux
parallel: true
test-integration-nix:
name: Run integration tests
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.OHAI_DOCKER_HUB_ID }}
password: ${{ secrets.OHAI_DOCKER_HUB_PASSWORD }}
- name: Run integration tests
run: make test-integration
snyk:
name: Run security checks via snyk
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.OHAI_DOCKER_HUB_ID }}
password: ${{ secrets.OHAI_DOCKER_HUB_PASSWORD }}
- name: Scan code for vulnerabilities
env:
SNYK_TOKEN: ${{ secrets.CAOS_SNYK_TOKEN }}
run: make ci/snyk-test
test-windows:
strategy:
matrix:
go: [ '1.22' ]
os: [ windows-2019 ]
name: Run unit and integration tests in ${{matrix.os}} with go ${{matrix.go}}
runs-on: ${{matrix.os}}
steps:
- name: checkout
uses: actions/checkout@v2
- name: install go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
- name: run unit tests
# we don't have 'make' on windows.
shell: bash
run: |
go test ./cmd/... ./integration-test/... ./internal/...
- name: run integration tests
# we don't have 'make' on windows.
shell: bash
run: |
go test --tags=integration ./cmd/... ./integration-test/... ./internal/...
prerelease:
name: Build and release binaries
runs-on: ubuntu-20.04
needs: [ test-nix, test-windows, snyk, test-integration-nix ]
steps:
- uses: actions/checkout@v2
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.OHAI_DOCKER_HUB_ID }}
password: ${{ secrets.OHAI_DOCKER_HUB_PASSWORD }}
- name: Pre release
run: make ci/pre-release
- name: Notify failure via Slack
if: ${{ failure() }}
uses: archive/github-actions-slack@master
with:
slack-bot-user-oauth-access-token: ${{ secrets.COREINT_SLACK_TOKEN }}
slack-channel: ${{ secrets.COREINT_SLACK_CHANNEL }}
slack-text: "❌ `${{ env.REPO_FULL_NAME }}`: prerelease pipeline failed."
finish:
name: Finish
needs: [ prerelease ]
runs-on: ubuntu-20.04
steps:
- name: Coveralls Finished
uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.github_token }}
parallel-finished: true