Skip to content

changed generate examples actions back to its original form, opting t… #562

changed generate examples actions back to its original form, opting t…

changed generate examples actions back to its original form, opting t… #562

name: Generate Examples
on:
# push:
# branches-ignore:
# - main
# - changeset-release/main
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
generate-examples:
if: github.event_name == 'deployment_status' && github.event.deployment_status.state == 'success'
name: Create latest examples
runs-on: ubuntu-latest
outputs:
commit_sha: ${{ steps.commit_changes.outputs.commit_long_sha }}
steps:
- name: Prepare Check Runs
uses: dflydev/check-runs-action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
checks: |
[
{ "id": "packages-unit-int-tests", "name": "Packages unit and Integration tests" },
{ "id": "generate-examples", "name": "Generate latest examples" },
{ "id": "examples-unit-int-tests", "name": "Examples unit and Integration tests" },
{ "id": "examples-e2e-tests", "name": "Examples e2e tests" }
]
status: "queued"
- name: Checkout Repo
uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
with:
version: 8
- name: Setup Node.js 18.x
uses: actions/setup-node@v3
with:
node-version: 18.x
cache: pnpm
- name: Make .env.examples file (used in examples configuration.ts)
run: |
echo "${{ secrets.EXAMPLES_ENV_FILE }}" > .env.examples
- name: Make .env file for composable-cli package
run: |
touch ./packages/composable-cli/.env
echo POSTHOG_PUBLIC_API_KEY=${{ secrets.POSTHOG_PUBLIC_API_KEY }} >> ./packages/composable-cli/.env
cat ./packages/composable-cli/.env
- name: Install Dependencies
run: pnpm install
- name: Build schematic schema types
run: pnpm generate
- name: Build packages/*
run: pnpm build:packages
- name: Report "Run packages unit and Integration tests" starting
uses: dflydev/check-runs-action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
id: packages-unit-int-tests
status: in_progress
- name: Run packages unit and Integration tests
run: pnpm test:packages
id: packages-unit-int-tests
continue-on-error: true
- name: Report "Run packages unit and Integration tests" conclusion
if: always()
uses: dflydev/check-runs-action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
id: packages-unit-int-tests
conclusion: ${{ steps.packages-unit-int-tests.outcome }}
fail-on-error: true
- name: Report "Generate latest examples using script" starting
uses: dflydev/check-runs-action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
id: generate-examples
status: in_progress
- name: Generate latest examples using script
id: generate-examples
run: pnpm scaffold:local
continue-on-error: true
- name: Report "Generate latest examples using script" conclusion
if: always()
uses: dflydev/check-runs-action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
id: generate-examples
conclusion: ${{ steps.generate-examples.outcome }}
fail-on-error: true
- name: Commit changes
id: commit_changes
uses: EndBug/add-and-commit@v9
with:
message: 'chore: generated latest examples'
committer_name: GitHub Actions
committer_email: 41898282+github-actions[bot]@users.noreply.github.com
default_author: github_actions
add: '*'
- name: Install additional dependencies
run: pnpm install
- name: Report "Run examples unit/integration tests" starting
uses: dflydev/check-runs-action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
id: examples-unit-int-tests
status: in_progress
- name: Run examples unit/integration tests
id: examples-unit-int-tests
run: pnpm test
continue-on-error: true
- name: Report "Run examples unit/integration tests" conclusion
if: always()
uses: dflydev/check-runs-action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
id: examples-unit-int-tests
conclusion: ${{ steps.examples-unit-int-tests.outcome }}
fail-on-error: true
- name: Make .env.test file
run: |
echo "${{ secrets.TEST_ENV_FILE }}" > .env.test
echo NEXT_PUBLIC_CI=true >> .env.test
echo NEXT_PUBLIC_CI=true >> ./examples/simple/.env.test
- name: Build everything
run: pnpm build:e2e
- name: Install playwright browsers
run: npx playwright install --with-deps
- name: Report "Run examples e2e tests" starting
uses: dflydev/check-runs-action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
id: examples-e2e-tests
status: in_progress
- name: Run e2e tests for latest examples
run: pnpm test:e2e
id: examples-e2e-tests
continue-on-error: true
env:
BASE_URL: ${{ github.event.deployment_status.environment_url }}
- name: Upload test results
if: always()
uses: actions/upload-artifact@v3
with:
name: test-results
path: examples/simple/test-results
continue-on-error: true
- name: Report "Run examples e2e tests" conclusion
if: always()
uses: dflydev/check-runs-action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
id: examples-e2e-tests
conclusion: ${{ steps.examples-e2e-tests.outcome }}
fail-on-error: true