mirror of
https://github.com/MercuryWorkshop/scramjet.git
synced 2025-05-13 06:20:02 -04:00
playwright github ci action
This commit is contained in:
parent
db7cbd8982
commit
8f46b276c0
3 changed files with 57 additions and 21 deletions
39
.github/workflows/main.yml
vendored
39
.github/workflows/main.yml
vendored
|
@ -13,6 +13,7 @@ permissions:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
|
name: Build Scramjet
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
@ -59,11 +60,45 @@ jobs:
|
||||||
path: |
|
path: |
|
||||||
dist/*.js
|
dist/*.js
|
||||||
dist/*.js.map
|
dist/*.js.map
|
||||||
|
tests:
|
||||||
|
name: Run Scramjet Tests
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: build
|
||||||
|
if: github.ref == 'refs/heads/main'
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Setup pnpm
|
||||||
|
uses: pnpm/action-setup@v4
|
||||||
|
with:
|
||||||
|
version: latest
|
||||||
|
|
||||||
|
- name: Setup Node.js
|
||||||
|
uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: "22"
|
||||||
|
cache: "pnpm"
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: pnpm install
|
||||||
|
|
||||||
|
- name: Get artifacts
|
||||||
|
uses: actions/download-artifact@v4
|
||||||
|
with:
|
||||||
|
name: scramjet
|
||||||
|
path: dist
|
||||||
|
|
||||||
|
- name: Install Playwright Browsers
|
||||||
|
run: npx playwright install --with-deps
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: pnpm test
|
||||||
|
|
||||||
upload:
|
upload:
|
||||||
name: Upload Release
|
name: Upload Release
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: build
|
needs: [build, tests]
|
||||||
permissions: write-all
|
permissions: write-all
|
||||||
if: github.ref == 'refs/heads/main'
|
if: github.ref == 'refs/heads/main'
|
||||||
|
|
||||||
|
@ -94,7 +129,7 @@ jobs:
|
||||||
pages:
|
pages:
|
||||||
name: Upload to Github Pages
|
name: Upload to Github Pages
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: build
|
needs: [build, tests]
|
||||||
if: github.ref == 'refs/heads/main'
|
if: github.ref == 'refs/heads/main'
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
|
|
|
@ -8,7 +8,7 @@ export default defineConfig({
|
||||||
fullyParallel: true,
|
fullyParallel: true,
|
||||||
forbidOnly: !!process.env.CI,
|
forbidOnly: !!process.env.CI,
|
||||||
retries: 2,
|
retries: 2,
|
||||||
reporter: "html",
|
reporter: process.env.CI ? "github" : "html",
|
||||||
timeout: 20000,
|
timeout: 20000,
|
||||||
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
|
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
|
||||||
use: {
|
use: {
|
||||||
|
|
37
server.js
37
server.js
|
@ -85,24 +85,25 @@ fastify.listen({
|
||||||
host: "0.0.0.0",
|
host: "0.0.0.0",
|
||||||
});
|
});
|
||||||
console.log(`Listening on port ${PORT}`);
|
console.log(`Listening on port ${PORT}`);
|
||||||
|
if (!process.env.CI) {
|
||||||
|
try {
|
||||||
|
writeFileSync(
|
||||||
|
".git/hooks/pre-commit",
|
||||||
|
"pnpm prettier . -w\ngit update-index --again"
|
||||||
|
);
|
||||||
|
chmodSync(".git/hooks/pre-commit", 0o755);
|
||||||
|
} catch {}
|
||||||
|
|
||||||
try {
|
const watch = spawn("pnpm", ["rspack", "-w"], {
|
||||||
writeFileSync(
|
detached: true,
|
||||||
".git/hooks/pre-commit",
|
cwd: process.cwd(),
|
||||||
"pnpm prettier . -w\ngit update-index --again"
|
});
|
||||||
);
|
|
||||||
chmodSync(".git/hooks/pre-commit", 0o755);
|
|
||||||
} catch {}
|
|
||||||
|
|
||||||
const watch = spawn("pnpm", ["rspack", "-w"], {
|
watch.stdout.on("data", (data) => {
|
||||||
detached: true,
|
console.log(`${data}`);
|
||||||
cwd: process.cwd(),
|
});
|
||||||
});
|
|
||||||
|
|
||||||
watch.stdout.on("data", (data) => {
|
watch.stderr.on("data", (data) => {
|
||||||
console.log(`${data}`);
|
console.log(`${data}`);
|
||||||
});
|
});
|
||||||
|
}
|
||||||
watch.stderr.on("data", (data) => {
|
|
||||||
console.log(`${data}`);
|
|
||||||
});
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue