Do not fail when building without a git context/repo [fix] #31
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
# SPDX-FileCopyrightText: 2021 - 2023 Robin Vobruba <hoijui.quaero@gmail.com> | |
# | |
# SPDX-License-Identifier: Unlicense | |
name: build | |
on: | |
push: | |
branches: [ master, develop ] | |
paths: | |
- 'src/**' | |
- '**/src/**' | |
- 'tests/**' | |
- '**/tests/**' | |
- 'Cargo.toml' | |
- '**/Cargo.toml' | |
- 'Cargo.lock' | |
- '**/Cargo.lock' | |
- 'scripts/build' | |
- '.github/workflows/build.yml' | |
release: | |
types: [ published ] | |
env: | |
RUST_BACKTRACE: 1 | |
jobs: | |
push_to_registry: | |
name: Compile | |
runs-on: ubuntu-latest | |
steps: | |
- name: "Check out the repo" | |
uses: actions/checkout@v3 | |
with: | |
# This makes sure we also get tags, | |
# so we get the correct version; see bug: | |
# https://github.com/actions/checkout/issues/701 | |
fetch-depth: 0 | |
submodules: true | |
- name: "Install STOML (BASH TOML parser)" | |
run: scripts/install_stoml | |
- name: "Setup Python 3" | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.x' | |
cache: 'pip' # caching pip dependencies | |
cache-dependency-path: '.github/requirements-ci.txt' | |
- name: "Install the REUSE tool" | |
run: pip install reuse | |
- name: "Get the Rust toolchain" | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
targets: x86_64-unknown-linux-musl | |
components: rustfmt, clippy | |
- name: "Smart caching for rust/cargo" | |
uses: Swatinem/rust-cache@v2 | |
- name: "Install STOML (BASH TOML parser) *again*, because the cache recreation above might have removed it" | |
run: scripts/install_stoml | |
- name: "Build" | |
run: scripts/build | |
- name: "Test & Check" | |
run: scripts/test | |