v0.12.6 #48
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
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow | |
name: build-and-upload-artifacts | |
on: | |
push: | |
branches: | |
- main | |
release: | |
types: | |
- published | |
workflow_dispatch: | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
build-and-upload-artifacts: | |
name: Building and uploading artifacts | |
runs-on: ${{ matrix.runner_os }} | |
strategy: | |
matrix: | |
target: | |
- x86_64-unknown-linux-musl | |
- x86_64-apple-darwin | |
- x86_64-pc-windows-msvc | |
include: | |
- target: x86_64-apple-darwin | |
runner_platform: x86_64-apple-darwin | |
runner_os: macos-latest | |
- target: x86_64-unknown-linux-musl | |
runner_platform: x86_64-unknown-linux-gnu | |
runner_os: ubuntu-latest | |
- target: x86_64-pc-windows-msvc | |
runner_platform: x86_64-pc-windows-msvc | |
runner_os: windows-latest | |
executable_suffix: .exe | |
steps: | |
- name: Install dependencies for `musl libc` on Linux | |
if: matrix.target == 'x86_64-unknown-linux-musl' | |
run: | | |
sudo apt -y install musl-tools | |
# See also: <https://github.com/rusqlite/rusqlite/blob/master/.github/workflows/main.yml> | |
- name: Add LLVM path on Windows | |
if: runner.os == 'Windows' | |
run: | | |
echo "C:\msys64\mingw64\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append | |
- name: Install Rust toolchains for both native target and WASM | |
uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: stable | |
targets: ${{ matrix.target }}, wasm32-unknown-unknown | |
- name: Check out repository | |
uses: actions/checkout@v4 | |
- name: Cache Rust toolchain and build artifacts | |
uses: Swatinem/rust-cache@v2 | |
with: | |
# Distinguished by the action name to avoid sharing across different actions! | |
shared-key: "build-and-upload-artifacts" | |
- name: Install Trunk for building the webapp | |
run: | | |
cargo install --locked trunk | |
- name: Install just | |
uses: extractions/setup-just@v1 | |
- name: Build ofdb-app-clearance | |
run: just build-clearance | |
- name: Build server executable | |
run: | | |
cargo build --locked --all-features --profile production --target ${{ matrix.target }} | |
- name: Upload tagged release artifact | |
id: upload-tagged-release-artifact | |
# Only triggered by version tags that start with 'v' | |
if: startsWith(github.ref, 'refs/tags/v') && startsWith(github.event.release.tag_name, 'v') | |
uses: actions/upload-artifact@v3 | |
with: | |
# Artifact is stored and downloaded as .zip archive | |
name: openfairdb_${{ github.event.release.tag_name }}_${{ matrix.target }}${{ matrix.executable_suffix }} | |
path: target/${{ matrix.target }}/production/openfairdb${{ matrix.executable_suffix }} | |
- name: Upload untagged artifact | |
if: steps.upload-tagged-release-artifact.outcome == 'skipped' | |
uses: actions/upload-artifact@v3 | |
with: | |
# Artifact is stored and downloaded as .zip archive | |
name: openfairdb_${{ github.sha }}_${{ matrix.target }}${{ matrix.executable_suffix }} | |
path: target/${{ matrix.target }}/production/openfairdb${{ matrix.executable_suffix }} |