chore: Updated dependency to allow rustc version bump #2825
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Rust | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
env: | |
CARGO_TERM_COLOR: always | |
SQLX_OFFLINE: "true" | |
jobs: | |
unit-tests: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Ensure musl installed | |
run: sudo apt-get install -y musl-dev musl-tools musl && rustup target add x86_64-unknown-linux-musl | |
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 | |
- uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2 | |
- name: Install cargo-llvm-cov | |
uses: taiki-e/install-action@cargo-llvm-cov | |
- name: Run unit tests | |
run: cargo llvm-cov test --verbose --lib --lcov --output-path lcov.unit-tests.info | |
- name: Upload artifact | |
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4 | |
with: | |
name: lcov.unit-tests.info | |
path: lcov.unit-tests.info | |
integration-tests: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Ensure musl installed | |
run: sudo apt-get install -y musl-dev musl-tools musl && rustup target add x86_64-unknown-linux-musl | |
- name: Ensure terraform installed | |
run: | | |
wget -O- https://apt.releases.hashicorp.com/gpg | sudo gpg --dearmor -o /usr/share/keyrings/hashicorp-archive-keyring.gpg | |
echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/hashicorp.list | |
sudo apt update && sudo apt install terraform | |
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 | |
- uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2 | |
- name: Install cargo-llvm-cov | |
uses: taiki-e/install-action@cargo-llvm-cov | |
- name: Start containers | |
run: docker compose up -d | |
- name: Install self signed certificate | |
run: | | |
until [ -f ./resources/test/certs/cert.pem ]; do sleep 1; done | |
sudo cp ./resources/test/certs/cert.pem /usr/local/share/ca-certificates/localhost.crt && sudo update-ca-certificates | |
timeout-minutes: 1 | |
- name: Run integration tests | |
run: cargo llvm-cov test --verbose --test '*' --lcov --output-path lcov.integration-tests.info | |
env: | |
AWS_ACCESS_KEY_ID: minioadmin | |
AWS_SECRET_ACCESS_KEY: minioadmin | |
AWS_REGION: us-east-1 | |
RUSTFLAGS: "-C instrument-coverage" | |
- name: Stop containers | |
if: always() | |
run: docker compose down | |
- name: Upload artifact | |
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4 | |
with: | |
name: lcov.integration-tests.info | |
path: lcov.integration-tests.info | |
coverage: | |
runs-on: ubuntu-latest | |
permissions: | |
pull-requests: write | |
needs: [unit-tests, integration-tests] | |
steps: | |
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 | |
- name: Setup LCOV | |
uses: hrishikesh-kadam/setup-lcov@f5da1b26b0dcf5d893077a3c4f29cf78079c841d # v1 | |
- uses: actions/download-artifact@master | |
with: | |
name: lcov.integration-tests.info | |
path: lcov | |
- uses: actions/download-artifact@master | |
with: | |
name: lcov.unit-tests.info | |
path: lcov | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@ab904c41d6ece82784817410c45d8b8c02684457 # v3 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
files: lcov.unit-tests.info,lcov.integration-tests.info | |
fail_ci_if_error: true | |
build-release: | |
runs-on: ubuntu-latest | |
if: github.ref == 'refs/heads/main' | |
steps: | |
- name: Ensure musl installed | |
run: sudo apt-get install -y musl-dev musl-tools musl && rustup target add x86_64-unknown-linux-musl | |
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 | |
- name: Build final release binary | |
run: ./scripts/release | |
- name: Upload artifact | |
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4 | |
with: | |
name: terrashine-binary | |
path: target/x86_64-unknown-linux-musl/release/terrashine |