mirror of
https://github.com/tuono-labs/tuono
synced 2026-07-25 12:52:47 -07:00
ci: add checks on examples (#605)
This commit is contained in:
committed by
GitHub
parent
a322ce2fad
commit
9b6f8098b6
@@ -0,0 +1,123 @@
|
||||
name: Examples CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- 'main'
|
||||
pull_request:
|
||||
|
||||
concurrency:
|
||||
group: '${{ github.workflow }}-${{ github.head_ref || github.ref }}'
|
||||
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
|
||||
|
||||
jobs:
|
||||
example_list:
|
||||
name: Get examples names
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 1
|
||||
|
||||
outputs:
|
||||
names: ${{ steps.find_folder.outputs.names }}
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- id: find_folder
|
||||
working-directory: examples
|
||||
# produces the list of folder inside examples without leading `./` and trailing `/`:
|
||||
# ```text
|
||||
# tuono-tutorial
|
||||
# with-tailwind
|
||||
# tuono-app
|
||||
# with-mdx
|
||||
# ```
|
||||
#
|
||||
# after, using `jq` the output is converted into a JSON array:
|
||||
# ```json
|
||||
# ["tuono-tutorial","with-tailwind","tuono-app","with-mdx"]
|
||||
# ```
|
||||
#
|
||||
# and added to `$GITHUB_OUTPUT` env variable:
|
||||
run: |
|
||||
NAMES=$(find . -mindepth 1 -maxdepth 1 -type d -exec basename {} \;)
|
||||
echo "names=$(echo "$NAMES" | jq -R -s -c 'split("\n")[:-1]')" >> "$GITHUB_OUTPUT"
|
||||
|
||||
check_rust:
|
||||
needs:
|
||||
- example_list
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
example_name: ${{ fromJson(needs.example_list.outputs.names) }}
|
||||
os:
|
||||
- 'ubuntu-latest'
|
||||
- 'macos-latest'
|
||||
# to be added
|
||||
# - 'windows-latest'
|
||||
|
||||
# Only on this repo some examples build including plugins fails
|
||||
# However, if the project is downloaded via `tuono new`` it will work
|
||||
# @see https://github.com/tuono-labs/tuono/pull/605#pullrequestreview-2656262230
|
||||
# needs further investigations
|
||||
exclude:
|
||||
- example_name: with-tailwind
|
||||
|
||||
name: 'Check `${{ matrix.example_name }}` build on ${{ matrix.os }}'
|
||||
runs-on: ${{ matrix.os }}
|
||||
timeout-minutes: 15
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install NodeJS Dependencies
|
||||
uses: ./.github/actions/install-node-dependencies
|
||||
|
||||
- name: Setup rust toolchain
|
||||
uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||
|
||||
- name: Build Rust
|
||||
run: cargo build
|
||||
|
||||
- name: Build typescript
|
||||
run: pnpm run build
|
||||
|
||||
- name: Check "build"
|
||||
working-directory: ./examples/${{ matrix.example_name }}
|
||||
run: ../../target/debug/tuono build
|
||||
|
||||
check_typescript:
|
||||
name: Check typescript
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 15
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install NodeJS Dependencies
|
||||
uses: ./.github/actions/install-node-dependencies
|
||||
|
||||
- name: Build typescript
|
||||
run: pnpm run build
|
||||
|
||||
- name: Check formatting
|
||||
run: pnpm run examples:format
|
||||
|
||||
- name: Typecheck
|
||||
run: pnpm run examples:typecheck
|
||||
|
||||
ci_ok:
|
||||
name: Examples CI OK
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 1
|
||||
if: always()
|
||||
needs:
|
||||
- example_list
|
||||
- check_rust
|
||||
- check_typescript
|
||||
steps:
|
||||
- name: Exit with error if some jobs are not successful
|
||||
run: exit 1
|
||||
if: ${{ always() && (contains(needs.*.result, 'failure') || contains(needs.*.result, 'skipped') || contains(needs.*.result, 'cancelled')) }}
|
||||
@@ -2,6 +2,7 @@ pnpm-lock.yaml
|
||||
|
||||
dist
|
||||
.tuono
|
||||
out
|
||||
|
||||
vite.config.ts.timestamp-*
|
||||
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@ tuono new [NAME]
|
||||
You can install any example included in this folder by just using the `--template` flag:
|
||||
|
||||
```sh
|
||||
tuono new [NAME] --template [TEMPLATE]
|
||||
tuono new [NAME] --template [TEMPLATE]
|
||||
```
|
||||
|
||||
`[TEMPLATE]` is the folder name.
|
||||
|
||||
@@ -5,5 +5,3 @@ This is the starter tuono project. To download it run in your terminal:
|
||||
```sh
|
||||
tuono new my-first-tuono-app
|
||||
```
|
||||
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import type { TuonoConfig } from 'tuono/config'
|
||||
|
||||
const config: TuonoConfig = {
|
||||
vite: {
|
||||
alias: {
|
||||
'@': 'src',
|
||||
},
|
||||
},
|
||||
vite: {
|
||||
alias: {
|
||||
'@': 'src',
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
export default config
|
||||
|
||||
+8
-3
@@ -13,9 +13,14 @@
|
||||
"test": "turbo test --filter=./devtools/* --filter=./packages/*",
|
||||
"test:watch": "turbo test:watch --filter=./devtools/* --filter=./packages/*",
|
||||
"test:e2e": "pnpm --filter='fixture-*' run test:e2e",
|
||||
"repo:root:format": "prettier . !./assets/** !./crates !./examples !./devtools/** !./packages/** --check",
|
||||
"repo:root:format:fix": "prettier . !./assets/** !./crates !./examples !./devtools/** !./packages/** --write",
|
||||
"check-all": "turbo build lint format typecheck --filter=!./examples"
|
||||
"examples:format": "prettier ./examples/** --check",
|
||||
"examples:format:fix": "prettier ./examples/** --write",
|
||||
"examples:typecheck": "pnpm --filter \"./examples/*\" exec tsc --noEmit",
|
||||
"repo:root:format": "prettier . !./assets !./crates !./examples !./devtools !./packages --check",
|
||||
"repo:root:format:fix": "prettier . !./assets !./crates !./examples !./devtools !./packages --write",
|
||||
"check-packages": "turbo build lint format typecheck --filter=!./examples",
|
||||
"check-examples": "pnpm run \"/^examples:(format|typecheck)$/\"",
|
||||
"check-all": "pnpm run check-packages && pnpm run check-examples && pnpm run repo:root:format"
|
||||
},
|
||||
"author": "Valerio Ageno",
|
||||
"license": "MIT",
|
||||
|
||||
Reference in New Issue
Block a user