Skip to content

Commit 9cffc1f

Browse files
authored
Fix syntax error in job pre-condition (#149)
build(workflow): fix syntax error in job pre-condition build(workflow): improve tests and validation workflows
1 parent 8ee850b commit 9cffc1f

4 files changed

Lines changed: 80 additions & 52 deletions

File tree

.github/workflows/commands-handler.yml

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,41 @@ name: Commands processor
33
on:
44
issue_comment:
55
types: [created]
6-
6+
defaults:
7+
run:
8+
shell: bash
79

810
jobs:
911
process:
1012
name: Process command
11-
if: ${{ github.event.issue.pull_request && endsWith(github.repository, '-private') != true && startsWith(github.event.comment.body, '@client-engineering-bot ') }}
13+
if: github.event.issue.pull_request && endsWith(github.repository, '-private') != true
1214
runs-on: ubuntu-latest
1315
steps:
16+
- name: Check referred user
17+
id: user-check
18+
env:
19+
CLEN_BOT: ${{ secrets.CLEN_BOT }}
20+
run: echo "expected-user=${{ startsWith(github.event.comment.body, format('@{0} ', env.CLEN_BOT)) }}" >> $GITHUB_OUTPUT
21+
- name: Regular comment
22+
if: steps.user-check.outputs.expected-user != 'true'
23+
run: echo -e "\033[38;2;19;181;255mThis is regular commit which should be ignored.\033[0m"
1424
- name: Checkout repository
25+
if: steps.user-check.outputs.expected-user == 'true'
1526
uses: actions/checkout@v3
1627
with:
17-
token: ${{ secrets.GH_TOKEN }}
28+
token: ${{ secrets.GH_TOKEN }}
1829
- name: Checkout release actions
30+
if: steps.user-check.outputs.expected-user == 'true'
1931
uses: actions/checkout@v3
2032
with:
2133
repository: pubnub/client-engineering-deployment-tools
2234
ref: v1
2335
token: ${{ secrets.GH_TOKEN }}
2436
path: .github/.release/actions
2537
- name: Process changelog entries
38+
if: steps.user-check.outputs.expected-user == 'true'
2639
uses: ./.github/.release/actions/actions/commands
2740
with:
2841
token: ${{ secrets.GH_TOKEN }}
29-
jira-api-key: ${{ secrets.JIRA_API_KEY }}
30-
listener: client-engineering-bot
42+
listener: ${{ secrets.CLEN_BOT }}
43+
jira-api-key: ${{ secrets.JIRA_API_KEY }}

.github/workflows/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
check-release:
1111
name: Check release required
1212
runs-on: ubuntu-latest
13-
if: ${{ github.event.pull_request.merged && endsWith(github.repository, '-private') != true }}
13+
if: github.event.pull_request.merged && endsWith(github.repository, '-private') != true
1414
outputs:
1515
release: ${{ steps.check.outputs.ready }}
1616
steps:
@@ -30,7 +30,7 @@ jobs:
3030
name: Publish package
3131
runs-on: ubuntu-latest
3232
needs: check-release
33-
if: ${{ needs.check-release.outputs.release == 'true' }}
33+
if: needs.check-release.outputs.release == 'true'
3434
steps:
3535
- name: Checkout repository
3636
uses: actions/checkout@v3

.github/workflows/run-tests.yml

Lines changed: 33 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -3,50 +3,45 @@ name: Tests
33
on:
44
push:
55
workflow_dispatch:
6-
6+
concurrency:
7+
group: ${{ github.workflow }}-${{ github.ref }}
8+
cancel-in-progress: true
9+
defaults:
10+
run:
11+
shell: bash
712

813
jobs:
914
tests:
1015
name: Integration and Unit tests
1116
runs-on: ubuntu-latest
17+
strategy:
18+
fail-fast: true
19+
matrix:
20+
python: [3.7.13, 3.8.13, 3.9.13, 3.10-dev]
1221
steps:
1322
- name: Checkout repository
1423
uses: actions/checkout@v3
1524
with:
1625
token: ${{ secrets.GH_TOKEN }}
17-
- name: Setup Python 3.7
18-
uses: actions/setup-python@v4
19-
with:
20-
python-version: '3.7.13'
21-
- name: Build and run tests for Python 3.7
22-
run: |
23-
./scripts/install.sh
24-
python scripts/run-tests.py
25-
- name: Setup Python 3.8
26-
uses: actions/setup-python@v4
27-
with:
28-
python-version: '3.8.13'
29-
- name: Build and run tests for Python 3.8
30-
run: |
31-
./scripts/install.sh
32-
python scripts/run-tests.py
33-
- name: Setup Python 3.9
34-
uses: actions/setup-python@v4
26+
- name: Checkout actions
27+
uses: actions/checkout@v3
3528
with:
36-
python-version: '3.9.13'
37-
- name: Build and run tests for Python 3.9
38-
run: |
39-
./scripts/install.sh
40-
python scripts/run-tests.py
41-
- name: Setup Python 3.10
29+
repository: pubnub/client-engineering-deployment-tools
30+
ref: v1
31+
token: ${{ secrets.GH_TOKEN }}
32+
path: .github/.release/actions
33+
- name: Setup Python ${{ matrix.python }}
4234
uses: actions/setup-python@v4
4335
with:
44-
python-version: '3.10-dev'
45-
- name: Build and run tests for Python 3.10
36+
python-version: ${{ matrix.python }}
37+
- name: Build and run tests for Python ${{ matrix.python }}
4638
run: |
4739
./scripts/install.sh
4840
python scripts/run-tests.py
49-
acceptance:
41+
- name: Cancel workflow runs for commit on error
42+
if: failure()
43+
uses: ./.github/.release/actions/actions/utils/fast-jobs-failure
44+
acceptance-tests:
5045
name: Acceptance tests
5146
runs-on: ubuntu-latest
5247
steps:
@@ -82,3 +77,13 @@ jobs:
8277
name: acceptance-test-reports
8378
path: ./reports
8479
retention-days: 7
80+
- name: Cancel workflow runs for commit on error
81+
if: failure()
82+
uses: ./.github/.release/actions/actions/utils/fast-jobs-failure
83+
all-tests:
84+
name: Tests
85+
runs-on: ubuntu-latest
86+
needs: [tests, acceptance-tests]
87+
steps:
88+
- name: Tests summary
89+
run: echo -e "\033[38;2;95;215;0m\033[1mAll tests successfully passed"

.github/workflows/run-validations.yml

Lines changed: 27 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,30 @@ name: Validations
33
on: [push]
44

55
jobs:
6-
validators:
7-
name: "Validate .pubnub.yml"
8-
runs-on: ubuntu-latest
9-
steps:
10-
- name: Checkout project
11-
uses: actions/checkout@v3
12-
- name: Checkout validator action
13-
uses: actions/checkout@v3
14-
with:
15-
repository: pubnub/client-engineering-deployment-tools
16-
ref: v1
17-
token: ${{ secrets.GH_TOKEN }}
18-
path: .github/.release/actions
19-
- name: "Run '.pubnub.yml' file validation"
20-
uses: ./.github/.release/actions/actions/validators/pubnub-yml
21-
with:
22-
token: ${{ secrets.GH_TOKEN }}
6+
pubnub-yml:
7+
name: "Validate .pubnub.yml"
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Checkout project
11+
uses: actions/checkout@v3
12+
- name: Checkout validator action
13+
uses: actions/checkout@v3
14+
with:
15+
repository: pubnub/client-engineering-deployment-tools
16+
ref: v1
17+
token: ${{ secrets.GH_TOKEN }}
18+
path: .github/.release/actions
19+
- name: "Run '.pubnub.yml' file validation"
20+
uses: ./.github/.release/actions/actions/validators/pubnub-yml
21+
with:
22+
token: ${{ secrets.GH_TOKEN }}
23+
- name: Cancel workflow runs for commit on error
24+
if: failure()
25+
uses: ./.github/.release/actions/actions/utils/fast-jobs-failure
26+
all-validations:
27+
name: Validations
28+
runs-on: ubuntu-latest
29+
needs: [pubnub-yml]
30+
steps:
31+
- name: Validations summary
32+
run: echo -e "\033[38;2;95;215;0m\033[1mAll validations passed"

0 commit comments

Comments
 (0)