Skip to content

Commit

Permalink
ci: speed up (#1591)
Browse files Browse the repository at this point in the history
* ci: speed up

* chore: f

* chore: f

* chore: f

* chore: f

* chore: f

* chore: f
  • Loading branch information
Saul-Mirone authored Dec 16, 2024
1 parent 1150f4d commit eb316c9
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 19 deletions.
2 changes: 2 additions & 0 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ runs:
run: pnpm install
shell: bash

- uses: nrwl/nx-set-shas@v4

- name: Build packages
run: pnpm build
shell: bash
74 changes: 58 additions & 16 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,45 +6,87 @@ on:
pull_request:
branches: [main]

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

env:
CI: true
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}

jobs:
build-and-test:
install-deps:
runs-on: ubuntu-latest
steps:
- name: checkout code repository
- name: Checkout code repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: nrwl/nx-set-shas@v4
- uses: ./.github/actions/setup

lint:
runs-on: ubuntu-latest
needs: install-deps
steps:
- name: Checkout code repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: ./.github/actions/setup

- name: install dependencies
run: pnpm install
- name: Run lint
run: pnpm test:lint --format github

- name: run unit tests
unit:
runs-on: ubuntu-latest
needs: install-deps
steps:
- name: Checkout code repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: ./.github/actions/setup

- name: Run unit tests
run: pnpm test:unit

# build all the packages to prepare for release
- name: build packs
run: pnpm build
e2e:
runs-on: ubuntu-latest
needs: install-deps
strategy:
fail-fast: false
matrix:
shard: [1, 2, 3, 4, 5]
steps:
- name: Checkout code repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: run lint
run: pnpm test:lint --format github
- uses: ./.github/actions/setup

- name: install browsers
- name: Install browsers
run: pnpm --filter=@milkdown/e2e test:install

- name: run playwright
run: pnpm test:e2e
- name: Run playwright
run: pnpm test:e2e -- --forbid-only --shard=${{ matrix.shard }}/${{ strategy.job-total }}

- name: upload test results
- name: Upload test results
if: ${{ failure() }}
uses: actions/upload-artifact@v4
with:
name: test-results-main
name: test-results-e2e-${{ matrix.shard }}
path: e2e/playwright-report/
retention-days: 7

summary:
if: ${{ always() }}
needs: [lint, unit, e2e]
runs-on: ubuntu-latest
steps:
- name: On error
if: ${{ needs.e2e.result != 'success' || needs.unit.result != 'success' || needs.lint.result != 'success' }}
run: exit 1
4 changes: 4 additions & 0 deletions .github/workflows/fix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ on:
permissions:
contents: read

env:
CI: true
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}

jobs:
fix:
runs-on: ubuntu-latest
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ on:

concurrency: ${{ github.workflow }}-${{ github.ref }}

env:
CI: true
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}

jobs:
prepare:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -35,9 +39,6 @@ jobs:

- uses: ./.github/actions/setup

- name: build packs
run: pnpm build

- name: Publish to NPM
run: pnpm ci:publish
env:
Expand Down

0 comments on commit eb316c9

Please sign in to comment.