Sitelet https://github.com/limitless-angular/limitless-angular/pull/27/files
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
212 changes: 212 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,218 @@ jobs:

- run: pnpm turbo run build test --affected

sanity-compat-eligibility:
runs-on: ubuntu-latest
outputs:
reason: ${{ steps.sanity-compat-eligibility.outputs.reason }}
run: ${{ steps.sanity-compat-eligibility.outputs.run }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: pnpm/action-setup@v4

- uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: 'pnpm'

- run: pnpm install

- run: pnpm turbo run test --filter=@limitless-angular/angular-compat

- name: Check affected Sanity compatibility
id: sanity-compat-eligibility
shell: bash
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
pnpm turbo run compat:affected --filter=@limitless-angular/angular-compat -- --force --github-output "$GITHUB_OUTPUT"
exit 0
fi

if [ "${{ github.event_name }}" = "pull_request" ]; then
base_ref="${{ github.event.pull_request.base.sha }}"
else
base_ref="${{ github.event.before }}"
fi

pnpm turbo run compat:affected --filter=@limitless-angular/angular-compat -- --base-ref "$base_ref" --github-output "$GITHUB_OUTPUT"

sanity-compat-pack:
needs: sanity-compat-eligibility
if: needs.sanity-compat-eligibility.outputs.run == 'true'
runs-on: ubuntu-latest
outputs:
version_sets: ${{ steps.compat-matrix.outputs.version_sets }}
canary_version_sets: ${{ steps.compat-canary-matrix.outputs.canary_version_sets }}
steps:
- uses: actions/checkout@v4

- uses: pnpm/action-setup@v4

- uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: 'pnpm'

- run: pnpm install

- run: pnpm turbo run compat:assert --filter=@limitless-angular/angular-compat

- run: pnpm turbo run compat:release-parity --filter=@limitless-angular/angular-compat

- name: Resolve Angular consumer matrix
id: compat-matrix
run: echo "version_sets=$(pnpm --filter=@limitless-angular/angular-compat run --silent compat:matrix)" >> "$GITHUB_OUTPUT"

- name: Resolve Angular canary matrix
id: compat-canary-matrix
run: echo "canary_version_sets=$(pnpm --filter=@limitless-angular/angular-compat run --silent compat:matrix --canary)" >> "$GITHUB_OUTPUT"

- run: pnpm turbo run compat:pack --filter=@limitless-angular/angular-compat

- run: pnpm turbo run compat:artifact --filter=@limitless-angular/angular-compat

- uses: actions/upload-artifact@v4
with:
name: sanity-compat-package
path: .compat/artifacts/*.tgz
if-no-files-found: error

sanity-compat-consumer:
needs: sanity-compat-pack
if: needs.sanity-compat-pack.result == 'success'
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
version_set: ${{ fromJson(needs.sanity-compat-pack.outputs.version_sets) }}
steps:
- uses: actions/checkout@v4

- uses: pnpm/action-setup@v4

- uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: 'pnpm'

- run: pnpm install

- uses: actions/download-artifact@v4
with:
name: sanity-compat-package
path: .compat/artifacts

- run: pnpm --dir tools/angular-compat exec playwright install --with-deps chromium

- run: pnpm turbo run compat:test --filter=@limitless-angular/angular-compat -- --set ${{ matrix.version_set.id }}

sanity-compat-canary:
needs: sanity-compat-pack
if: needs.sanity-compat-pack.result == 'success'
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
version_set: ${{ fromJson(needs.sanity-compat-pack.outputs.canary_version_sets) }}
steps:
- uses: actions/checkout@v4

- uses: pnpm/action-setup@v4

- uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: 'pnpm'

- run: pnpm install

- uses: actions/download-artifact@v4
with:
name: sanity-compat-package
path: .compat/artifacts

- run: pnpm --dir tools/angular-compat exec playwright install --with-deps chromium

- name: Test Angular canary compatibility
id: canary
shell: bash
env:
VERSION_SET_JSON: ${{ toJson(matrix.version_set) }}
run: |
mkdir -p .compat/canary
log_path=".compat/canary/${{ matrix.version_set.id }}.log"
metadata_path=".compat/canary/${{ matrix.version_set.id }}-metadata.json"
status_path=".compat/canary/${{ matrix.version_set.id }}.json"

set +e
pnpm turbo run compat:test --filter=@limitless-angular/angular-compat -- --set "${{ matrix.version_set.id }}" --metadata-out "$metadata_path" 2>&1 | tee "$log_path"
status=${PIPESTATUS[0]}
set -e

pnpm turbo run compat:canary-status --filter=@limitless-angular/angular-compat -- \
--version-set-json "$VERSION_SET_JSON" \
--exit-code "$status" \
--log "$log_path" \
--metadata "$metadata_path" \
--out "$status_path"

if [ "$status" -eq 0 ]; then
echo "status=passed" >> "$GITHUB_OUTPUT"
else
echo "status=failed" >> "$GITHUB_OUTPUT"
fi

- uses: actions/upload-artifact@v4
if: always() && steps.canary.outputs.status != ''
with:
name: angular-canary-status-${{ matrix.version_set.id }}
path: |
.compat/canary/${{ matrix.version_set.id }}.json
.compat/canary/${{ matrix.version_set.id }}.log
if-no-files-found: error

sanity-compat-canary-report:
needs: sanity-compat-canary
if: always() && github.event_name == 'pull_request' && needs.sanity-compat-canary.result != 'skipped'
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
issues: write
pull-requests: write
steps:
- uses: actions/checkout@v4

- uses: actions/download-artifact@v4
id: download-canary-status
continue-on-error: true
with:
pattern: angular-canary-status-*
path: .compat/canary-status
merge-multiple: true

- name: Publish Angular canary advisory
uses: actions/github-script@v7
env:
STATUS_DIR: .compat/canary-status
DOWNLOAD_OUTCOME: ${{ steps.download-canary-status.outcome }}
with:
script: |
const { publishCanaryReportForGitHubScript } = await import(
`${process.cwd()}/tools/angular-compat/canary-report.mjs`,
);

await publishCanaryReportForGitHubScript({
context,
core,
downloadOutcome: process.env.DOWNLOAD_OUTCOME,
github,
statusDir: process.env.STATUS_DIR,
});

presentation-e2e:
runs-on: ubuntu-22.04
steps:
Expand Down
56 changes: 36 additions & 20 deletions .github/workflows/release-and-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
# prevents this action from running on forks
if: github.repository == 'limitless-angular/limitless-angular'
name: Release and Publish to npm
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
permissions:
contents: write # needed for creating GitHub releases
id-token: write # needed for provenance data generation
Expand Down Expand Up @@ -68,6 +68,9 @@ jobs:
- name: Check for lint errors
run: pnpm turbo run lint --filter=@limitless-angular/sanity

- name: Check release compatibility pipeline
run: pnpm turbo run compat:release-parity --filter=@limitless-angular/angular-compat

- name: Set up Git user
run: |
git config --global user.name "GitHub Actions"
Expand Down Expand Up @@ -108,43 +111,56 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

# Only proceed with building if release was successful
- name: Build sanity project
- name: Pack sanity project
id: build
if: steps.release.outcome == 'success'
run: pnpm turbo run build --filter=@limitless-angular/sanity
run: pnpm turbo run compat:pack --filter=@limitless-angular/angular-compat

- name: Validate packed artifact shape
if: steps.build.outcome == 'success'
run: pnpm turbo run compat:artifact --filter=@limitless-angular/angular-compat

- name: Install Playwright browser
if: steps.build.outcome == 'success'
run: pnpm --dir tools/angular-compat exec playwright install --with-deps chromium

- name: Test packed artifact compatibility
if: steps.build.outcome == 'success'
run: pnpm turbo run compat:test --filter=@limitless-angular/angular-compat

# Validate build artifacts
- name: Validate build artifacts
if: steps.build.outcome == 'success'
run: |
# Validate that the output directory exists
if [ ! -d "dist/packages/sanity" ]; then
echo "::error::Build artifacts not found at dist/packages/sanity"
TARBALL_COUNT=$(find .compat/artifacts -maxdepth 1 -name '*.tgz' | wc -l | tr -d ' ')
if [ "$TARBALL_COUNT" != "1" ]; then
echo "::error::Expected one packed artifact in .compat/artifacts, found $TARBALL_COUNT"
exit 1
fi

# Validate package.json version matches the released version
if [ -f "dist/packages/sanity/package.json" ]; then
ARTIFACT_VERSION=$(jq -r '.version' dist/packages/sanity/package.json)
echo "Built package version: $ARTIFACT_VERSION"
echo "Expected version from release step: ${{ env.RELEASED_VERSION }}"

if [ "$ARTIFACT_VERSION" != "${{ env.RELEASED_VERSION }}" ]; then
echo "::error::Version mismatch! Package.json version ($ARTIFACT_VERSION) doesn't match the released version (${{ env.RELEASED_VERSION }})"
exit 1
fi
else
echo "::error::package.json not found in build artifacts"
TARBALL=$(find .compat/artifacts -maxdepth 1 -name '*.tgz' | head -n 1)
echo "TARBALL=$TARBALL" >> "$GITHUB_ENV"
ARTIFACT_VERSION=$(tar -xOf "$TARBALL" package/package.json | jq -r '.version')
EXPECTED_VERSION="${{ env.RELEASED_VERSION }}"
if [ "${{ inputs.dryRun }}" = "true" ]; then
EXPECTED_VERSION=$(jq -r '.version' packages/sanity/package.json)
fi

echo "Packed package version: $ARTIFACT_VERSION"
echo "Expected package version: $EXPECTED_VERSION"

if [ "$ARTIFACT_VERSION" != "$EXPECTED_VERSION" ]; then
echo "::error::Version mismatch! Package version ($ARTIFACT_VERSION) doesn't match expected version ($EXPECTED_VERSION)"
exit 1
fi

echo "Build artifacts validated successfully"
echo "Packed artifact validated successfully"

# Publish packages to npm if all previous steps succeeded and not a dry run
- name: Publish packages to npm
id: publish
if: ${{ !inputs.dryRun && steps.release.outcome == 'success' && steps.build.outcome == 'success' }}
run: pnpm publish dist/packages/sanity --access public --registry https://registry.npmjs.org --no-git-checks
run: npm publish "$TARBALL" --access public --registry https://registry.npmjs.org
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_ACCESS_TOKEN }}
NPM_CONFIG_PROVENANCE: true
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ testem.log
Thumbs.db

.turbo
.compat
/angular.json

.angular
Expand Down
11 changes: 11 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,17 @@
"build": "turbo run build",
"lint": "turbo run lint",
"test": "turbo run test",
"compat": "pnpm turbo run compat:pipeline --filter=@limitless-angular/angular-compat",
"compat:affected": "pnpm turbo run compat:affected --filter=@limitless-angular/angular-compat --",
"compat:affected:test": "pnpm turbo run test --filter=@limitless-angular/angular-compat",
"compat:assert": "pnpm turbo run compat:assert --filter=@limitless-angular/angular-compat",
"compat:artifact": "pnpm turbo run compat:artifact --filter=@limitless-angular/angular-compat --",
"compat:canary-report": "pnpm turbo run compat:canary-report --filter=@limitless-angular/angular-compat --",
"compat:canary-status": "pnpm turbo run compat:canary-status --filter=@limitless-angular/angular-compat --",
"compat:matrix": "pnpm --filter=@limitless-angular/angular-compat run --silent compat:matrix",
"compat:pack": "pnpm turbo run compat:pack --filter=@limitless-angular/angular-compat",
"compat:release-parity": "pnpm turbo run compat:release-parity --filter=@limitless-angular/angular-compat",
"compat:test": "pnpm turbo run compat:test --filter=@limitless-angular/angular-compat --",
"format:write": "prettier --write .",
"release": "node tools/scripts/release.ts"
},
Expand Down
13 changes: 13 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pnpm-workspace.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ packages:
- 'packages/*'
- 'packages/sanity/*'
- 'apps/*'
- 'tools/*'
overrides:
'@babel/traverse': 7.26.4
'@portabletext/editor': 1.15.3
Expand Down
Loading
Loading