Skip to content

Commit fec6c21

Browse files
committed
Run compatibility checks only in main branch.
Moved the compatibility check into it's own workflow. The workflow uses a flag to specify whether the step is enabled, as it cannot just be skipped, due to the all-jobs-complete dependency on the compatibility-test.
1 parent d2578c5 commit fec6c21

File tree

3 files changed

+46
-26
lines changed

3 files changed

+46
-26
lines changed

.github/workflows/build-lint-test.yml

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -83,29 +83,3 @@ jobs:
8383
echo "Working tree dirty at end of job"
8484
exit 1
8585
fi
86-
87-
compatibility-test:
88-
name: Compatibility test
89-
needs: prepare
90-
runs-on: ubuntu-latest
91-
strategy:
92-
matrix:
93-
node-version: [18.x, 20.x, 22.x]
94-
steps:
95-
- name: Checkout and setup environment
96-
uses: MetaMask/action-checkout-and-setup@v1
97-
with:
98-
is-high-risk-environment: false
99-
node-version: ${{ matrix.node-version }}
100-
- name: Install dependencies via Yarn
101-
run: rm yarn.lock && YARN_ENABLE_IMMUTABLE_INSTALLS=false yarn
102-
- run: yarn test
103-
- name: Restore lockfile
104-
run: git restore yarn.lock
105-
- name: Require clean working directory
106-
shell: bash
107-
run: |
108-
if ! git diff --exit-code; then
109-
echo "Working tree dirty at end of job"
110-
exit 1
111-
fi
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Compatibility Test
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
enabled:
7+
required: false
8+
type: boolean
9+
default: true
10+
11+
jobs:
12+
enabled-check:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Skipping compatibility test
16+
if: inputs.enabled != true
17+
run: echo "Skipping compatibility test"
18+
19+
compatibility-test:
20+
needs: enabled-check
21+
if: inputs.enabled == true
22+
runs-on: ubuntu-latest
23+
strategy:
24+
matrix:
25+
node-version: [18.x, 20.x, 22.x]
26+
steps:
27+
- uses: MetaMask/action-checkout-and-setup@v1
28+
with:
29+
is-high-risk-environment: false
30+
node-version: ${{ matrix.node-version }}
31+
- run: rm yarn.lock && YARN_ENABLE_IMMUTABLE_INSTALLS=false yarn
32+
- run: yarn test
33+
- run: git restore yarn.lock
34+
- shell: bash
35+
run: |
36+
if ! git diff --exit-code; then
37+
echo "Working tree dirty at end of job"
38+
exit 1
39+
fi

.github/workflows/main.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,20 @@ jobs:
3838
name: Build, lint, and test
3939
uses: ./.github/workflows/build-lint-test.yml
4040

41+
compatibility-test:
42+
name: Compatibility test
43+
uses: ./.github/workflows/compatibility-test.yml
44+
with:
45+
enabled: ${{ github.ref == 'refs/heads/main' }}
46+
4147
all-jobs-completed:
4248
name: All jobs completed
4349
runs-on: ubuntu-latest
4450
needs:
4551
- check-workflows
4652
- analyse-code
4753
- build-lint-test
54+
- compatibility-test
4855
outputs:
4956
PASSED: ${{ steps.set-output.outputs.PASSED }}
5057
steps:

0 commit comments

Comments
 (0)