mirror of
https://github.com/BorysLevytskyi/BitwiseCmd.git
synced 2025-12-31 17:12:38 +01:00
* Simplify BitwiseCmdTests action responsibilities * Fix build script to avoid hanging server * Run unit tests in PR workflow
53 lines
1.3 KiB
YAML
53 lines
1.3 KiB
YAML
name: PR CI
|
|
|
|
on:
|
|
pull_request:
|
|
types: [opened, synchronize, reopened]
|
|
|
|
jobs:
|
|
e2e-tests:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 5
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 18
|
|
|
|
- name: Install dependencies
|
|
run: npm install --no-audit --no-fund
|
|
|
|
- name: Build application
|
|
env:
|
|
CI: true
|
|
run: npm run build
|
|
|
|
- name: Run unit tests
|
|
env:
|
|
CI: true
|
|
run: npm test -- --watch=false
|
|
|
|
- name: Start static web server
|
|
run: |
|
|
npx --yes http-server ./build -p 3030 --silent </dev/null > server.log 2>&1 &
|
|
echo $! > server.pid
|
|
npx --yes wait-on --timeout=120000 http-get://127.0.0.1:3030
|
|
|
|
- name: Run BitwiseCmdTests
|
|
uses: ./.github/actions/bitwisecmdtests
|
|
with:
|
|
test-command: test-build
|
|
base-url: http://127.0.0.1:3030
|
|
bitwisecmd-tests-token: ${{ secrets.BITWISECMD_TESTS_TOKEN }}
|
|
|
|
- name: Stop static web server
|
|
if: always()
|
|
run: |
|
|
if [ -f server.pid ]; then
|
|
kill $(cat server.pid) || true
|
|
fi
|
|
rm -f server.pid
|