mirror of
https://github.com/tuono-labs/tuono
synced 2026-07-25 12:52:47 -07:00
ci: add Windows and MacOS to test matrix for both rust and typescript (#158)
This commit is contained in:
committed by
GitHub
parent
1f172d583e
commit
9058f209dd
@@ -28,4 +28,4 @@ jobs:
|
||||
uses: ./.github/actions/install-node-dependencies
|
||||
|
||||
- name: Test project
|
||||
run: pnpm repo:root:format
|
||||
run: pnpm repo:root:format:check
|
||||
|
||||
+26
-18
@@ -14,6 +14,32 @@ env:
|
||||
CARGO_TERM_COLOR: always
|
||||
|
||||
jobs:
|
||||
build_and_test:
|
||||
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
|
||||
name: Build and test rust crates
|
||||
|
||||
strategy:
|
||||
fail-fast: true
|
||||
matrix:
|
||||
os:
|
||||
- 'ubuntu-latest'
|
||||
- 'macos-latest'
|
||||
- 'windows-latest'
|
||||
toolchain:
|
||||
- stable
|
||||
- beta
|
||||
- nightly
|
||||
|
||||
runs-on: ${{ matrix.os }}
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }}
|
||||
- run: cargo build --verbose
|
||||
- run: cargo test --verbose
|
||||
|
||||
lint_and_fmt:
|
||||
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
|
||||
name: Check format and lint rust crates
|
||||
@@ -25,21 +51,3 @@ jobs:
|
||||
|
||||
- run: cargo fmt --all -- --check
|
||||
- run: cargo clippy -- -D warnings
|
||||
|
||||
build_and_test:
|
||||
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
|
||||
name: Build and test rust crates
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
toolchain:
|
||||
- stable
|
||||
- beta
|
||||
- nightly
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }}
|
||||
- run: cargo build --verbose
|
||||
- run: cargo test --verbose
|
||||
|
||||
@@ -11,11 +11,20 @@ on:
|
||||
- 'packages/**'
|
||||
|
||||
jobs:
|
||||
build-and-test:
|
||||
build_and_test:
|
||||
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
|
||||
name: Check build and test
|
||||
timeout-minutes: 15
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
strategy:
|
||||
fail-fast: true
|
||||
matrix:
|
||||
os:
|
||||
- 'ubuntu-latest'
|
||||
- 'macos-latest'
|
||||
- 'windows-latest'
|
||||
|
||||
runs-on: ${{ matrix.os }}
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
@@ -30,7 +39,7 @@ jobs:
|
||||
- name: Test project
|
||||
run: pnpm test
|
||||
|
||||
fmt-lint-and-types:
|
||||
lint_and_fmt:
|
||||
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
|
||||
name: Check format and lint
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
"docs:format": "turbo format --filter=documentation",
|
||||
"docs:format:check": "turbo format:check --filter=documentation",
|
||||
"docs:types": "turbo types --filter=documentation",
|
||||
"repo:root:format:check": "prettier . !./apps/** !./assets/** !./benches/** !./crates !./examples !./packages/** --check",
|
||||
"repo:root:format": "prettier . !./apps/** !./assets/** !./benches/** !./crates !./examples !./packages/** --write",
|
||||
"check-all": "turbo build lint format:check types --filter=!./examples"
|
||||
},
|
||||
|
||||
@@ -2,40 +2,28 @@ import fs from 'fs/promises'
|
||||
import { describe, it, expect } from 'vitest'
|
||||
import { routeGenerator } from '../src/generator'
|
||||
|
||||
function makeFolderDir(folder: string) {
|
||||
return process.cwd() + `/tests/generator/${folder}`
|
||||
}
|
||||
|
||||
async function getRouteTreeFileText(folder: string) {
|
||||
const dir = makeFolderDir(folder)
|
||||
return await fs.readFile(dir + '/routeTree.gen.ts', 'utf-8')
|
||||
}
|
||||
|
||||
async function getExpectedRouteTreeFileText(folder: string) {
|
||||
const dir = makeFolderDir(folder)
|
||||
const location = dir + '/routeTree.expected.ts'
|
||||
return await fs.readFile(location, 'utf-8')
|
||||
}
|
||||
|
||||
describe('generator works', async () => {
|
||||
const folderNames = await fs.readdir(process.cwd() + '/tests/generator')
|
||||
|
||||
it.each(folderNames.map((folder) => [folder]))(
|
||||
it.each(folderNames)(
|
||||
'should wire-up the routes for a "%s" tree',
|
||||
async (folderName) => {
|
||||
const currentFolder = `${process.cwd()}/tests/generator/${folderName}`
|
||||
const testDirPath = `${process.cwd()}/tests/generator/${folderName}`
|
||||
|
||||
await routeGenerator({
|
||||
folderName: `${currentFolder}/routes`,
|
||||
generatedRouteTree: `${currentFolder}/routeTree.gen.ts`,
|
||||
folderName: `${testDirPath}/routes`,
|
||||
generatedRouteTree: `${testDirPath}/routeTree.gen.ts`,
|
||||
})
|
||||
|
||||
const [expectedRouteTree, generatedRouteTree] = await Promise.all([
|
||||
getExpectedRouteTreeFileText(folderName),
|
||||
getRouteTreeFileText(folderName),
|
||||
])
|
||||
const generatedFilePath = `${testDirPath}/routeTree.gen.ts`
|
||||
const expectedFilePath = `${testDirPath}/routeTree.expected.ts`
|
||||
|
||||
expect(generatedRouteTree).equal(expectedRouteTree)
|
||||
const generatedFileContent = await fs.readFile(generatedFilePath, 'utf-8')
|
||||
|
||||
await expect(generatedFileContent).toMatchFileSnapshot(
|
||||
expectedFilePath,
|
||||
`${generatedFilePath} content should be equal to ${expectedFilePath}`,
|
||||
)
|
||||
},
|
||||
)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user