From 1f34edfea2b97ea72ea0f03ba18c79f9e7ab6e3a Mon Sep 17 00:00:00 2001 From: Jonathan Gilchrist Date: Wed, 16 Oct 2024 18:23:00 +0100 Subject: [PATCH] Add a Github workflow to run the tests on push --- .github/workflows/ci.yml | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..d2bb7ad8 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,39 @@ +name: CI + +on: + push: + branches: + - master + +jobs: + + metadata: + runs-on: ubuntu-latest + + outputs: + rust-version: ${{ steps.determine-rust-version.outputs.version }} + + steps: + - uses: actions/checkout@v4 + + - id: determine-rust-version + name: Determine Rust version + run: | + version=$(grep -m 1 'rust-version' Cargo.toml | tr -s ' ' | tr -d '"' | tr -d "'" | cut -d' ' -f3) + echo "Rust version: $version" + echo "version=$version" >> "$GITHUB_OUTPUT" + + build-and-test: + runs-on: ubuntu-latest + needs: [metadata] + + steps: + - uses: actions/checkout@v4 + + - name: Setup toolchain + run: | + rustup override set ${{ needs.metadata.outputs.rust-version }} + + - name: Test + run: | + cargo test --release