Skip to content

Commit 83721d9

Browse files
authored
Merge pull request #5565 from NomicFoundation/galargh/github-actions-deduplication
ci(v2): parameterise v2 packages ci to minimise duplication
2 parents 05664bc + 180994f commit 83721d9

21 files changed

+189
-1271
lines changed

.github/workflows/hardhat-chai-matchers-ci.yml

-77
This file was deleted.

.github/workflows/hardhat-ci.yml

+110
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: main
6+
paths:
7+
- ".github/workflows/hardhat-ci.yml"
8+
- "packages/**"
9+
- "config/**"
10+
- "pnpm-lock.yaml"
11+
pull_request:
12+
paths:
13+
- ".github/workflows/hardhat-ci.yml"
14+
- "packages/**"
15+
- "config/**"
16+
- "pnpm-lock.yaml"
17+
workflow_dispatch:
18+
19+
concurrency:
20+
group: ${{github.workflow}}-${{github.ref}}
21+
cancel-in-progress: true
22+
23+
jobs:
24+
list-packages:
25+
name: List packages
26+
runs-on: ubuntu-latest
27+
outputs:
28+
packages: ${{ steps.filter.outputs.changes }}
29+
steps:
30+
- uses: actions/checkout@v4
31+
- uses: actions/setup-node@v4
32+
with:
33+
node-version: 18
34+
- run: yq -p yaml -o json pnpm-lock.yaml | tee pnpm-lock.json
35+
- id: generate
36+
env:
37+
PACKAGE_IGNORE: |
38+
[
39+
".",
40+
"v-next/",
41+
"packages/common",
42+
"packages/eslint-plugin-hardhat-internal-rules",
43+
"packages/eslint-plugin-slow-imports",
44+
"packages/hardhat-core"
45+
]
46+
COMMON_FILTERS: |
47+
[
48+
".github/workflows/hardhat-ci.yml",
49+
"config/**",
50+
"packages/common/**",
51+
"pnpm-lock.yaml"
52+
]
53+
run: |
54+
echo "filters<<EOF" >> $GITHUB_OUTPUT
55+
node scripts/generate-filters.js |
56+
yq -Po yaml 'with_entries(.key |= sub("^packages/", ""))' |
57+
tee -a $GITHUB_OUTPUT
58+
echo "EOF" >> $GITHUB_OUTPUT
59+
- id: filter
60+
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
61+
with:
62+
filters: ${{ steps.generate.outputs.filters }}
63+
64+
ci:
65+
needs: list-packages
66+
67+
if: needs.list-packages.outputs.packages != '[]'
68+
69+
strategy:
70+
fail-fast: false
71+
matrix:
72+
package: ${{ fromJson(needs.list-packages.outputs.packages) }}
73+
os: [ubuntu-latest, macos-latest, windows-latest]
74+
node: [18, 20, 22]
75+
exclude:
76+
- package: hardhat-vyper
77+
os: windows-latest
78+
- package: hardhat-vyper
79+
os: macos-latest
80+
- os: windows-latest
81+
node: 20
82+
- os: macos-latest
83+
node: 20
84+
- os: windows-latest
85+
node: 22
86+
- os: macos-latest
87+
node: 22
88+
89+
name: "[${{ matrix.package }}] ci on ${{ matrix.os }} (Node ${{ matrix.node }})"
90+
runs-on: ${{ matrix.os }}
91+
defaults:
92+
run:
93+
working-directory: packages/${{ matrix.package }}
94+
95+
steps:
96+
- uses: actions/checkout@v4
97+
- name: Install pnpm
98+
uses: pnpm/action-setup@v3
99+
with:
100+
version: 9
101+
- uses: actions/setup-node@v4
102+
with:
103+
node-version: ${{ matrix.node }}
104+
cache: "pnpm"
105+
- name: Install dependencies
106+
run: pnpm install --frozen-lockfile --prefer-offline
107+
- name: Build
108+
run: pnpm build
109+
- name: Run tests
110+
run: pnpm run ${{ matrix.package == 'hardhat-chai-matchers' && 'test:ci' || 'test' }}

.github/workflows/hardhat-ethers-ci.yml

-73
This file was deleted.

.github/workflows/hardhat-foundry-ci.yml

-77
This file was deleted.

0 commit comments

Comments
 (0)