Skip to content

Commit ea39dea

Browse files
committed
ci: add more details
1 parent 99dcf8c commit ea39dea

File tree

2 files changed

+51
-15
lines changed

2 files changed

+51
-15
lines changed

.github/workflows/contracts.yaml

Lines changed: 48 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,62 @@
11
name: Build and deploy contracts
22

33
on:
4+
push:
5+
branches: [ main, develop ]
46
pull_request:
5-
branches:
6-
- main
7-
- develop
87

98
jobs:
10-
changed_files:
9+
detect-changes:
10+
name: Detect Changes
1111
runs-on: ubuntu-latest
12-
name: Test changed-files
12+
outputs:
13+
sdk: ${{ steps.changed-files.outputs.sdk_changed }}
14+
smart_contract: ${{ steps.changed-files.outputs.smart_contract_changed }}
15+
subgraph: ${{ steps.changed-files.outputs.subgraph_changed }}
16+
dapp: ${{ steps.changed-files.outputs.dapp_changed }}
1317
steps:
14-
- uses: actions/checkout@v4
18+
- name: Checkout code
19+
uses: actions/checkout@v4
20+
with:
21+
# Adjust fetch-depth as needed
22+
fetch-depth: 0
1523

16-
- name: Get changed files
24+
- name: Detect package changes
1725
id: changed-files
1826
uses: tj-actions/changed-files@v45
1927
with:
20-
matrix: 'true'
28+
files_yaml: |
29+
sdk:
30+
- 'packages/sdk/**'
31+
smart_contract:
32+
- 'packages/smart-contract/**'
33+
subgraph:
34+
- 'packages/subgraph/**'
35+
dapp:
36+
- 'packages/protected-data-delivery-dapp/**'
37+
# Enable matrix output for use in subsequent jobs
38+
matrix: true
39+
40+
build-and-test:
41+
name: Build & Test Modified Packages
42+
needs: detect-changes
43+
runs-on: ubuntu-latest
44+
strategy:
45+
matrix:
46+
package: [ sdk, smart_contract, subgraph, dapp ]
47+
# Run this job only if changes were detected in the respective package
48+
if: ${{ fromJson(needs.detect-changes.outputs[matrix.package]).any_changed == 'true' }}
49+
steps:
50+
- name: Checkout code
51+
uses: actions/checkout@v4
52+
53+
- name: Setup Node.js
54+
uses: actions/setup-node@v4
55+
with:
56+
node-version: '18'
2157

22-
- name: Run step if any file(s) in the docs folder change
23-
if: steps.changed-files-specific.outputs.any_changed == 'true'
24-
env:
25-
ALL_CHANGED_FILES: ${{ steps.changed-files-specific.outputs.all_changed_files }}
58+
- name: Install dependencies and run tests for ${{ matrix.package }}
59+
working-directory: packages/${{ matrix.package }}
2660
run: |
27-
echo "One or more files in the docs folder has changed."
28-
echo "List all the files that have changed: $ALL_CHANGED_FILES"
61+
npm ci
62+
npm run test

.github/workflows/conventional-commits.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@ name: Conventional Commits
22

33
on:
44
pull_request:
5-
branches: [ master ]
5+
branches:
6+
- develop
7+
- main
68

79
jobs:
810
build:

0 commit comments

Comments
 (0)