ci: use devenv for testing

This commit is contained in:
Kim, Jimin 2025-01-05 09:01:40 +09:00
parent e6e036e058
commit 187d470ba6
Signed by: pomp
GPG key ID: 2B516173EDD492EB
2 changed files with 19 additions and 38 deletions

View file

@ -1,54 +1,30 @@
# https://devenv.sh/integrations/github-actions
name: Test name: Test
on: on:
push: push:
branches: branches:
- master - master
workflow_dispatch:
jobs: jobs:
test: test:
name: Test name: Test
runs-on: ubuntu-latest runs-on: ubuntu-latest
permissions:
# permissions required for nix caching to work properly
id-token: write
contents: read
steps: steps:
- name: Checkout Repo - uses: actions/checkout@v4
uses: actions/checkout@master - uses: DeterminateSystems/nix-installer-action@main
- uses: DeterminateSystems/magic-nix-cache-action@main
- uses: pnpm/action-setup@v2 - name: Install devenv.sh
with: run: nix profile install nixpkgs#devenv
version: 9
- name: Setup Node - name: Cache turbo build
uses: actions/setup-node@v3 uses: dtinth/setup-github-actions-caching-for-turbo@v1
with:
node-version: 20
cache: pnpm
- name: Store Playwright's Version - run: devenv test
run: |
PLAYWRIGHT_VERSION=$(npm ls @playwright/test | grep @playwright | sed 's/.*@//')
echo "Playwright's Version: $PLAYWRIGHT_VERSION"
echo "PLAYWRIGHT_VERSION=$PLAYWRIGHT_VERSION" >> $GITHUB_ENV
- name: Cache Playwright Browsers for Playwright's Version
id: cache-playwright-browsers
uses: actions/cache@v3
with:
path: ~/.cache/ms-playwright
key: playwright-browsers-${{ env.PLAYWRIGHT_VERSION }}
- name: Install dependencies
run: pnpm install
- name: Install playwright browsers
if: steps.cache-playwright-browsers.outputs.cache-hit != 'true'
run: npx playwright install --with-deps
- name: Build
run: pnpm build
- name: Run unit tests
run: pnpm test:unit
- name: Run E2E tests
run: pnpm test:e2e
- uses: actions/upload-artifact@v3 - uses: actions/upload-artifact@v3
with: with:

View file

@ -16,6 +16,11 @@
PLAYWRIGHT_SKIP_VALIDATE_HOST_REQUIREMENTS = true; PLAYWRIGHT_SKIP_VALIDATE_HOST_REQUIREMENTS = true;
}; };
enterTest = ''
pnpm test:unit
pnpm test:e2e
'';
languages = { languages = {
# https://devenv.sh/supported-languages/javascript # https://devenv.sh/supported-languages/javascript
javascript = { javascript = {