name: Test # Publishing only happens on v* tags (publish.yml), so this is what # keeps plain main pushes honest between releases. on: push: branches: [main] pull_request: jobs: test: runs-on: bare env: # Same shared-toolchain/cache story as publish.yml. CARGO_HOME: /var/local/cargo RUSTUP_HOME: /var/local/rustup PATH: /var/local/cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/bin SCCACHE_DIR: /var/local/sccache SCCACHE_SERVER_PORT: "4228" CARGO_TARGET_DIR: /var/local/cargo-target steps: - uses: actions/checkout@v4 # A throwaway JetStream for tests/jetstream.rs. Best effort: if the # runner cannot use docker the variable stays unset and that one # test reports itself skipped rather than failing the build. - name: Start a throwaway JetStream run: | docker rm -f portal-test-nats >/dev/null 2>&1 || true if docker run -d --rm --name portal-test-nats -p 127.0.0.1:14223:4222 nats:2.14.6-alpine -js >/dev/null 2>&1; then sleep 2 echo "PORTAL_TEST_NATS_URL=nats://127.0.0.1:14223" >> "$GITHUB_ENV" else echo "::warning::no docker on this runner - the JetStream integration test will be skipped" fi - name: Test run: cargo test --features ssr - name: Stop the throwaway JetStream if: always() run: docker rm -f portal-test-nats >/dev/null 2>&1 || true