Skip to content

Commit 3683a26

Browse files
authored
feat: add examples & modern integration tests to rstest eco ci (#16)
1 parent 57b4f9b commit 3683a26

6 files changed

Lines changed: 37 additions & 8 deletions

File tree

.github/workflows/ci.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,10 @@ jobs:
8686
os: ubuntu-latest
8787
- suite: rspress
8888
os: ubuntu-latest
89+
- suite: examples
90+
os: ubuntu-latest
91+
- suite: modernjs
92+
os: ubuntu-latest
8993
fail-fast: false
9094
runs-on: ${{ matrix.os }}
9195
name: rstest (${{ matrix.suite }})

.github/workflows/rstest-ecosystem-ci-from-commit.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ on:
3030
- rsbuild
3131
- rsdoctor
3232
- modernjs
33-
# - examples
33+
- examples
3434
suiteRefType:
3535
description: "type of suite ref to use"
3636
required: true
@@ -89,8 +89,8 @@ jobs:
8989
os: ubuntu-latest
9090
- suite: rsdoctor
9191
os: ubuntu-latest
92-
# - suite: examples
93-
# os: ubuntu-latest
92+
- suite: examples
93+
os: ubuntu-latest
9494
fail-fast: false
9595
runs-on: ${{ matrix.os }}
9696
name: execute-all (${{ matrix.suite }})

.github/workflows/rstest-ecosystem-ci-from-pr.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ on:
3434
- rsbuild
3535
- rsdoctor
3636
- modernjs
37+
- examples
3738
suiteRefType:
3839
description: "type of suite ref to use"
3940
required: true
@@ -85,6 +86,8 @@ jobs:
8586
os: ubuntu-latest
8687
- suite: modernjs
8788
os: ubuntu-latest
89+
- suite: examples
90+
os: ubuntu-latest
8891
fail-fast: false
8992
runs-on: ${{ matrix.os }}
9093
name: execute-all (${{ matrix.suite }})

.github/workflows/rstest-ecosystem-ci-selected.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ on:
4141
- rsbuild
4242
- rsdoctor
4343
- modernjs
44-
# - examples
44+
- examples
4545
suiteRefType:
4646
description: "type of suite ref to use"
4747
required: true
@@ -95,8 +95,8 @@ jobs:
9595
os: ubuntu-latest
9696
- suite: modernjs
9797
os: ubuntu-latest
98-
# - suite: examples
99-
# os: ubuntu-latest
98+
- suite: examples
99+
os: ubuntu-latest
100100
fail-fast: false
101101
runs-on: ${{ matrix.os }}
102102
name: execute-all (${{ matrix.suite }})

tests/rstest/examples.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import type { RunOptions } from '../../types';
2+
import { $, runInRepo } from '../../utils';
3+
4+
export async function test(options: RunOptions) {
5+
await runInRepo({
6+
...options,
7+
repo: 'rstackjs/rstack-examples',
8+
branch: 'main',
9+
test: ['test:rstest'],
10+
beforeTest: async () => {
11+
await $`npx playwright install chromium webkit --with-deps`;
12+
},
13+
});
14+
}

tests/rstest/modernjs.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { join } from 'node:path';
22
import cache from '@actions/cache';
33
import type { RunOptions } from '../../types';
4-
import { $, runInRepo } from '../../utils';
4+
import { $, cd, runInRepo } from '../../utils';
55

66
const isGitHubActions = !!process.env.GITHUB_ACTIONS;
77

@@ -42,6 +42,14 @@ export async function test(options: RunOptions) {
4242
await cache.saveCache([nxCachePath], nxCacheKey);
4343
}
4444
},
45-
test: ['test:ut'],
45+
test: [
46+
'test:ut',
47+
async () => {
48+
cd('./tests');
49+
await $`npx playwright install chromium webkit --with-deps`;
50+
await $`pnpm run test:rstest`;
51+
cd('..');
52+
},
53+
],
4654
});
4755
}

0 commit comments

Comments
 (0)