diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index abaa4b428..a2bf9be14 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -10,8 +10,6 @@ on: repository_dispatch: types: [ok-to-test-command] push: - branches: - - main jobs: @@ -740,7 +738,7 @@ jobs: - name: Run tests working-directory: libs run: | - cargo test --all-features --workspace --exclude="pavex_cli" --exclude="pavex_macros" --exclude="pavex_session_redis" --exclude="pavex_session_sqlx" + cargo test --all-features --workspace --exclude="pavex_cli" --exclude="pavex_macros" --exclude="pavex" --exclude="pavex_session_redis" --exclude="pavex_session_sqlx" - uses: ./.github/actions/finalize-check if: ${{ always() && github.event_name != 'push' }} with: @@ -748,6 +746,89 @@ jobs: job: Run tests (linux) conclusion: ${{ job.status }} github_token: ${{ secrets.GITHUB_TOKEN }} + tests_pavex_linux: + name: "Run `pavex` tests (linux)" + runs-on: ubuntu-latest + needs: + - build_clis_linux + + permissions: + pull-requests: write + checks: write + # Run if it's a PR on the official repo or a push to `main` + if: | + (github.event_name == 'repository_dispatch' && + github.event.client_payload.slash_command.args.named.sha != '' && + contains( + github.event.client_payload.pull_request.head.sha, + github.event.client_payload.slash_command.args.named.sha + )) || + (github.event_name == 'push' && github.event.repository.full_name == github.repository) + steps: + - name: Checkout repository from source repo + if: | + (github.event_name == 'push' && github.event.repository.full_name == github.repository) + uses: actions/checkout@v5 + - name: Checkout repository from fork + if: | + github.event_name == 'repository_dispatch' && + github.event.client_payload.slash_command.args.named.sha != '' && + contains( + github.event.client_payload.pull_request.head.sha, + github.event.client_payload.slash_command.args.named.sha + ) + uses: actions/checkout@v5 + with: + ref: "refs/pull/${{ github.event.client_payload.pull_request.number }}/merge" + - uses: ./.github/actions/create-check + if: ${{ github.event_name != 'push' }} + with: + pr_number: ${{ github.event.client_payload.pull_request.number }} + job: Run `pavex` tests (linux) + workflow: "Build and store docs artifacts" + run_id: ${{ github.run_id }} + github_token: ${{ secrets.GITHUB_TOKEN }} + - name: Install Rust stable toolchain + uses: actions-rust-lang/setup-rust-toolchain@v1.8.0 + with: + components: rustfmt + rustflags: "" + cache-workspaces: "./libs -> ./target" + - uses: taiki-e/install-action@cargo-hack + - name: Download pavex CLI artifact + uses: actions/download-artifact@v4 + with: + name: pavex_cli_linux + path: ~/.cargo/bin + - name: Download pavexc CLI artifact + uses: actions/download-artifact@v4 + with: + name: pavexc_cli_linux + path: ~/.cargo/bin + - name: Mark pavex as executable + env: + PAVEX: /home/runner/.cargo/bin/pavex + PAVEXC: /home/runner/.cargo/bin/pavexc + run: | + chmod +x ${{ env.PAVEX }} + chmod +x ${{ env.PAVEXC }} + - name: Activate pavex + env: + PAVEX_ACTIVATION_KEY: ${{ secrets.pavex_activation_key }} + run: | + pavex self activate + pavexc self setup + - name: Run Pavex tests with multiple feature combinations + working-directory: libs + run: | + cargo hack -p pavex --feature-powerset --depth 2 test --tests + - uses: ./.github/actions/finalize-check + if: ${{ always() && github.event_name != 'push' }} + with: + pr_number: ${{ github.event.client_payload.pull_request.number }} + job: Run `pavex` tests (linux) + conclusion: ${{ job.status }} + github_token: ${{ secrets.GITHUB_TOKEN }} ui_tests_linux: name: "Run UI tests (linux)" runs-on: ubuntu-latest @@ -976,7 +1057,7 @@ jobs: - name: Run tests working-directory: libs run: | - cargo test --all-features --workspace --exclude="pavex_cli" --exclude="pavex_macros" --exclude="pavex_session_redis" --exclude="pavex_session_sqlx" + cargo test --all-features --workspace --exclude="pavex_cli" --exclude="pavex_macros" --exclude="pavex" --exclude="pavex_session_redis" --exclude="pavex_session_sqlx" - uses: ./.github/actions/finalize-check if: ${{ always() && github.event_name != 'push' }} with: @@ -984,6 +1065,89 @@ jobs: job: Run tests (macos) conclusion: ${{ job.status }} github_token: ${{ secrets.GITHUB_TOKEN }} + tests_pavex_macos: + name: "Run `pavex` tests (macos)" + runs-on: macos-14 + needs: + - build_clis_macos + + permissions: + pull-requests: write + checks: write + # Run if it's a PR on the official repo or a push to `main` + if: | + (github.event_name == 'repository_dispatch' && + github.event.client_payload.slash_command.args.named.sha != '' && + contains( + github.event.client_payload.pull_request.head.sha, + github.event.client_payload.slash_command.args.named.sha + )) || + (github.event_name == 'push' && github.event.repository.full_name == github.repository) + steps: + - name: Checkout repository from source repo + if: | + (github.event_name == 'push' && github.event.repository.full_name == github.repository) + uses: actions/checkout@v5 + - name: Checkout repository from fork + if: | + github.event_name == 'repository_dispatch' && + github.event.client_payload.slash_command.args.named.sha != '' && + contains( + github.event.client_payload.pull_request.head.sha, + github.event.client_payload.slash_command.args.named.sha + ) + uses: actions/checkout@v5 + with: + ref: "refs/pull/${{ github.event.client_payload.pull_request.number }}/merge" + - uses: ./.github/actions/create-check + if: ${{ github.event_name != 'push' }} + with: + pr_number: ${{ github.event.client_payload.pull_request.number }} + job: Run `pavex` tests (macos) + workflow: "Build and store docs artifacts" + run_id: ${{ github.run_id }} + github_token: ${{ secrets.GITHUB_TOKEN }} + - name: Install Rust stable toolchain + uses: actions-rust-lang/setup-rust-toolchain@v1.8.0 + with: + components: rustfmt + rustflags: "" + cache-workspaces: "./libs -> ./target" + - uses: taiki-e/install-action@cargo-hack + - name: Download pavex CLI artifact + uses: actions/download-artifact@v4 + with: + name: pavex_cli_macos + path: ~/.cargo/bin + - name: Download pavexc CLI artifact + uses: actions/download-artifact@v4 + with: + name: pavexc_cli_macos + path: ~/.cargo/bin + - name: Mark pavex as executable + env: + PAVEX: /Users/runner/.cargo/bin/pavex + PAVEXC: /Users/runner/.cargo/bin/pavexc + run: | + chmod +x ${{ env.PAVEX }} + chmod +x ${{ env.PAVEXC }} + - name: Activate pavex + env: + PAVEX_ACTIVATION_KEY: ${{ secrets.pavex_activation_key }} + run: | + pavex self activate + pavexc self setup + - name: Run Pavex tests with multiple feature combinations + working-directory: libs + run: | + cargo hack -p pavex --feature-powerset --depth 2 test --tests + - uses: ./.github/actions/finalize-check + if: ${{ always() && github.event_name != 'push' }} + with: + pr_number: ${{ github.event.client_payload.pull_request.number }} + job: Run `pavex` tests (macos) + conclusion: ${{ job.status }} + github_token: ${{ secrets.GITHUB_TOKEN }} ui_tests_macos: name: "Run UI tests (macos)" runs-on: macos-14 @@ -1206,7 +1370,7 @@ jobs: - name: Run tests working-directory: libs run: | - cargo test --all-features --workspace --exclude="pavex_cli" --exclude="pavex_macros" --exclude="pavex_session_redis" --exclude="pavex_session_sqlx" + cargo test --all-features --workspace --exclude="pavex_cli" --exclude="pavex_macros" --exclude="pavex" --exclude="pavex_session_redis" --exclude="pavex_session_sqlx" - uses: ./.github/actions/finalize-check if: ${{ always() && github.event_name != 'push' }} with: @@ -1214,6 +1378,83 @@ jobs: job: Run tests (windows) conclusion: ${{ job.status }} github_token: ${{ secrets.GITHUB_TOKEN }} + tests_pavex_windows: + name: "Run `pavex` tests (windows)" + runs-on: windows-2022 + needs: + - build_clis_windows + + permissions: + pull-requests: write + checks: write + # Run if it's a PR on the official repo or a push to `main` + if: | + (github.event_name == 'repository_dispatch' && + github.event.client_payload.slash_command.args.named.sha != '' && + contains( + github.event.client_payload.pull_request.head.sha, + github.event.client_payload.slash_command.args.named.sha + )) || + (github.event_name == 'push' && github.event.repository.full_name == github.repository) + steps: + - name: Checkout repository from source repo + if: | + (github.event_name == 'push' && github.event.repository.full_name == github.repository) + uses: actions/checkout@v5 + - name: Checkout repository from fork + if: | + github.event_name == 'repository_dispatch' && + github.event.client_payload.slash_command.args.named.sha != '' && + contains( + github.event.client_payload.pull_request.head.sha, + github.event.client_payload.slash_command.args.named.sha + ) + uses: actions/checkout@v5 + with: + ref: "refs/pull/${{ github.event.client_payload.pull_request.number }}/merge" + - uses: ./.github/actions/create-check + if: ${{ github.event_name != 'push' }} + with: + pr_number: ${{ github.event.client_payload.pull_request.number }} + job: Run `pavex` tests (windows) + workflow: "Build and store docs artifacts" + run_id: ${{ github.run_id }} + github_token: ${{ secrets.GITHUB_TOKEN }} + - name: Install Rust stable toolchain + uses: actions-rust-lang/setup-rust-toolchain@v1.8.0 + with: + components: rustfmt + rustflags: "" + cache-workspaces: "./libs -> ./target" + - uses: taiki-e/install-action@cargo-hack + - name: Download pavex CLI artifact + uses: actions/download-artifact@v4 + with: + name: pavex_cli_windows + path: ~/.cargo/bin + - name: Download pavexc CLI artifact + uses: actions/download-artifact@v4 + with: + name: pavexc_cli_windows + path: ~/.cargo/bin + + - name: Activate pavex + env: + PAVEX_ACTIVATION_KEY: ${{ secrets.pavex_activation_key }} + run: | + pavex self activate + pavexc self setup + - name: Run Pavex tests with multiple feature combinations + working-directory: libs + run: | + cargo hack -p pavex --feature-powerset --depth 2 test --tests + - uses: ./.github/actions/finalize-check + if: ${{ always() && github.event_name != 'push' }} + with: + pr_number: ${{ github.event.client_payload.pull_request.number }} + job: Run `pavex` tests (windows) + conclusion: ${{ job.status }} + github_token: ${{ secrets.GITHUB_TOKEN }} ui_tests_windows: name: "Run UI tests (windows)" runs-on: windows-2022 diff --git a/.github/workflows/workspace-hack.yml b/.github/workflows/workspace-hack.yml index ddaf82277..845afc1bb 100644 --- a/.github/workflows/workspace-hack.yml +++ b/.github/workflows/workspace-hack.yml @@ -57,5 +57,6 @@ jobs: - name: Fail if any verification failed if: steps.verify_libs.outcome == 'failure' || steps.verify_examples.outcome == 'failure' run: | - echo "One or more verification steps failed. Check the logs of the previous steps for details." + echo "Verify workspace-hack in libs: ${{ steps.verify_libs.outcome }}" + echo "Verify workspace-hack in examples: ${{ steps.verify_examples.outcome }}" exit 1 diff --git a/ci_utils/src/main.rs b/ci_utils/src/main.rs index 3ac1c9bce..f79388d21 100644 --- a/ci_utils/src/main.rs +++ b/ci_utils/src/main.rs @@ -45,6 +45,7 @@ fn main() { ("single_lib_tests_steps", "job_steps/single_lib_tests.jinja"), ("tests_steps", "job_steps/tests.jinja"), ("macro_tests_steps", "job_steps/macro_tests.jinja"), + ("pavex_tests_steps", "job_steps/pavex_tests.jinja"), ("ui_tests_steps", "job_steps/ui_tests.jinja"), ("setup_pavex", "setup_pavex.jinja"), ]; diff --git a/ci_utils/templates/ci.jinja b/ci_utils/templates/ci.jinja index 572b28a5f..860d1a32c 100644 --- a/ci_utils/templates/ci.jinja +++ b/ci_utils/templates/ci.jinja @@ -10,8 +10,6 @@ on: repository_dispatch: types: [ok-to-test-command] push: - branches: - - main jobs: <%- for (os, target, binary_extension) in [ @@ -89,6 +87,14 @@ jobs: <% set job_name %>Run tests (<<- target >>)<% endset %> <%- from 'tests_steps' import output -%> <<- output | indent(4) >> + tests_pavex_<<- target >>: + name: "Run `pavex` tests (<<- target >>)" + runs-on: << os >> + needs: + - build_clis_<<- target >> + <% set job_name %>Run `pavex` tests (<<- target >>)<% endset %> + <%- from 'pavex_tests_steps' import output -%> + <<- output | indent(4) >> ui_tests_<<- target >>: name: "Run UI tests (<<- target >>)" runs-on: << os >> diff --git a/ci_utils/templates/job_steps/pavex_tests.jinja b/ci_utils/templates/job_steps/pavex_tests.jinja new file mode 100644 index 000000000..5819927a1 --- /dev/null +++ b/ci_utils/templates/job_steps/pavex_tests.jinja @@ -0,0 +1,15 @@ +<% extends 'steps' %> +<% block inner_steps %> +- name: Install Rust stable toolchain + uses: actions-rust-lang/setup-rust-toolchain@v1.8.0 + with: + components: rustfmt + rustflags: "" + cache-workspaces: "./libs -> ./target" +- uses: taiki-e/install-action@cargo-hack +<% include 'setup_pavex' %> +- name: Run Pavex tests with multiple feature combinations + working-directory: libs + run: | + cargo hack -p pavex --feature-powerset --depth 2 test --tests +<%- endblock %> diff --git a/ci_utils/templates/job_steps/tests.jinja b/ci_utils/templates/job_steps/tests.jinja index 01601001d..98f9b4362 100644 --- a/ci_utils/templates/job_steps/tests.jinja +++ b/ci_utils/templates/job_steps/tests.jinja @@ -10,5 +10,5 @@ - name: Run tests working-directory: libs run: | - cargo test --all-features --workspace --exclude="pavex_cli" --exclude="pavex_macros" << exclude_libs_with_deps >> + cargo test --all-features --workspace --exclude="pavex_cli" --exclude="pavex_macros" --exclude="pavex" << exclude_libs_with_deps >> <%- endblock %> diff --git a/libs/pavex_session/Cargo.toml b/libs/pavex_session/Cargo.toml index 8a0177952..d078dbaaf 100644 --- a/libs/pavex_session/Cargo.toml +++ b/libs/pavex_session/Cargo.toml @@ -30,3 +30,4 @@ pavex_session_memory_store = { path = "../pavex_session_memory_store" } googletest = "0.14.2" itertools = { workspace = true } insta = { workspace = true } +tokio = { workspace = true, features = ["rt", "macros"] } diff --git a/libs/pavex_session_redis/Cargo.toml b/libs/pavex_session_redis/Cargo.toml index 052a224f2..3d613801e 100644 --- a/libs/pavex_session_redis/Cargo.toml +++ b/libs/pavex_session_redis/Cargo.toml @@ -21,3 +21,4 @@ serde_json = { workspace = true } [dev-dependencies] uuid = { workspace = true } +tokio = { workspace = true, features = ["macros"] }