Skip to content

Use the correct variables #13

Use the correct variables

Use the correct variables #13

Workflow file for this run

# This workflow will be triggered by a GitHub pull-request and pushes to main.
# It will verify that the code compiles, that the tests pass and that
# clippy does not complain (too much) and finally that the code is formatted
# according to cargo fmt. If it was a push to main, then it will also trigger a
# build, and a deploy to dev.
#
# This workflow will verify all the Rust code in the repository. Testing the API
# is by far the slowest of the Rust crates anyway, so letting the others
# piggy-back adds negligible overhead.
---
name: Test Rust code
on:
pull_request:
branches: ["*"]
push:
branches: ["main"]
jobs:
test:
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: Swatinem/rust-cache@v2
- name: Install protoc
run: |
sudo apt-get update
sudo apt-get install protobuf-compiler -y
- name: Install Rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
components: rustfmt, clippy
- name: Check format
run: cargo fmt --check
- name: Clippy
uses: giraffate/clippy-action@v1
- name: Run tests
run: cargo test
create-build:
uses: ./.github/workflows/build.yml
needs: test
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
with:
commitish: ${{ github.sha }}
override_latest: false
secrets:
AUTOMETRICS_DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
AUTOMETRICS_DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}