Skip to content

chore(ci): remove --locked #2

chore(ci): remove --locked

chore(ci): remove --locked #2

Workflow file for this run

---
name: Build Test Matrix
'on':
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]*"
branches:
- "build-ci-*"
schedule:
- cron: "05 00 * * *"
workflow_dispatch:
env:
toolchain: nightly-2024-07-07
matrix-json-file: ".github/workflows/build_tests.json"
CARGO_HTTP_MULTIPLEXING: false
CARGO_UNSTABLE_SPARSE_REGISTRY: true
CARGO: cargo
#CARGO_OPTIONS: "--locked"
CARGO_OPTIONS: "-vv"
CARGO_CACHE: true
concurrency:
# https://docs.github.com/en/actions/examples/using-concurrency-expressions-and-a-test-matrix
group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}'
cancel-in-progress: ${{ !startsWith(github.ref, 'refs/tags/v') || github.ref != 'refs/heads/development' }}
permissions: {}
jobs:
matrix-prep:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v4
with:
submodules: false
- name: Set Matrix
id: set-matrix
run: |
#
# build all targets images
# matrix=$( jq -s -c .[] .github/workflows/build_binaries.json )
#
# build only single target image
# matrix_selection=$( jq -c '.[] | select( ."name" == "windows-x64" )' ${{ env.matrix-json-file }} )
# matrix_selection=$( jq -c '.[] | select( ."name" | contains("macos") )' ${{ env.matrix-json-file }} )
#
# build select target images - build_enabled
matrix_selection=$( jq -c '.[] | select( ."build_enabled" != false )' ${{ env.matrix-json-file }} )
#
# Setup the json build matrix
matrix=$(echo ${matrix_selection} | jq -s -c '{"builds": .}')
echo $matrix
echo $matrix | jq .
echo "matrix=${matrix}" >> $GITHUB_OUTPUT
matrix-check:
# Debug matrix
if: ${{ false }}
runs-on: ubuntu-latest
needs: matrix-prep
steps:
- name: Install json2yaml
run: |
sudo npm install -g json2yaml
- name: Check matrix definition
run: |
matrix='${{ needs.matrix-prep.outputs.matrix }}'
echo $matrix
echo $matrix | jq .
echo $matrix | json2yaml
builds:
name: Building ${{ matrix.builds.name }} on ${{ matrix.builds.runs-on }}
needs: matrix-prep
continue-on-error: ${{ matrix.builds.best_effort || false }}
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.matrix-prep.outputs.matrix) }}
runs-on: ${{ matrix.builds.runs-on }}
steps:
- name: Checkout source code
uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup Rust toolchain
uses: dtolnay/rust-toolchain@master
with:
components: rustfmt, clippy
toolchain: ${{ matrix.builds.rust }}
targets: ${{ matrix.builds.target }}
- name: Install Linux dependencies - Ubuntu
if: ${{ startsWith(runner.os,'Linux') && ( ! matrix.builds.cross ) }}
run: |
sudo apt-get update
sudo bash scripts/install_ubuntu_dependencies.sh
- name: Install Linux dependencies - Ubuntu - cross-compiled ${{ env.TARI_BUILD_ISA_CPU }} on x86-64
if: ${{ startsWith(runner.os,'Linux') && ( ! matrix.builds.cross ) && matrix.builds.name != 'linux-x86_64' }}
run: |
sudo apt-get update
sudo bash scripts/install_ubuntu_dependencies-cross_compile.sh ${{ env.TARI_BUILD_ISA_CPU }}
rustup target add ${{ matrix.builds.target }}
echo "PKG_CONFIG_SYSROOT_DIR=/usr/${{ env.TARI_BUILD_ISA_CPU }}-linux-gnu/" >> $GITHUB_ENV
- name: Install macOS dependencies
if: startsWith(runner.os,'macOS')
run: |
# openssl, cmake and autoconf already installed
brew install zip coreutils automake protobuf
rustup target add ${{ matrix.builds.target }}
- name: Install macOS-14 missing dependencies - hack
if: ${{ startsWith(runner.os,'macOS') && startsWith(runner.arch,'ARM64') }}
run: |
brew install libtool
- name: Install Windows dependencies
if: startsWith(runner.os,'Windows')
run: |
choco upgrade protoc -y
rustup target add ${{ matrix.builds.target }}
- name: Cache cargo files and outputs
if: ${{ ( ! startsWith(github.ref, 'refs/tags/v') ) && ( ! matrix.builds.cross ) && ( env.CARGO_CACHE ) }}
uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.builds.target }}
- name: Install and setup cargo cross
if: ${{ matrix.builds.cross }}
shell: bash
run: |
#cargo install cross
cargo install cross --git https://github.com/cross-rs/cross
echo "CARGO=cross" >> $GITHUB_ENV
- name: Install and setup cargo-auditable
# if: ${{ ( startsWith(github.ref, 'refs/tags/v') ) && ( ! matrix.builds.cross ) }}
if: ${{ ( ! matrix.builds.cross ) }}
shell: bash
run: |
cargo install cargo-auditable cargo-audit
echo "CARGO=${{ env.CARGO }} auditable" >> $GITHUB_ENV
- name: Build release targets
# if: ${{ startsWith(github.ref, 'refs/tags/v') }}
shell: bash
run: |
# echo "TS_BUILD=release" >> $GITHUB_ENV
if [[ "${{ env.TS_BUILD }}" == "release" ]]; then
echo "CARGO_OPTIONS=${{ env.CARGO_OPTIONS }} --${{ env.TS_BUILD }}" >> $GITHUB_ENV
fi
- name: Show command used for Cargo
shell: bash
run: |
echo "cargo command is: ${{ env.CARGO }}"
echo "cargo options is: ${{ env.CARGO_OPTIONS }}"
echo "cross flag: ${{ matrix.builds.cross }}"
- name: Build test for ${{ matrix.builds.target }}
shell: bash
run: |
${{ env.CARGO }} build ${{ env.CARGO_OPTIONS }} \
--target ${{ matrix.builds.target }} \
--features "${{ env.BUILD_FEATURES }}" \
${{ env.TARGET_BINS }} \
${{ matrix.builds.flags }}