Skip to content

Commit e011f15

Browse files
authored
feat: contractual pivot - schema lifecycle orchestrator (#14)
1 parent 3878028 commit e011f15

181 files changed

Lines changed: 26570 additions & 7850 deletions

File tree

Some content is hidden

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

.eslintrc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,13 @@
7272
"prefer": "type-imports",
7373
"disallowTypeAnnotations": false
7474
}
75+
],
76+
"@typescript-eslint/no-unused-vars": [
77+
"error",
78+
{
79+
"argsIgnorePattern": "^_",
80+
"varsIgnorePattern": "^_"
81+
}
7582
]
7683
},
7784
"env": {

.github/workflows/ci.yml

Lines changed: 55 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,77 +1,79 @@
11
name: Continuous Integration
2-
on: [pull_request]
2+
on: pull_request
33

44
permissions:
55
id-token: write
66
contents: read
7+
actions: read
78
checks: write
9+
pull-requests: write
810

911
jobs:
1012
build:
1113
name: Build
1214
runs-on: ubuntu-latest
1315
strategy:
1416
matrix:
15-
node-version: [18.x, 20.x, 22.x]
17+
node-version: [20.x, 22.x, 24.x]
1618
steps:
1719
- name: Checkout
1820
uses: actions/checkout@v4
1921

20-
2122
- name: Use Node ${{ matrix.node-version }}
2223
uses: actions/setup-node@v4
2324
with:
2425
node-version: ${{ matrix.node-version }}
26+
2527
- name: Install pnpm
2628
uses: pnpm/action-setup@v4
2729
with:
2830
version: 9.15.4
29-
- uses: actions/cache@v2
31+
32+
- uses: actions/cache@v4
3033
with:
3134
path: '**/node_modules'
3235
key: ${{ runner.os }}-modules-${{ hashFiles('**/pnpm-lock.yaml') }}
3336

34-
- name: PNPM
37+
- name: Install dependencies
3538
run: pnpm install --frozen-lockfile
3639

3740
- name: Build
38-
run: pnpm run build
41+
run: pnpm build
3942

4043
lint:
4144
name: Lint
4245
runs-on: ubuntu-latest
4346
steps:
4447
- name: Checkout
4548
uses: actions/checkout@v4
49+
4650
- name: Setup Node
4751
uses: actions/setup-node@v4
4852
with:
4953
node-version: '22.x'
54+
5055
- name: Install pnpm
5156
uses: pnpm/action-setup@v4
5257
with:
5358
version: 9.15.4
54-
55-
- uses: actions/cache@v2
59+
60+
- uses: actions/cache@v4
5661
with:
5762
path: '**/node_modules'
5863
key: ${{ runner.os }}-modules-${{ hashFiles('**/pnpm-lock.yaml') }}
5964

60-
- name: PNPM
65+
- name: Install dependencies
6166
run: pnpm install --frozen-lockfile
6267

6368
- name: Lint
64-
run: pnpm run lint
65-
66-
- name: Validate Packages
67-
run: pnpm manypkg check
69+
run: pnpm lint
6870

6971
test:
70-
name: Test
72+
name: Unit Tests
7173
runs-on: ubuntu-latest
7274
strategy:
7375
matrix:
74-
project: ['doubles.jest', 'doubles.sinon', 'core.unit', 'doubles.vitest', 'di.nestjs', 'di.inversify', 'unit']
76+
project: ['cli', 'governance', 'changesets', 'json-schema-differ', 'types']
7577
steps:
7678
- name: Checkout
7779
uses: actions/checkout@v4
@@ -80,47 +82,61 @@ jobs:
8082
uses: actions/setup-node@v4
8183
with:
8284
node-version: '22.x'
85+
8386
- name: Install pnpm
8487
uses: pnpm/action-setup@v4
8588
with:
8689
version: 9.15.4
8790

88-
- uses: actions/cache@v2
91+
- uses: actions/cache@v4
8992
with:
9093
path: '**/node_modules'
9194
key: ${{ runner.os }}-modules-${{ hashFiles('**/pnpm-lock.yaml') }}
9295

93-
- name: PNPM
96+
- name: Install dependencies
9497
run: pnpm install --frozen-lockfile
9598

99+
- name: Build
100+
run: pnpm build
101+
96102
- name: Create Coverage Directory
97103
run: mkdir -p ${{ github.workspace }}/coverage
98104

99105
- name: Test
100-
run: pnpm --filter @contractual/${{ matrix.project }} run test
106+
run: pnpm lerna run test --scope @contractual/${{ matrix.project }} --stream
107+
continue-on-error: true
101108
env:
102-
JEST_JUNIT_OUTPUT_NAME: ${{ matrix.project }}.xml
103-
JEST_JUNIT_OUTPUT_DIR: ${{ github.workspace }}/test-reports
104-
JUNIT_OUTPUT_NAME: ${{ matrix.project }}
105-
JUNIT_OUTPUT_DIR: ${{ github.workspace }}/test-reports
106109
COVERAGE_DIR: ${{ github.workspace }}/coverage
107110
COVERAGE_FILE: coverage-${{ matrix.project }}.xml
108111

109-
- name: Tests Results
110-
uses: dorny/test-reporter@v1
111-
if: always()
112+
e2e:
113+
name: E2E Tests
114+
runs-on: ubuntu-latest
115+
needs: [build]
116+
steps:
117+
- name: Checkout
118+
uses: actions/checkout@v4
119+
120+
- name: Setup Node
121+
uses: actions/setup-node@v4
112122
with:
113-
reporter: 'jest-junit'
114-
name: Tests Results (${{ matrix.project }})
115-
path: ${{ github.workspace }}/test-reports/${{ matrix.project }}.xml
116-
fail-on-error: false
117-
118-
# - name: Upload Report to Codecov
119-
# uses: codecov/codecov-action@v3
120-
# with:
121-
# name: codecov-umbrella
122-
# flags: ${{ matrix.project }}
123-
# token: ${{ secrets.CODECOV_TOKEN }}
124-
# fail_ci_if_error: true
125-
# files: ${{ github.workspace }}/coverage/coverage-${{ matrix.project }}.xml
126-
# verbose: true
123+
node-version: '22.x'
124+
125+
- name: Install pnpm
126+
uses: pnpm/action-setup@v4
127+
with:
128+
version: 9.15.4
129+
130+
- uses: actions/cache@v4
131+
with:
132+
path: '**/node_modules'
133+
key: ${{ runner.os }}-modules-${{ hashFiles('**/pnpm-lock.yaml') }}
134+
135+
- name: Install dependencies
136+
run: pnpm install --frozen-lockfile
137+
138+
- name: Build
139+
run: pnpm build
140+
141+
- name: Run E2E Tests
142+
run: pnpm test:e2e

.github/workflows/e2e-release.yml

Lines changed: 162 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,162 @@
1+
name: E2E Release Simulation
2+
env:
3+
CI: true
4+
5+
on:
6+
workflow_call:
7+
inputs:
8+
target_branch:
9+
description: 'Branch to test release from'
10+
required: true
11+
type: string
12+
workflow_dispatch:
13+
inputs:
14+
target_branch:
15+
description: 'Branch to test release from'
16+
required: true
17+
type: string
18+
default: 'next'
19+
20+
permissions:
21+
contents: write
22+
id-token: write
23+
24+
jobs:
25+
e2e:
26+
name: E2E (${{ matrix.e2e-project }}, Node ${{ matrix.node-version }})
27+
runs-on: ubuntu-latest
28+
strategy:
29+
fail-fast: false
30+
matrix:
31+
e2e-project: ['cli-basic', 'cli-lifecycle', 'packages-import']
32+
node-version: [20.x, 22.x, 24.x]
33+
steps:
34+
- name: Checkout
35+
uses: actions/checkout@v4
36+
with:
37+
ref: ${{ inputs.target_branch }}
38+
fetch-depth: 0
39+
40+
- name: Setup Node ${{ matrix.node-version }}
41+
uses: actions/setup-node@v4
42+
with:
43+
node-version: ${{ matrix.node-version }}
44+
45+
- name: Install pnpm
46+
uses: pnpm/action-setup@v4
47+
with:
48+
version: 9.15.4
49+
50+
- name: Install dependencies
51+
run: pnpm install --frozen-lockfile
52+
53+
- name: Run Verdaccio Docker
54+
run: |
55+
docker run -d --name verdaccio \
56+
-p 4873:4873 \
57+
-v ${{ github.workspace }}/e2e/config.yaml:/verdaccio/conf/config.yaml \
58+
verdaccio/verdaccio
59+
60+
- name: Wait for Verdaccio
61+
run: |
62+
for i in {1..30}; do
63+
if curl -s http://localhost:4873 > /dev/null; then
64+
echo "Verdaccio is ready"
65+
break
66+
fi
67+
echo "Waiting for Verdaccio..."
68+
sleep 1
69+
done
70+
71+
- name: Build
72+
run: pnpm build
73+
74+
- name: Setup Registry
75+
uses: actions/setup-node@v4
76+
with:
77+
node-version: ${{ matrix.node-version }}
78+
registry-url: http://localhost:4873
79+
scope: '@contractual'
80+
always-auth: false
81+
82+
- name: Install jq
83+
run: sudo apt-get install jq
84+
85+
- name: Remove provenance from package.json files
86+
run: |
87+
find packages -name 'package.json' | while read filename; do
88+
jq 'del(.publishConfig.provenance)' "$filename" > temp.json && mv temp.json "$filename"
89+
done
90+
91+
- name: Config Git
92+
run: |
93+
git config --global user.email "e2e@contractual.dev"
94+
git config --global user.name "Contractual e2e"
95+
96+
- name: Commit Provenance Change
97+
run: |
98+
git add .
99+
git commit -am "remove provenance"
100+
101+
- name: Version Packages
102+
run: |
103+
BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD)
104+
npx lerna version --yes \
105+
--conventional-commits \
106+
--conventional-prerelease \
107+
--preid e2e \
108+
--no-changelog \
109+
--allow-branch "$BRANCH_NAME" \
110+
--no-git-tag-version \
111+
--no-push \
112+
--force-publish \
113+
--no-commit-hooks
114+
115+
- name: Commit Packages Versions
116+
run: |
117+
git add .
118+
git commit -am "bump versions"
119+
120+
- name: Capture Versions for Report
121+
run: |
122+
echo "## E2E Test Results" >> $GITHUB_STEP_SUMMARY
123+
echo "" >> $GITHUB_STEP_SUMMARY
124+
echo "**Project:** \`${{ matrix.e2e-project }}\`" >> $GITHUB_STEP_SUMMARY
125+
echo "**Node:** \`${{ matrix.node-version }}\`" >> $GITHUB_STEP_SUMMARY
126+
echo "" >> $GITHUB_STEP_SUMMARY
127+
echo "### Versions:" >> $GITHUB_STEP_SUMMARY
128+
lerna ls --json | jq -r '.[] | "- **\(.name)** -> `v\(.version)`"' >> $GITHUB_STEP_SUMMARY
129+
130+
- name: Publish Packages to Verdaccio
131+
run: |
132+
npx lerna publish from-package --yes \
133+
--no-git-tag-version \
134+
--no-push \
135+
--no-git-reset \
136+
--exact \
137+
--dist-tag e2e
138+
139+
- name: Clean Source (simulate fresh install)
140+
run: |
141+
rm -rf packages
142+
rm -rf node_modules
143+
rm pnpm-lock.yaml
144+
rm package.json
145+
rm -f .npmrc
146+
147+
- name: Install E2E Dependencies from Verdaccio
148+
run: |
149+
cd "${{ github.workspace }}/e2e/${{ matrix.e2e-project }}"
150+
npm install --registry http://localhost:4873 --no-package-lock
151+
152+
- name: Execute Tests
153+
run: |
154+
cd "${{ github.workspace }}/e2e/${{ matrix.e2e-project }}"
155+
npm test
156+
157+
- name: Test Success Summary
158+
if: success()
159+
run: |
160+
echo "" >> $GITHUB_STEP_SUMMARY
161+
echo "### Test Passed" >> $GITHUB_STEP_SUMMARY
162+
echo "Packages work correctly when published" >> $GITHUB_STEP_SUMMARY

0 commit comments

Comments
 (0)