mirror of
https://github.com/tuono-labs/tuono
synced 2026-07-25 12:52:47 -07:00
108 lines
2.9 KiB
YAML
108 lines
2.9 KiB
YAML
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_example:
|
|
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
|
|
|
|
- name: Check formatting
|
|
run: pnpm run format
|
|
|
|
- name: Typecheck
|
|
run: pnpm run typecheck
|
|
|
|
ci_ok:
|
|
name: Examples CI OK
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 1
|
|
if: always()
|
|
needs:
|
|
- example_list
|
|
- check_example
|
|
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')) }}
|