Skip to content

Commit 773a39f

Browse files
committed
build: Add build pipelines and prepare package for publishing
1 parent 6a75d13 commit 773a39f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+7304
-713
lines changed

.github/workflows/node-ci.yml

Lines changed: 179 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,179 @@
1+
on:
2+
workflow_call:
3+
inputs:
4+
node-version:
5+
required: false
6+
type: string
7+
default: 18.x
8+
working-directory:
9+
required: false
10+
type: string
11+
default: '.'
12+
lint-script:
13+
required: false
14+
type: string
15+
default: npm run lint --if-present
16+
compile-script:
17+
required: false
18+
type: string
19+
default: npm run check-types --if-present
20+
pre-test-script:
21+
required: false
22+
type: string
23+
test-script:
24+
required: false
25+
type: string
26+
default: npm run test --if-present
27+
test-environment-variables:
28+
required: false
29+
type: string
30+
default: '{}'
31+
output-test-results:
32+
required: false
33+
type: boolean
34+
default: false
35+
test-results-file-pattern:
36+
required: false
37+
type: string
38+
default: '**/test-results.xml'
39+
audit-script:
40+
required: false
41+
type: string
42+
default: npm audit
43+
build-script:
44+
required: false
45+
type: string
46+
default: npm run build
47+
run-build:
48+
required: false
49+
type: boolean
50+
default: false
51+
run-commit-lint:
52+
required: false
53+
type: boolean
54+
default: false
55+
commit-lint-script:
56+
required: false
57+
type: string
58+
default: npx commitlint --from ${{ github.event.pull_request.base.sha }} --to ${{ github.event.pull_request.head.sha }} --verbose
59+
pre-run-script:
60+
required: false
61+
type: string
62+
upload-artifact-name:
63+
required: false
64+
type: string
65+
upload-artifact-path:
66+
required: false
67+
description: The full path to the artifact directory, this path does not take working-directory into account
68+
type: string
69+
default: .
70+
71+
download-artifact-name:
72+
required: false
73+
type: string
74+
download-artifact-pattern:
75+
required: false
76+
type: string
77+
download-artifact-path:
78+
required: false
79+
description: The full path to the artifact directory, this path does not take working-directory into account
80+
type: string
81+
default: .
82+
83+
secrets:
84+
npm-auth-token:
85+
description: NPM auth token (don't pass in on a PR build on a public repository)
86+
required: false
87+
88+
jobs:
89+
node-ci:
90+
runs-on: ubuntu-latest
91+
92+
defaults:
93+
run:
94+
shell: bash
95+
working-directory: ${{ inputs.working-directory }}
96+
97+
steps:
98+
- name: Checkout
99+
uses: actions/checkout@v4
100+
with:
101+
fetch-depth: 0
102+
103+
# setup node + private repo access
104+
- name: Use Node.js ${{ inputs.node-version }}
105+
uses: actions/setup-node@v4
106+
with:
107+
node-version: ${{ inputs.node-version }}
108+
registry-url: 'https://npm.pkg.github.com'
109+
scope: '@makerxstudio'
110+
cache: 'npm'
111+
cache-dependency-path: ${{ inputs.working-directory }}/package-lock.json
112+
113+
- name: Download artifacts
114+
if: ${{ inputs.download-artifact-name || inputs.download-artifact-pattern }}
115+
uses: actions/download-artifact@v4
116+
with:
117+
name: ${{ inputs.download-artifact-name }}
118+
pattern: ${{ inputs.download-artifact-pattern }}
119+
path: ${{ inputs.download-artifact-path }}
120+
121+
- name: Pre-run
122+
if: ${{ inputs.pre-run-script }}
123+
run: ${{ inputs.pre-run-script }}
124+
125+
# run npm ci preventing script access to npm auth token
126+
- run: npm ci --ignore-scripts
127+
env:
128+
NODE_AUTH_TOKEN: ${{ secrets.npm-auth-token || secrets.GITHUB_TOKEN }}
129+
# allow scripts to run without npm auth token
130+
- run: npm rebuild && npm run prepare --if-present
131+
132+
# run all the CI scripts
133+
- name: 'Commit lint'
134+
if: ${{ inputs.run-commit-lint }}
135+
run: ${{ inputs.commit-lint-script }}
136+
137+
- name: Lint
138+
run: ${{ inputs.lint-script }}
139+
140+
- name: Compile
141+
run: ${{ inputs.compile-script }}
142+
143+
- name: Pre-test
144+
if: ${{ inputs.pre-test-script }}
145+
run: ${{ inputs.pre-test-script }}
146+
147+
- name: Test
148+
run: ${{ inputs.test-script }}
149+
env: ${{ fromJson(inputs.test-environment-variables) }}
150+
151+
#Requires permissions.checks: write
152+
- name: Publish test results
153+
if: ${{ inputs.output-test-results }}
154+
uses: phoenix-actions/test-reporting@v10
155+
with:
156+
name: Test results
157+
path: ${{ inputs.test-results-file-pattern }}
158+
reporter: jest-junit
159+
output-to: checks
160+
fail-on-error: false
161+
162+
- name: Audit
163+
run: ${{ inputs.audit-script }}
164+
165+
- name: Build
166+
if: ${{ inputs.run-build }}
167+
run: ${{ inputs.build-script }}
168+
# CDK infrastructure build calls npm ci on /infrastructure/build, which may fail without NODE_AUTH_TOKEN
169+
env:
170+
NODE_AUTH_TOKEN: ${{ secrets.npm-auth-token || secrets.GITHUB_TOKEN }}
171+
172+
- name: Publish artifact
173+
if: ${{ inputs.upload-artifact-name }}
174+
uses: actions/upload-artifact@v4
175+
with:
176+
name: ${{ inputs.upload-artifact-name }}
177+
path: ${{ inputs.upload-artifact-path }}
178+
179+

.github/workflows/pr.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Pull Request
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
- alpha
8+
paths-ignore:
9+
- 'docs/**'
10+
- 'scripts/**'
11+
12+
13+
permissions:
14+
contents: read
15+
16+
jobs:
17+
build:
18+
name: 'Build @algorandfoundation/algorand-typescript-testing'
19+
uses: ./.github/workflows/node-ci.yml
20+
with:
21+
pre-test-script: |
22+
pipx install algokit
23+
algokit localnet start
24+
node-version: 20.x
25+
run-build: true
26+
run-commit-lint: true
27+
audit-script: npm run audit

.github/workflows/release.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: Publish
2+
3+
on:
4+
push:
5+
branches:
6+
- alpha
7+
- main
8+
- release
9+
workflow_dispatch:
10+
11+
concurrency: release
12+
13+
permissions:
14+
contents: write
15+
issues: write
16+
pull-requests: write
17+
18+
jobs:
19+
build:
20+
name: 'Build @algorandfoundation/algorand-typescript-testing'
21+
uses: ./.github/workflows/node-ci.yml
22+
with:
23+
pre-test-script: |
24+
pipx install algokit
25+
algokit localnet start
26+
node-version: 20.x
27+
run-build: true
28+
run-commit-lint: true
29+
audit-script: npm run audit
30+
upload-artifact-name: algo-ts-testing
31+
upload-artifact-path: ./dist
32+
33+
release:
34+
name: Release
35+
needs: build
36+
runs-on: ubuntu-latest
37+
steps:
38+
- name: Clone repository
39+
uses: actions/checkout@v4
40+
with:
41+
fetch-depth: 0
42+
43+
- name: Use Node.js 20.x
44+
uses: actions/setup-node@v4
45+
with:
46+
node-version: 20.x
47+
48+
- run: npm ci --ignore-scripts
49+
50+
- name: Download package artifacts
51+
uses: actions/download-artifact@v4
52+
with:
53+
path: artifacts
54+
55+
- name: Generate semantic version for @algorandfoundation/algorand-typescript-testing
56+
run: npx semantic-release
57+
env:
58+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
59+
60+
- name: Publish @algorandfoundation/algorand-typescript-testing
61+
uses: JS-DevTools/npm-publish@v3
62+
id: publish-puya-ts
63+
with:
64+
token: ${{ secrets.NPM_TOKEN }}
65+
package: artifacts/algo-ts-testing/package.json
66+
access: 'public'

.idea/.gitignore

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/algorand-typescript-testing.iml

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/codeStyles/Project.xml

Lines changed: 62 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/codeStyles/codeStyleConfig.xml

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/inspectionProfiles/Project_Default.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/jsLinters/eslint.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/modules.xml

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)