Skip to content

Initial import

Initial import #4

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: Check format
run: cargo fmt --check
- name: Lint code
uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --all-features --no-deps
- 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.AUTOMETRICS_DOCKERHUB_USERNAME }} TODO
AUTOMETRICS_DOCKERHUB_TOKEN: ${{ secrets.AUTOMETRICS_DOCKERHUB_TOKEN }}