Skip to content

Commit 7a4f1c3

Browse files
committed
Fix GitHub Actions workflows: standardize runner config and remove duplication
1 parent 7768039 commit 7a4f1c3

File tree

3 files changed

+115
-59
lines changed

3 files changed

+115
-59
lines changed

.github/workflows/ci.yml

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [master]
6+
pull_request:
7+
8+
concurrency:
9+
group: ${{ github.head_ref || github.run_id }}
10+
cancel-in-progress: true
11+
12+
jobs:
13+
secrets_scan:
14+
name: Secrets scan
15+
uses: ./.github/workflows/secrets-scan.yml
16+
secrets: inherit
17+
18+
notify_slack_success:
19+
name: Notify success status to Slack
20+
runs-on: ubuntu-latest
21+
if: success() && github.ref == 'refs/heads/master' && github.event_name == 'push'
22+
needs: [secrets_scan]
23+
permissions:
24+
actions: read
25+
contents: read
26+
id-token: write
27+
steps:
28+
- name: GSM Secrets
29+
id: secrets_manager
30+
uses: toptal/actions/gsm-secrets@main
31+
with:
32+
workload_identity_provider: projects/858873486241/locations/global/workloadIdentityPools/gha-pool/providers/github-com
33+
service_account: gha-keycodes@toptal-ci.iam.gserviceaccount.com
34+
secrets_name: |-
35+
SLACK_MARKETING_TOOLS_2_RELEASES_WEBHOOK:toptal-ci/SLACK_MARKETING_TOOLS_2_RELEASES_WEBHOOK
36+
SLACK_TEST_PUB_BOT_WEBHOOK:toptal-ci/SLACK_TEST_PUB_BOT_WEBHOOK
37+
38+
- name: Parse secrets
39+
id: parse_secrets
40+
uses: toptal/actions/expose-json-outputs@main
41+
with:
42+
json: ${{ steps.secrets_manager.outputs.secrets }}
43+
44+
- uses: toptal/slack-workflow-status@master
45+
with:
46+
repo_token: ${{ secrets.GITHUB_TOKEN }}
47+
slack_webhook_url: ${{ steps.parse_secrets.outputs.SLACK_MARKETING_TOOLS_2_RELEASES_WEBHOOK }}
48+
name: gha-bot
49+
icon_url: https://avatars.slack-edge.com/2021-05-17/2068859221653_526c61e414df90dd67f7_192.png
50+
include_jobs: on-failure
51+
display_only_failed: true
52+
include_commit_message: true
53+
54+
notify_slack_failure:
55+
name: Notify failure status to Slack
56+
runs-on: ubuntu-latest
57+
if: (failure() || cancelled()) && github.ref == 'refs/heads/master' && github.event_name == 'push'
58+
needs: [secrets_scan]
59+
permissions:
60+
actions: read
61+
contents: read
62+
id-token: write
63+
steps:
64+
- name: GSM Secrets
65+
id: secrets_manager
66+
uses: toptal/actions/gsm-secrets@main
67+
with:
68+
workload_identity_provider: projects/858873486241/locations/global/workloadIdentityPools/gha-pool/providers/github-com
69+
service_account: gha-keycodes@toptal-ci.iam.gserviceaccount.com
70+
secrets_name: |-
71+
SLACK_MARKETING_TOOLS_2_BULLHORN_WEBHOOK:toptal-ci/SLACK_MARKETING_TOOLS_2_BULLHORN_WEBHOOK
72+
SLACK_TEST_PUB_BOT_WEBHOOK:toptal-ci/SLACK_TEST_PUB_BOT_WEBHOOK
73+
74+
- name: Parse secrets
75+
id: parse_secrets
76+
uses: toptal/actions/expose-json-outputs@main
77+
with:
78+
json: ${{ steps.secrets_manager.outputs.secrets }}
79+
80+
- uses: toptal/slack-workflow-status@master
81+
with:
82+
repo_token: ${{ secrets.GITHUB_TOKEN }}
83+
slack_webhook_url: ${{ steps.parse_secrets.outputs.SLACK_MARKETING_TOOLS_2_BULLHORN_WEBHOOK }}
84+
name: gha-bot
85+
icon_url: https://avatars.slack-edge.com/2021-05-17/2068859221653_526c61e414df90dd67f7_192.png
86+
include_jobs: on-failure
87+
display_only_failed: true
88+
include_commit_message: true
89+

