Skip to content

Commit

Permalink
chore: ci
Browse files Browse the repository at this point in the history
  • Loading branch information
magne4000 committed Sep 18, 2024
1 parent a8af791 commit e93a80f
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 83 deletions.
1 change: 1 addition & 0 deletions .github/actions/bati-run/action.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Step 5
name: Execute Bati CLI and run E2E tests

inputs:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,18 @@
name: Tests

# Step 2
on:
pull_request:
paths-ignore:
- 'website/**'
push:
# Ensures cache is computed on main branch so that it can be reused on all PRs
branches: [ "main" ]
paths-ignore:
- 'website/**'

concurrency:
group: ${{ github.ref }}
cancel-in-progress: true

workflow_call:
inputs:
os:
required: true
type: string
node:
required: true
type: number
fast:
type: boolean
jobs:
monorepo:
runs-on: ${{ matrix.os }}
runs-on: ${{ inputs.os }}

# Debug discrepancies between published package and local one
# services:
Expand All @@ -26,20 +22,14 @@ jobs:
# ports:
# - 4873:4873

strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
node: [20]
fail-fast: false

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
node-version: ${{ inputs.node }}

- uses: pnpm/action-setup@v4
name: Install pnpm
Expand All @@ -60,9 +50,9 @@ jobs:
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
key: ${{ inputs.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
${{ inputs.os }}-pnpm-store-
- name: Cache for Turbo
uses: rharkor/[email protected]
Expand Down Expand Up @@ -104,7 +94,7 @@ jobs:
- name: Archive Bati CLI
uses: actions/upload-artifact@v4
with:
name: bati-cli-${{ matrix.os }}-${{ matrix.node }}
name: bati-cli-${{ inputs.os }}-${{ inputs.node }}
if-no-files-found: error
retention-days: 1
overwrite: true
Expand All @@ -117,7 +107,7 @@ jobs:
- name: Archive Bati tests
uses: actions/upload-artifact@v4
with:
name: bati-tests-${{ matrix.os }}-${{ matrix.node }}
name: bati-tests-${{ inputs.os }}-${{ inputs.node }}
if-no-files-found: error
retention-days: 1
overwrite: true
Expand All @@ -131,7 +121,7 @@ jobs:
- name: Archive tests-utils
uses: actions/upload-artifact@v4
with:
name: tests-utils-${{ matrix.os }}-${{ matrix.node }}
name: tests-utils-${{ inputs.os }}-${{ inputs.node }}
if-no-files-found: error
retention-days: 1
overwrite: true
Expand All @@ -141,7 +131,7 @@ jobs:
- name: Archive tests files
uses: actions/upload-artifact@v4
with:
name: tests-files-${{ matrix.os }}-${{ matrix.node }}
name: tests-files-${{ inputs.os }}-${{ inputs.node }}
if-no-files-found: error
retention-days: 1
overwrite: true
Expand All @@ -150,18 +140,7 @@ jobs:

- name: List e2e tests
id: list-e2e
run: pnpm run test:e2e list --workers 5
env:
TEST_AUTH0_CLIENT_ID: ${{ secrets.TEST_AUTH0_CLIENT_ID }}
TEST_AUTH0_ISSUER_BASE_URL: ${{ secrets.TEST_AUTH0_ISSUER_BASE_URL }}
TEST_FIREBASE_ACCOUNT: ${{ secrets.TEST_FIREBASE_ACCOUNT }}
TEST_FIREBASE_USER_UID: ${{ secrets.TEST_FIREBASE_USER_UID }}
TEST_GITHUB_CLIENT_ID: ${{ secrets.TEST_GITHUB_CLIENT_ID }}
TEST_GITHUB_CLIENT_SECRET: ${{ secrets.TEST_GITHUB_CLIENT_SECRET }}

- name: List e2e tests
id: list-e2e-small
run: pnpm run test:e2e list --workers 1 --filter=react,hono
run: pnpm run test:e2e list ${{ inputs.fast && '--workers 1 --filter=react,h3' || '--workers 5' }}
env:
TEST_AUTH0_CLIENT_ID: ${{ secrets.TEST_AUTH0_CLIENT_ID }}
TEST_AUTH0_ISSUER_BASE_URL: ${{ secrets.TEST_AUTH0_ISSUER_BASE_URL }}
Expand All @@ -172,15 +151,6 @@ jobs:

outputs:
test-matrix: ${{ steps.list-e2e.outputs.test-matrix }}
test-matrix-small: ${{ steps.list-e2e-small.outputs.test-matrix }}

# - name: Archive summary
# if: matrix.os == 'ubuntu-latest'
# uses: actions/upload-artifact@v4
# with:
# name: ${{ runner.os }}-${{ matrix.node }}-summary
# path: |
# ${{ runner.temp }}/bati/.turbo/runs/*.json

generated:
needs: monorepo
Expand All @@ -190,39 +160,9 @@ jobs:
test-matrix: ${{ fromJson(needs.monorepo.outputs.test-matrix) }}
name: "Trigger e2e tests: Group ${{ matrix.test-matrix[0] }}"

uses: ./.github/workflows/reusable.yml
secrets: inherit
with:
entry: ${{ matrix.test-matrix[1] }}
os: ubuntu-latest
node: 20

generated-windows:
needs: monorepo
strategy:
fail-fast: false
matrix:
test-matrix: ${{ fromJson(needs.monorepo.outputs.test-matrix-small) }}
name: "Trigger e2e tests: Group Windows"

uses: ./.github/workflows/reusable.yml
secrets: inherit
with:
entry: ${{ matrix.test-matrix[1] }}
os: windows-latest
node: 20

generated-macos:
needs: monorepo
strategy:
fail-fast: false
matrix:
test-matrix: ${{ fromJson(needs.monorepo.outputs.test-matrix-small) }}
name: "Trigger e2e tests: Group MacOS"

uses: ./.github/workflows/reusable.yml
uses: ./.github/workflows/tests-generated.reusable.yml
secrets: inherit
with:
entry: ${{ matrix.test-matrix[1] }}
os: macos-latest
node: 20
os: ${{ inputs.os }}
node: ${{ inputs.node }}
24 changes: 24 additions & 0 deletions .github/workflows/tests-entry.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Step 1
name: Tests

on:
pull_request:
paths-ignore:
- 'website/**'
push:
# Ensures cache is computed on main branch so that it can be reused on all PRs
branches: [ "main" ]
paths-ignore:
- 'website/**'

concurrency:
group: ${{ github.ref }}
cancel-in-progress: true

jobs:
monorepo:
strategy:
matrix:
os: [ ubuntu-latest, macos-latest, windows-latest ]
node: [ 20 ]
fail-fast: false
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Step 3
on:
workflow_call:
inputs:
Expand Down Expand Up @@ -67,6 +68,7 @@ jobs:
- name: Generate dynamic composite action
run: node ./scripts/gen-composite-workflow-action.js '${{ inputs.entry }}'

# Step 4
- name: Run all tests
id: gen
uses: ./.github/actions/bati-gen
Expand Down

0 comments on commit e93a80f

Please sign in to comment.