forked from astarte-platform/stream-rust-test
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ci): add cargo test checks on CI
Signed-off-by: Riccardo Gallo <[email protected]>
- Loading branch information
Showing
2 changed files
with
71 additions
and
0 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
# This file is part of Astarte. | ||
# | ||
# Copyright 2024 SECO Mind Srl | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
name: test | ||
on: | ||
workflow_call: | ||
workflow_dispatch: | ||
permissions: | ||
contents: read | ||
env: | ||
CARGO_TERM_COLOR: always | ||
SCCACHE_GHA_ENABLED: "true" | ||
RUSTC_WRAPPER: "sccache" | ||
# Enable logging otherwise the logging lines will count as not covered in the test coverage | ||
RUST_LOG: trace | ||
jobs: | ||
required: | ||
runs-on: ubuntu-latest | ||
name: ubuntu / ${{ matrix.toolchain }} | ||
strategy: | ||
matrix: | ||
toolchain: [stable, beta] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Install ${{ matrix.toolchain }} | ||
uses: dtolnay/rust-toolchain@master | ||
with: | ||
toolchain: ${{ matrix.toolchain }} | ||
- name: Install sccache-cache | ||
uses: mozilla-actions/[email protected] | ||
- name: cargo generate-lockfile | ||
if: hashFiles('Cargo.lock') == '' | ||
run: cargo generate-lockfile | ||
- name: Run cargo test --locked | ||
run: cargo test --locked --all-features --all-targets --workspace | ||
os-check: | ||
runs-on: ${{ matrix.os }} | ||
name: ${{ matrix.os }} / stable / vcpkg | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [windows-latest] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Install stable | ||
uses: dtolnay/rust-toolchain@stable | ||
- name: Install sccache-cache | ||
uses: mozilla-actions/[email protected] | ||
# Setup vcpkg binary cache | ||
# https://learn.microsoft.com/en-us/vcpkg/users/binarycaching#gha-quickstart | ||
- uses: actions/github-script@v7 | ||
with: | ||
script: | | ||
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || ''); | ||
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || ''); | ||
- name: Set VCPKG_ROOT | ||
run: echo "VCPKG_ROOT=$env:VCPKG_INSTALLATION_ROOT" | Out-File -FilePath $env:GITHUB_ENV -Append | ||
- name: Install dependencies | ||
run: vcpkg install --binarysource="clear;x-gha,readwrite" openssl:x64-windows-static-md sqlite3 | ||
- name: cargo generate-lockfile | ||
if: hashFiles('Cargo.lock') == '' | ||
run: cargo generate-lockfile | ||
- name: cargo test | ||
run: cargo test --locked --all-features --all-targets --workspace |