Skip to content

WIP: [CI] Enable caching for unit tests #2894

WIP: [CI] Enable caching for unit tests

WIP: [CI] Enable caching for unit tests #2894

Workflow file for this run

name: Test Quasar
on:
pull_request:
branches:
- main
push:
branches:
- main
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref }}
cancel-in-progress: true
# This workflow makes x86_64 binaries for linux.
# TODO: add darwin later
jobs:
test-go:
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v3
- name: Get git diff
uses: technote-space/[email protected]
with:
PATTERNS: |
**/**.go
go.mod
go.sum
- name: Setup Golang
if: env.GIT_DIFF
uses: actions/setup-go@v3
with:
go-version: 1.20.7
- name: Display go version
if: env.GIT_DIFF
run: go version
- name: Run all tests
if: env.GIT_DIFF
run: make test-cover
- name: Code coverage report
if: env.GIT_DIFF
uses: codecov/[email protected]
test-rust:
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v3
- name: Get git diff
uses: technote-space/[email protected]
with:
PATTERNS: |
**/**.rs
- name: Install Rust
if: env.GIT_DIFF
uses: dtolnay/rust-toolchain@stable
- name: Restore dependencies
if: env.GIT_DIFF
uses: actions/cache@v4
with:
path: |
~/.cargo
smart-contracts/target
key: ${{ runner.os }}-cargo-$${{ hashFiles('Cargo.toml') }}
restore-keys: ${{ runner.os }}-cargo
- name: Install just via cargo
if: env.GIT_DIFF
run: cargo install just
- name: Run unit-tests
if: env.GIT_DIFF
run: cd smart-contracts && cargo test --lib