diff --git a/.github/workflows/check-examples.yml b/.github/workflows/check-examples.yml index a9a9edcb5..c0f0ab2c0 100644 --- a/.github/workflows/check-examples.yml +++ b/.github/workflows/check-examples.yml @@ -1,4 +1,4 @@ -name: Check examples +name: Check Examples on: push: @@ -6,41 +6,39 @@ on: pull_request: branches: [main] -env: - CARGO_TERM_COLOR: always - CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse - jobs: - test: - name: Check examples ${{ matrix.os }} (using rustc ${{ matrix.rust }}) - runs-on: ${{ matrix.os }} + call-with-matrix: + name: Check strategy: + fail-fast: false matrix: - rust: - - nightly - os: - - ubuntu-latest - - steps: - - uses: actions/checkout@v3 - - - name: Setup Rust - uses: actions-rs/toolchain@v1 - with: - toolchain: ${{ matrix.rust }} - override: true - components: rustfmt - - - name: Add wasm32-unknown-unknown - run: rustup target add wasm32-unknown-unknown - - - name: Setup cargo-make - uses: davidB/rust-cargo-make@v1 - - - name: Cargo generate-lockfile - run: cargo generate-lockfile - - - uses: Swatinem/rust-cache@v2 - - - name: Run cargo check on all examples - run: cargo make check-examples + directory: [examples/counter, +examples/counter_isomorphic, +examples/counters, +examples/counters_stable, +examples/counter_without_macros, +examples/error_boundary, +examples/errors_axum, +examples/fetch, +examples/hackernews, +examples/hackernews_axum, +examples/js-framework-benchmark, +examples/leptos-tailwind-axum, +examples/login_with_token_csr_only, +examples/parent_child, +examples/router, +examples/session_auth_axum, +examples/slots, +examples/ssr_modes, +examples/ssr_modes_axum, +examples/tailwind, +examples/tailwind_csr_trunk, +examples/timer, +examples/todo_app_sqlite, +examples/todo_app_sqlite_axum, +examples/todo_app_sqlite_viz, +examples/todomvc] + uses: ./.github/workflows/run-example-task.yml + with: + directory: ${{ matrix.directory }} + cargo_make_task: "check" diff --git a/.github/workflows/verify-example.yml b/.github/workflows/run-example-task.yml similarity index 82% rename from .github/workflows/verify-example.yml rename to .github/workflows/run-example-task.yml index 3dd08de17..ca3ddfb88 100644 --- a/.github/workflows/verify-example.yml +++ b/.github/workflows/run-example-task.yml @@ -1,19 +1,21 @@ -name: Verify Example +name: Run Example Task on: workflow_call: inputs: - project_dir: + directory: + required: true + type: string + cargo_make_task: required: true type: string - env: CARGO_TERM_COLOR: always CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse jobs: test: - name: Verify ${{ matrix.os }} (using rustc ${{ matrix.rust }}) + name: Run ${{ matrix.os }} (using rustc ${{ matrix.rust }}) runs-on: ${{ matrix.os }} strategy: matrix: @@ -78,11 +80,11 @@ jobs: ${{ runner.os }}-pnpm-store- # Verify project - - name: Verify + - name: ${{ inputs.cargo_make_task }} run: | - if [ "${{ inputs.project_dir }}" = "INTERNAL" ]; then + if [ "${{ inputs.directory }}" = "INTERNAL" ]; then echo No verification required else - cd ${{ inputs.project_dir }} - cargo make --profile=github-actions verify-flow + cd ${{ inputs.directory }} + cargo make --profile=github-actions ${{ inputs.cargo_make_task }} fi diff --git a/.github/workflows/verify-all-examples.yml b/.github/workflows/verify-all-examples.yml index bb0aea7e1..edaf9e1f0 100644 --- a/.github/workflows/verify-all-examples.yml +++ b/.github/workflows/verify-all-examples.yml @@ -5,6 +5,9 @@ on: push: tags: - v* + schedule: + # Run once a day at 3:00 AM EST + - cron: "0 8 * * *" jobs: call-with-matrix: @@ -12,7 +15,7 @@ jobs: strategy: fail-fast: false matrix: - project_dir: [examples/counter, + directory: [examples/counter, examples/counter_isomorphic, examples/counters, examples/counters_stable, @@ -38,6 +41,7 @@ examples/todo_app_sqlite, examples/todo_app_sqlite_axum, examples/todo_app_sqlite_viz, examples/todomvc] - uses: ./.github/workflows/verify-example.yml + uses: ./.github/workflows/run-example-task.yml with: - project_dir: ${{ matrix.project_dir }} + directory: ${{ matrix.directory }} + cargo_make_task: "verify-flow" diff --git a/.github/workflows/verify-changed-examples.yml b/.github/workflows/verify-changed-examples.yml index fc937de14..299cd1978 100644 --- a/.github/workflows/verify-changed-examples.yml +++ b/.github/workflows/verify-changed-examples.yml @@ -9,7 +9,7 @@ on: - main jobs: - changed-dirs: + setup: name: Get Changes runs-on: ubuntu-latest outputs: @@ -51,7 +51,7 @@ jobs: - name: Set Matrix id: set-matrix run: | - if [ ${{ steps.changed-dirs.outputs.any_changed }} == 'true' ]; then + if [ ${{ steps.changed-files.outputs.any_changed }} == 'true' ]; then # Create matrix with changed directories echo "matrix={\"directory\":${{ steps.changed-dirs.outputs.all_changed_files }}}" >> "$GITHUB_OUTPUT" else @@ -61,10 +61,11 @@ jobs: matrix-job: name: Verify - needs: [changed-dirs] + needs: [setup] strategy: - matrix: ${{ fromJSON(needs.changed-dirs.outputs.matrix) }} - fail-fast: false - uses: ./.github/workflows/verify-example.yml + matrix: ${{ fromJSON(needs.setup.outputs.matrix) }} + fail-fast: true + uses: ./.github/workflows/run-example-task.yml with: - project_dir: ${{ matrix.directory }} + directory: ${{ matrix.directory }} + cargo_make_task: "verify-flow"