Files
puter/.github/workflows/test.yml
T
Xiaochen Cui c93a53ead2 ci: init e2e test for browser env, tidy other tests (#1796)
* ci: init e2e test for browser env

stash changes

* test: update fsentry definition, add tests

stash changes

* test: pass puter-js mkdir test

* test: add test for puter-js move

* tidy code

* tidy code

* doc: add docs for playwright test

* recover memoryfs

* test: puter-js readdir/stat

* test: puter-js write

* test: puter-js read

* test: puter-js move_cart

* test: fix failed tests on move

* tests: rename files

* test: puter-js copy_cart

* tests: puter-js batch/delete, read config from file

* ci: add vitest

* ci: update names and timeout

* ci: simplify playwright-test

* ci: simplify api-test

* move "api-tester" from tools to tests

* test: update example config

* test: remove folder tests/api-tester/ci

* test: unify config location

* test: remove unused files

* ci: fix wrong config

* ci: fix wrong path

* test: add docs

* ci: update timeout, print artifact url
2025-10-28 16:35:37 -07:00

143 lines
3.4 KiB
YAML

name: test
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20.x, 22.x]
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Build
run: |
rm package-lock.json
npm install -g npm@latest
npm install
npm run test
api-test:
name: backend (node env, api-test)
runs-on: ubuntu-latest
timeout-minutes: 5
strategy:
matrix:
node-version: [22.x]
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: API Test
run: |
pip install -r ./tests/ci/requirements.txt
./tests/ci/api-test.py
playwright-test:
name: puterjs (browser env, playwright)
runs-on: ubuntu-latest
timeout-minutes: 10
strategy:
matrix:
node-version: [22.x]
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Install Dependencies
run: npm install
working-directory: ./tests/playwright
- name: Install Playwright Browsers
run: npx playwright install --with-deps
working-directory: ./tests/playwright
- name: Playwright Test
run: |
pip install -r ./tests/ci/requirements.txt
./tests/ci/playwright-test.py
- uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
with:
name: server-logs
path: |
/tmp/backend.log
/tmp/fs-tree-manager.log
retention-days: 3
- uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
with:
name: config-files
path: |
./volatile/config/config.json
./src/fs_tree_manager/config.yaml
./tests/client-config.yaml
retention-days: 3
- uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
id: playwright-report
with:
name: playwright-report
path: tests/playwright/playwright-report/
retention-days: 3
- name: Get Playwright artifact URL
run: |
ARTIFACT_URL=$(gh api repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/artifacts \
--jq '.artifacts[] | select(.name=="playwright-report") | .archive_download_url')
echo "url=$ARTIFACT_URL" >> $GITHUB_OUTPUT
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Output artifact URL
run: echo 'Artifact URL is ${{ steps.playwright-report.outputs.artifact-url }}'
vitest:
name: puterjs (node env, vitest)
runs-on: ubuntu-latest
timeout-minutes: 5
strategy:
matrix:
node-version: [22.x]
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Vitest Test
run: |
pip install -r ./tests/ci/requirements.txt
./tests/ci/vitest.py