-
Notifications
You must be signed in to change notification settings - Fork 129
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: try to parallelize CI steps using caches
- Loading branch information
Showing
2 changed files
with
147 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,143 @@ | ||
name: Build and Test PR with caches | ||
on: [pull_request, workflow_dispatch, push] | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- uses: pnpm/action-setup@v2 | ||
with: | ||
version: 8 | ||
- run: pnpm add -g pnpm | ||
- name: Use Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 20 | ||
cache: 'pnpm' | ||
|
||
- run: pnpm install | ||
- run: pnpm build | ||
- name: 'Save build output' | ||
id: cache-build | ||
uses: actions/cache/save@v3 | ||
with: | ||
path: ${{ github.workspace }} | ||
key: ${{ runner.os }}-build-${{ github.sha }}-${{ github.run_id }} | ||
restore-keys: | ||
${{ runner.os }}-build-${{ github.sha }} | ||
|
||
test-integration: | ||
needs: build | ||
runs-on: ubuntu-latest | ||
services: | ||
postgres: | ||
image: postgres:15.1 | ||
env: | ||
POSTGRES_USER: postgres | ||
POSTGRES_PASSWORD: test123 | ||
ports: | ||
- 5432:5432 | ||
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- uses: pnpm/action-setup@v2 | ||
with: | ||
version: 8 | ||
- run: pnpm add -g pnpm | ||
- name: Use Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 20 | ||
cache: 'pnpm' | ||
|
||
- name: 'Restore build output' | ||
id: cache-build | ||
uses: actions/cache/restore@v3 | ||
with: | ||
path: ${{ github.workspace }} | ||
key: ${{ runner.os }}-build-${{ github.sha }}-${{ github.run_id }} | ||
restore-keys: ${{ runner.os }}-build-${{ github.sha }} | ||
fail-on-cache-miss: true | ||
|
||
- name: run integration tests | ||
env: | ||
INCLUDE_POSTGRES_TESTS: true | ||
POSTGRES_HOST: localhost | ||
POSTGRES_USER: postgres | ||
POSTGRES_PASSWORD: test123 | ||
POSTGRES_PORT: 5432 | ||
run: pnpm test:integration | ||
- uses: codecov/codecov-action@v3 | ||
with: | ||
token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos but sometimes fails without :| | ||
|
||
test-browser: | ||
needs: build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- uses: pnpm/action-setup@v2 | ||
with: | ||
version: 8 | ||
- run: pnpm add -g pnpm | ||
- name: Use Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 20 | ||
cache: 'pnpm' | ||
|
||
- name: 'Restore build output' | ||
id: cache-build | ||
uses: actions/cache/restore@v3 | ||
with: | ||
path: ${{ github.workspace }} | ||
key: ${{ runner.os }}-build-${{ github.sha }}-${{ github.run_id }} | ||
restore-keys: ${{ runner.os }}-build-${{ github.sha }} | ||
fail-on-cache-miss: true | ||
|
||
- run: pnpm install | ||
|
||
- name: run browser tests | ||
run: pnpm test:browser | ||
|
||
- run: pnpm run docs | ||
- run: pnpm lint | ||
- uses: codecov/codecov-action@v3 | ||
with: | ||
token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos but sometimes fails without :| | ||
|
||
lint-and-docs: | ||
needs: build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- uses: pnpm/action-setup@v2 | ||
with: | ||
version: 8 | ||
- run: pnpm add -g pnpm | ||
- name: Use Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 20 | ||
cache: 'pnpm' | ||
|
||
- name: 'Restore build output' | ||
id: cache-build | ||
uses: actions/cache/restore@v3 | ||
with: | ||
path: ${{ github.workspace }} | ||
key: ${{ runner.os }}-build-${{ github.sha }}-${{ github.run_id }} | ||
restore-keys: ${{ runner.os }}-build-${{ github.sha }} | ||
fail-on-cache-miss: true | ||
|
||
- run: pnpm run docs | ||
- run: pnpm lint |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters