@@ -3,73 +3,98 @@ name: tester
3
3
on :
4
4
push :
5
5
branches :
6
- - " main"
7
- paths :
8
- - ' **.go'
9
- - ' go.*'
10
- - ' .github/workflows/test.yml'
6
+ - ' main'
7
+ - ' release-**'
11
8
pull_request :
12
9
types :
13
10
- opened
14
11
- reopened
15
12
- synchronize
16
13
- ready_for_review
17
14
branches :
18
- - " main"
19
- paths :
20
- - ' **.go'
21
- - ' go.*'
22
- - ' .github/workflows/test.yml'
23
-
15
+ - ' main'
16
+ - ' release-**'
17
+
24
18
concurrency :
25
19
group : ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
26
20
cancel-in-progress : true
27
21
28
22
jobs :
29
- test :
23
+ changes :
24
+ outputs :
25
+ should-run-tests : ${{ steps.changes.outputs.go == 'true' }}
30
26
if : github.event.pull_request.draft == false
31
- name : runner / gotest
32
27
runs-on : ubuntu-22.04
33
- container : ghcr.io/runatlantis/testing-env:latest
34
28
steps :
35
- - uses : actions/checkout@v3
36
- - run : make test-all
37
- - run : make check-fmt
38
-
39
- # Check that there's no missing links for the website.
40
- # This job builds the website, starts a server to serve it, and then uses
41
- # muffet (https://github.com/raviqqe/muffet) to perform the link check.
42
- website_link_check :
43
- if : github.event.pull_request.draft == false
29
+ - uses : actions/checkout@v4
30
+ - uses : dorny/paths-filter@v3
31
+ id : changes
32
+ with :
33
+ filters : |
34
+ go:
35
+ - '**.go'
36
+ - 'go.*'
37
+ - '.github/workflows/test.yml'
38
+ test :
39
+ needs : [changes]
40
+ if : needs.changes.outputs.should-run-tests == 'true'
41
+ name : Tests
44
42
runs-on : ubuntu-22.04
43
+ container : ghcr.io/runatlantis/testing-env:latest
45
44
steps :
46
- - uses : actions/checkout@v3
45
+ - uses : actions/checkout@v4
47
46
48
- - uses : actions/setup-node@v3
47
+ # need to setup go toolchain explicitly
48
+ - uses : actions/setup-go@v5
49
49
with :
50
- node -version-file : .node-version
50
+ go -version-file : go.mod
51
51
52
- - name : run http-server
52
+ - run : make test-all
53
+ - run : make check-fmt
54
+ # ##########################################################
55
+ # Notifying #contributors about test failure on main branch
56
+ # ##########################################################
57
+ - name : Slack failure notification
58
+ if : ${{ github.ref == 'refs/heads/main' && failure() }}
59
+ uses : slackapi/slack-github-action@6c661ce58804a1a20f6dc5fbee7f0381b469e001 # v1.25.0
60
+ with :
61
+ payload : |
62
+ {
63
+ "blocks": [
64
+ {
65
+ "type": "section",
66
+ "text": {
67
+ "type": "mrkdwn",
68
+ "text": ":x: Failed GitHub Action:"
69
+ }
70
+ },
71
+ {
72
+ "type": "section",
73
+ "fields": [
74
+ {
75
+ "type": "mrkdwn",
76
+ "text": "*Workflow:*\n<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|${{ github.workflow }}>"
77
+ },
78
+ {
79
+ "type": "mrkdwn",
80
+ "text": "*Job:*\n${{ github.job }}"
81
+ },
82
+ {
83
+ "type": "mrkdwn",
84
+ "text": "*Repo:*\n${{ github.repository }}"
85
+ }
86
+ ]
87
+ }
88
+ ]
89
+ }
53
90
env :
54
- # renovate: datasource=github-releases depName=raviqqe/muffet
55
- MUFFET_VERSION : 2.6.3
56
- run : |
57
- npm install -g yarn
58
- # http-server is used to serve the website locally as muffet checks it.
59
- yarn global add http-server
60
- # install raviqqe/muffet to check for broken links.
61
- curl -L https://github.com/raviqqe/muffet/releases/download/v${MUFFET_VERSION}/muffet_${MUFFET_VERSION}_Linux_x86_64.tar.gz | tar -xz
62
- yarn install
63
- yarn website:build
64
- http-server runatlantis.io/.vuepress/dist &
65
-
66
- - name : wait until server listened
67
- run : curl --retry-delay 1 --retry 30 --retry-all-error http://localhost:8080
91
+ SLACK_WEBHOOK_URL : ${{ secrets.SLACK_WEBHOOK_URL }}
92
+ SLACK_WEBHOOK_TYPE : INCOMING_WEBHOOK
68
93
69
- - run : |
70
- ./muffet \
71
- -e 'https://github\.com/runatlantis/atlantis/edit/main/.*' \
72
- -e 'https://github.com/runatlantis/helm-charts#customization' \
73
- --header 'Accept-Encoding:deflate, gzip' \
74
- --buffer-size 8192 \
75
- http://localhost:8080/
94
+ skip-test :
95
+ needs : [changes]
96
+ if : needs.changes.outputs.should-run-tests == 'false'
97
+ name : Tests
98
+ runs-on : ubuntu-22.04
99
+ steps :
100
+ - run : ' echo "No build required" '
0 commit comments