Skip to content

chore: refactor Build Axon step in the workflows #4

chore: refactor Build Axon step in the workflows

chore: refactor Build Axon step in the workflows #4

Workflow file for this run

name: Build Axon Binary
on:
push:
pull_request:
merge_group:
workflow_dispatch:
# Rather than copying and pasting from one workflow to another, you can make workflows reusable.
# See https://docs.github.com/en/actions/using-workflows/reusing-workflows
workflow_call:
jobs:
build-and-cache:
strategy:
matrix:
# Supported GitHub-hosted runners and hardware resources
# see https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources
os: [ubuntu-20.04, ubuntu-22.04] # TODO: test on [windows-latest, macos-latest]
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Cache of the Axon binary
id: axon-bin-cache
uses: actions/cache@v3
with:
path: |
target/debug/axon
target/release/axon
key: ${{ matrix.os }}-${{ runner.os }}-${{ runner.arch }}-axon-${{ github.sha }}
- name: Cache of Cargo
uses: actions/cache@v3
if: steps.axon-bin-cache.outputs.cache-hit != 'true'
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ matrix.os }}-${{ runner.os }}-${{ runner.arch }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Build Axon in the development profile
if: steps.axon-bin-cache.outputs.cache-hit != 'true'
run: cargo build
# TOOD: not sure if this step is required
# - name: Build a release version of Axon
# if: steps.axon-bin-cache.outputs.cache-hit != 'true'
# run: cargo build --release