Skip to content

Commit e4b26b6

Browse files
committed
ci: run integration tests always on main, on all os
1 parent ce0b972 commit e4b26b6

File tree

3 files changed

+27
-12
lines changed

3 files changed

+27
-12
lines changed

.github/workflows/integration-test-cli.yaml

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,29 @@ jobs:
88
cli-integration-test:
99
name: CLI Integration Tests
1010
# Note: `prepare-release.yaml` sets this commit message
11-
if: ${{ contains(github.event.pull_request.title, 'release CLI') || github.event_name == 'workflow_dispatch' }}
12-
runs-on: ubuntu-latest
11+
if: ${{ contains(github.event.pull_request.title, 'release CLI') || github.event_name == 'workflow_dispatch' || github.ref_name == 'main' }}
12+
13+
runs-on: ${{ matrix.os }}
14+
strategy:
15+
fail-fast: false
16+
matrix:
17+
os: [ubuntu-latest]
18+
node-version: [18, 20, 22]
19+
include:
20+
- os: macos-latest
21+
node_version: 20
22+
- os: windows-latest
23+
node_version: 20.13.1
24+
1325
steps:
1426
- name: Checkout
1527
uses: actions/checkout@v4
1628
with:
1729
fetch-depth: 0
1830

1931
- uses: ./.github/actions/setup-and-build
32+
with:
33+
node-version: ${{ matrix.node-version }}
2034

2135
- name: Update template's versions
2236
working-directory: ./packages/cli

integration/cli/create-tutorial.test.ts

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,16 @@ import { execa } from 'execa';
44
import { temporaryDirectory } from 'tempy';
55
import { describe, beforeEach, afterAll, expect, it } from 'vitest';
66

7+
const isWindows = process.platform === 'win32';
78
const baseDir = path.resolve(__dirname, '../..');
8-
99
const cli = path.join(baseDir, 'packages/cli/dist/index.js');
10+
const tmp = temporaryDirectory();
1011

1112
interface TestContext {
1213
projectName: string;
1314
dest: string;
1415
}
1516

16-
const tmp = temporaryDirectory();
17-
1817
beforeEach<TestContext>(async (context) => {
1918
context.projectName = Math.random().toString(36).substring(7);
2019
context.dest = path.join(tmp, context.projectName);
@@ -35,7 +34,7 @@ describe.each(['npm', 'pnpm', 'yarn'])('%s', (packageManager) => {
3534
expect(filesToJSON(projectFiles)).toMatchFileSnapshot(`${snapshotPrefix}-created.json`);
3635
});
3736

38-
it<TestContext>('should create and build a project', async ({ projectName, dest }) => {
37+
it.skipIf(isWindows)<TestContext>('should create and build a project', async ({ projectName, dest }) => {
3938
await createProject(projectName, packageManager, { cwd: tmp, install: true });
4039

4140
await execa(packageManager, ['run', 'build'], {
@@ -50,19 +49,22 @@ describe.each(['npm', 'pnpm', 'yarn'])('%s', (packageManager) => {
5049
expect(filesToJSON(distFiles)).toMatchFileSnapshot(`${snapshotPrefix}-built.json`);
5150
});
5251

53-
it<TestContext>('created project contains overwritten UnoCSS config', async ({ projectName, dest }) => {
54-
await createProject(projectName, packageManager, { cwd: tmp });
52+
it.skipIf(isWindows)<TestContext>(
53+
'created project contains overwritten UnoCSS config',
54+
async ({ projectName, dest }) => {
55+
await createProject(projectName, packageManager, { cwd: tmp });
5556

56-
const unoConfig = await fs.readFile(`${dest}/uno.config.ts`, 'utf8');
57+
const unoConfig = await fs.readFile(`${dest}/uno.config.ts`, 'utf8');
5758

58-
expect(unoConfig).toBe(`\
59+
expect(unoConfig).toBe(`\
5960
import { defineConfig } from '@tutorialkit/theme';
6061
6162
export default defineConfig({
6263
// add your UnoCSS config here: https://unocss.dev/guide/config-file
6364
});
6465
`);
65-
});
66+
},
67+
);
6668
});
6769

6870
async function createProject(name: string, packageManager: string, options: { cwd: string; install?: boolean }) {

integration/theme-resolving/inline-content.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,5 @@ test('getInlineContentForPackage finds files from @tutorialkit/astro', async ()
2626
root: `${tmp}/theme-test`,
2727
});
2828

29-
console.log(content);
3029
expect(content.length).toBeGreaterThan(0);
3130
});

0 commit comments

Comments
 (0)