Skip to content

Commit 562d4f6

Browse files
committed
Centralize workflows in ci.yml, fix runner config
1 parent 7768039 commit 562d4f6

5 files changed

Lines changed: 133 additions & 62 deletions

File tree

.github/workflows/ci.yml

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
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+
lint_typescript:
14+
name: Lint and Typescript checks
15+
uses: ./.github/workflows/lint-typescript.yml
16+
secrets: inherit
17+
18+
unit_tests:
19+
name: Unit tests
20+
uses: ./.github/workflows/unit.yml
21+
secrets: inherit
22+
23+
e2e_tests:
24+
name: End-to-end tests
25+
uses: ./.github/workflows/e2e.yml
26+
secrets: inherit
27+
28+
secrets_scan:
29+
name: Secrets scan
30+
uses: ./.github/workflows/secrets-scan.yml
31+
secrets: inherit
32+
33+
notify_slack_success:
34+
name: Notify success status to Slack
35+
runs-on: ubuntu-latest
36+
if: success() && github.ref == 'refs/heads/master' && github.event_name == 'push'
37+
needs: [lint_typescript, unit_tests, e2e_tests, secrets_scan]
38+
permissions:
39+
actions: read
40+
contents: read
41+
id-token: write
42+
steps:
43+
- name: GSM Secrets
44+
id: secrets_manager
45+
uses: toptal/actions/gsm-secrets@main
46+
with:
47+
workload_identity_provider: projects/858873486241/locations/global/workloadIdentityPools/gha-pool/providers/github-com
48+
service_account: gha-keycodes@toptal-ci.iam.gserviceaccount.com
49+
secrets_name: |-
50+
SLACK_MARKETING_TOOLS_2_RELEASES_WEBHOOK:toptal-ci/SLACK_MARKETING_TOOLS_2_RELEASES_WEBHOOK
51+
SLACK_TEST_PUB_BOT_WEBHOOK:toptal-ci/SLACK_TEST_PUB_BOT_WEBHOOK
52+
53+
- name: Parse secrets
54+
id: parse_secrets
55+
uses: toptal/actions/expose-json-outputs@main
56+
with:
57+
json: ${{ steps.secrets_manager.outputs.secrets }}
58+
59+
- uses: toptal/slack-workflow-status@master
60+
with:
61+
repo_token: ${{ secrets.GITHUB_TOKEN }}
62+
slack_webhook_url: ${{ steps.parse_secrets.outputs.SLACK_MARKETING_TOOLS_2_RELEASES_WEBHOOK }}
63+
name: gha-bot
64+
icon_url: https://avatars.slack-edge.com/2021-05-17/2068859221653_526c61e414df90dd67f7_192.png
65+
include_jobs: on-failure
66+
display_only_failed: true
67+
include_commit_message: true
68+
69+
notify_slack_failure:
70+
name: Notify failure status to Slack
71+
runs-on: ubuntu-latest
72+
if: (failure() || cancelled()) && github.ref == 'refs/heads/master' && github.event_name == 'push'
73+
needs: [lint_typescript, unit_tests, e2e_tests, secrets_scan]
74+
permissions:
75+
actions: read
76+
contents: read
77+
id-token: write
78+
steps:
79+
- name: GSM Secrets
80+
id: secrets_manager
81+
uses: toptal/actions/gsm-secrets@main
82+
with:
83+
workload_identity_provider: projects/858873486241/locations/global/workloadIdentityPools/gha-pool/providers/github-com
84+
service_account: gha-keycodes@toptal-ci.iam.gserviceaccount.com
85+
secrets_name: |-
86+
SLACK_MARKETING_TOOLS_2_BULLHORN_WEBHOOK:toptal-ci/SLACK_MARKETING_TOOLS_2_BULLHORN_WEBHOOK
87+
SLACK_TEST_PUB_BOT_WEBHOOK:toptal-ci/SLACK_TEST_PUB_BOT_WEBHOOK
88+
89+
- name: Parse secrets
90+
id: parse_secrets
91+
uses: toptal/actions/expose-json-outputs@main
92+
with:
93+
json: ${{ steps.secrets_manager.outputs.secrets }}
94+
95+
- uses: toptal/slack-workflow-status@master
96+
with:
97+
repo_token: ${{ secrets.GITHUB_TOKEN }}
98+
slack_webhook_url: ${{ steps.parse_secrets.outputs.SLACK_MARKETING_TOOLS_2_BULLHORN_WEBHOOK }}
99+
name: gha-bot
100+
icon_url: https://avatars.slack-edge.com/2021-05-17/2068859221653_526c61e414df90dd67f7_192.png
101+
include_jobs: on-failure
102+
display_only_failed: true
103+
include_commit_message: true
104+

.github/workflows/e2e.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: End-to-end tests
33
on:
44
push:
55
branches: [main]
6-
pull_request:
6+
workflow_call:
77

88
jobs:
99
e2e_tests:

.github/workflows/lint-typescript.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Lint and Typescript
33
on:
44
push:
55
branches: [main]
6-
pull_request:
6+
workflow_call:
77

88
jobs:
99
lint_typescript:

.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: 26 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -3,71 +3,38 @@ name: Unit tests
33
on:
44
push:
55
branches: [main]
6-
pull_request:
6+
workflow_call:
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)