44 workflow_call :
55
66jobs :
7+ # Lint the code
8+ check-lint :
9+ name : " Check / Lint"
10+ runs-on : ubuntu-latest
11+ container :
12+ image : ghcr.io/matrixai/github-runner
13+ permissions :
14+ packages : read
15+ contents : read
16+ steps :
17+ - uses : actions/checkout@v4
18+ - name : Run linting
19+ run : |
20+ nix develop .#ci --command bash -c $'
21+ npm run lint
22+ '
23+
24+ # Create the merge PR
25+ build-merge :
26+ name : " Build / Merge"
27+ runs-on : ubuntu-latest
28+ container :
29+ image : ghcr.io/matrixai/github-runner
30+ permissions :
31+ packages : read
32+ contents : read
33+ pull-requests : write
34+ steps :
35+ - uses : actions/checkout@v4
36+ - name : Create Pull Request from Staging to Master
37+ env :
38+ GH_TOKEN : ${{ secrets.GH_TOKEN }}
39+ run : |
40+ nix develop .#ci --command bash -c $'
41+ gh pr create \
42+ --head staging \
43+ --base master \
44+ --title "ci: merge staging to master" \
45+ --body "This is an automatic PR generated by the CI/CD pipeline. This will be automatically fast-forward merged if successful." \
46+ --assignee "@me" \
47+ --no-maintainer-edit || true
48+ printf "Pipeline Attempt on $GITHUB_RUN_ID for $GITHUB_SHA\n\n$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID" \
49+ | gh pr comment staging \
50+ --body-file - \
51+ --repo "$GITHUB_REPOSITORY"
52+ '
53+
54+ # Build the distribution - JS is platform-agnostic
55+ build-dist :
56+ name : " Build / Dist"
57+ runs-on : ubuntu-latest
58+ container :
59+ image : ghcr.io/matrixai/github-runner
60+ permissions :
61+ packages : read
62+ contents : read
63+ actions : write
64+ steps :
65+ - uses : actions/checkout@v4
66+ - name : Run build
67+ run : |
68+ nix develop .#ci --command bash -c $'
69+ npm run build --verbose
70+ '
71+ - name : Upload Build
72+ uses : actions/upload-artifact@v4
73+ with :
74+ name : dist
75+ path : ./dist
76+
77+ # Build on every platform
78+ # This re-uses the built `./dist`, and run tests and benches
79+ build-platforms :
80+ name : " Build / Platforms"
81+ needs :
82+ - build-dist
83+ runs-on : ${{ matrix.os }}
84+ container :
85+ image : ${{ matrix.platform == 'linux' && 'ghcr.io/matrixai/github-runner' || null }}
86+ permissions :
87+ packages : read
88+ contents : read
89+ actions : write
90+ checks : write
91+ strategy :
92+ fail-fast : true
93+ matrix :
94+ include :
95+ - platform : linux
96+ os : ubuntu-latest
97+ script : |
98+ nix develop .#ci --command bash -c $'
99+ npm test -- --ci --coverage
100+ npm run bench
101+ '
102+ - platform : windows
103+ os : windows-latest
104+ script : |
105+ mkdir -Force "$CI_PROJECT_DIR/tmp"
106+ Import-Module $env:ChocolateyInstall\helpers\chocolateyProfile.psm1
107+ ./scripts/choco-install.ps1
108+ refreshenv
109+ npm install --ignore-scripts
110+ $env:Path = "$(npm root)\.bin;" + $env:Path
111+ npm test -- --ci --coverage
112+ npm run bench
113+ - platform : macos
114+ os : macos-latest
115+ script : |
116+ mkdir -p "$CI_PROJECT_DIR/tmp"
117+ eval "$(brew shellenv)"
118+ ./scripts/brew-install.sh
119+ hash -r
120+ npm install --ignore-scripts
121+ export PATH="$(npm root)/.bin:$PATH"
122+ npm test -- --ci --coverage
123+ npm run bench
124+ steps :
125+ - uses : actions/checkout@v4
126+ - uses : actions/download-artifact@v4
127+ with :
128+ name : dist
129+ path : ./dist
130+ - name : Build
131+ env : ${{ matrix.env }}
132+ run : ${{ matrix.script }}
133+ - name : Upload JUnit Report
134+ if : success() || failure()
135+ uses : actions/upload-artifact@v4
136+ with :
137+ name : junit-report
138+ path : ./tmp/junit/junit.xml
139+ - name : Publish JUnit Report
140+ uses : mikepenz/action-junit-report@v5
141+ with :
142+ report_paths : ./tmp/junit/junit.xml
143+ - name : Upload Cobertura report
144+ if : success() || failure()
145+ uses : actions/upload-artifact@v4
146+ with :
147+ name : coverage-report
148+ path : ./tmp/coverage/cobertura-coverage.xml
149+ - name : Upload Metrics Report
150+ if : success() || failure()
151+ uses : actions/upload-artifact@v4
152+ with :
153+ name : metrics-report
154+ path : ./benches/results/metrics.txt
155+
156+ integration-merge :
157+ name : " Integration / Merge"
158+ runs-on : ubuntu-latest
159+ container :
160+ image : ghcr.io/matrixai/github-runner
161+ concurrency :
162+ group : integration-merge
163+ cancel-in-progress : true
164+ needs :
165+ - check-lint
166+ - build-merge
167+ - build-dist
168+ - build-platforms
169+ permissions :
170+ packages : read
171+ contents : write
172+ pull-requests : write
173+ steps :
174+ - uses : actions/checkout@v4
175+ with :
176+ fetch-depth : 0
177+ - name : Merge Pull Request from Staging to Master
178+ env :
179+ GH_TOKEN : ${{ secrets.GH_TOKEN }}
180+ GIT_AUTHOR_EMAIL : ${{ secrets.GIT_AUTHOR_EMAIL }}
181+ GIT_AUTHOR_NAME : ${{ secrets.GIT_AUTHOR_NAME }}
182+ GIT_COMMITTER_EMAIL : ${{ secrets.GIT_COMMITTER_EMAIL }}
183+ GIT_COMMITTER_NAME : ${{ secrets.GIT_COMMITTER_NAME }}
184+ run : |
185+ printf "Pipeline Succeeded on $GITHUB_RUN_ID for $GITHUB_SHA\n\n$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID" \
186+ | gh pr comment staging \
187+ --body-file - \
188+ --repo "$GITHUB_REPOSITORY"
189+ git checkout master
190+ git merge --ff-only "$GITHUB_SHA"
191+ git push origin master
0 commit comments