From 36aa39df5b2da7652336d07ff3484abf175fa76b Mon Sep 17 00:00:00 2001 From: shimwell Date: Thu, 24 Oct 2024 10:23:37 +0100 Subject: [PATCH] added ci --- .github/workflows/ci.yml | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 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 0000000..570e847 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,36 @@ +name: CI Rust testing + +on: + push: + pull_request: + +env: + CARGO_TERM_COLOR: always + +jobs: + build_and_test: + name: Rust project - latest + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - name: Set up Rust + run: rustup update stable && rustup default stable + - name: Build + run: cargo build --verbose + - name: Test + run: cargo test --verbose + + publish: + name: Publish to crates.io + needs: build_and_test + if: ${{ startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch' }} + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + - name: Set up Rust + run: rustup update stable && rustup default stable + - name: Publish to crates.io + run: cargo publish --verbose --locked --token ${{ secrets.CARGO_REGISTRY_TOKEN }} \ No newline at end of file