Skip to content

Commit b5c4466

Browse files
committed
Updating testyml file
1 parent 92c1129 commit b5c4466

File tree

1 file changed

+73
-48
lines changed

1 file changed

+73
-48
lines changed

.github/workflows/test.yml

+73-48
Original file line numberDiff line numberDiff line change
@@ -3,73 +3,98 @@ name: tester
33
on:
44
push:
55
branches:
6-
- "main"
7-
paths:
8-
- '**.go'
9-
- 'go.*'
10-
- '.github/workflows/test.yml'
6+
- 'main'
7+
- 'release-**'
118
pull_request:
129
types:
1310
- opened
1411
- reopened
1512
- synchronize
1613
- ready_for_review
1714
branches:
18-
- "main"
19-
paths:
20-
- '**.go'
21-
- 'go.*'
22-
- '.github/workflows/test.yml'
23-
15+
- 'main'
16+
- 'release-**'
17+
2418
concurrency:
2519
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
2620
cancel-in-progress: true
2721

2822
jobs:
29-
test:
23+
changes:
24+
outputs:
25+
should-run-tests: ${{ steps.changes.outputs.go == 'true' }}
3026
if: github.event.pull_request.draft == false
31-
name: runner / gotest
3227
runs-on: ubuntu-22.04
33-
container: ghcr.io/runatlantis/testing-env:latest
3428
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
4442
runs-on: ubuntu-22.04
43+
container: ghcr.io/runatlantis/testing-env:latest
4544
steps:
46-
- uses: actions/checkout@v3
45+
- uses: actions/checkout@v4
4746

48-
- uses: actions/setup-node@v3
47+
# need to setup go toolchain explicitly
48+
- uses: actions/setup-go@v5
4949
with:
50-
node-version-file: .node-version
50+
go-version-file: go.mod
5151

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+
}
5390
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
6893

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

Comments
 (0)