.github/workflows/secrets-scan.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66
jobs:
77
specs:
88
name: Secrets scan
9-
runs-on: ubuntu-latest
9+
runs-on: squad-growth-ubuntu2204-x64-xsmall
1010
permissions: write-all
1111
timeout-minutes: 10
1212
steps:

.github/workflows/unit.yml

Lines changed: 25 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -6,68 +6,35 @@ on:
66
pull_request:
77

88
jobs:
9-
secrets_scan:
10-
name: Secrets scan
11-
runs-on: squad-growth-ubuntu2204-x64-standard
12-
permissions: write-all
13-
timeout-minutes: 10
9+
unit_tests:
10+
name: Unit tests
11+
runs-on: ubuntu-latest
12+
timeout-minutes: 5
1413
steps:
15-
- uses: actions/checkout@v4
14+
- name: Cancel previous runs
15+
uses: styfle/cancel-workflow-action@0.11.0
1616
with:
17-
fetch-depth: 0
17+
access_token: ${{ github.token }}
1818

19-
- name: Get the secrets from GSM
20-
id: secrets_manager
21-
uses: toptal/actions/gsm-secrets@v1.0.2
22-
with:
23-
workload_identity_provider: projects/858873486241/locations/global/workloadIdentityPools/gha-pool/providers/github-com
24-
service_account: gha-keycodes@toptal-ci.iam.gserviceaccount.com
25-
secrets_name: |-
26-
SLACK_BOT_TOKEN:toptal-ci/SLACK_BOT_TOKEN
27-
28-
- name: Parse secrets
29-
id: parse_secrets
30-
uses: toptal/actions/expose-json-outputs@v1.0.2
31-
with:
32-
json: ${{ steps.secrets_manager.outputs.secrets }}
33-
34-
- name: Secrets Scan
35-
uses: toptal/actions/secret-scanning-action@main
36-
with:
37-
github-token: ${{ secrets.GITHUB_TOKEN }}
38-
full-scan: true
39-
slack-channel: -marketing-tools-2-releases
40-
slack-token: ${{ steps.parse_secrets.outputs.SLACK_BOT_TOKEN }}
19+
- uses: actions/checkout@v3
4120

42-
# unit_tests:
43-
# name: Unit tests
44-
# runs-on: ubuntu-latest
45-
# timeout-minutes: 5
46-
# steps:
47-
# - name: Cancel previous runs
48-
# uses: styfle/cancel-workflow-action@0.11.0
49-
# with:
50-
# access_token: ${{ github.token }}
21+
- name: Set up steps
22+
uses: ./.github/actions/setup-steps
5123

52-
# - uses: actions/checkout@v3
24+
- name: Unit tests
25+
run: yarn test:unit:coverage
5326

54-
# - name: Set up steps
55-
# uses: ./.github/actions/setup-steps
56-
57-
# - name: Unit tests
58-
# run: yarn test:unit:coverage
59-
60-
# - name: Upload Jest HTML report
61-
# if: failure()
62-
# uses: actions/upload-artifact@v4
63-
# with:
64-
# name: jest-unit-tests-report
65-
# path: reports/jest-report-unit.html
66-
# retention-days: 1
27+
- name: Upload Jest HTML report
28+
if: failure()
29+
uses: actions/upload-artifact@v4
30+
with:
31+
name: jest-unit-tests-report
32+
path: reports/jest-report-unit.html
33+
retention-days: 1
6734

68-
# - name: Upload unit tests coverage report
69-
# uses: actions/upload-artifact@v4
70-
# with:
71-
# name: jest-unit-coverage-report
72-
# path: test-coverage/unit
73-
# retention-days: 1
35+
- name: Upload unit tests coverage report
36+
uses: actions/upload-artifact@v4
37+
with:
38+
name: jest-unit-coverage-report
39+
path: test-coverage/unit
40+
retention-days: 1

0 commit comments

Comments
 (0)