Build & Test #218
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
name: "Build & Test" | |
on: | |
push: | |
branches: | |
- main | |
- "release/*" | |
pull_request: | |
workflow_dispatch: | |
inputs: | |
override-antelope-spring-dev: | |
description: Override antelope-spring-dev target | |
type: string | |
override-antelope-spring-dev-prerelease: | |
type: choice | |
description: Override antelope-spring-dev prelease | |
options: | |
- default | |
- true | |
- false | |
override-cdt: | |
description: 'Override cdt target' | |
type: string | |
override-cdt-prerelease: | |
type: choice | |
description: Override cdt prelease | |
options: | |
- default | |
- true | |
- false | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
build-test: | |
name: Build & Test | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Setup antelope-spring-dev & cdt versions | |
id: versions | |
env: | |
GH_TOKEN: ${{secrets.GITHUB_TOKEN}} | |
run: | | |
DEFAULTS_JSON=$(curl -sSfL $(gh api https://api.github.com/repos/${{github.repository}}/contents/.cicd/defaults.json?ref=${{github.sha}} --jq .download_url)) | |
echo antelope-spring-dev-target=$(echo "$DEFAULTS_JSON" | jq -r '."antelope-spring-dev".target') >> $GITHUB_OUTPUT | |
echo antelope-spring-dev-prerelease=$(echo "$DEFAULTS_JSON" | jq -r '."antelope-spring-dev".prerelease') >> $GITHUB_OUTPUT | |
echo cdt-target=$(echo "$DEFAULTS_JSON" | jq -r '.cdt.target') >> $GITHUB_OUTPUT | |
echo cdt-prerelease=$(echo "$DEFAULTS_JSON" | jq -r '.cdt.prerelease') >> $GITHUB_OUTPUT | |
if [[ "${{inputs.override-antelope-spring-dev}}" != "" ]]; then | |
echo antelope-spring-dev-target=${{inputs.override-antelope-spring-dev}} >> $GITHUB_OUTPUT | |
fi | |
if [[ "${{inputs.override-antelope-spring-dev-prerelease}}" == +(true|false) ]]; then | |
echo antelope-spring-dev-prerelease=${{inputs.override-antelope-spring-dev-prerelease}} >> $GITHUB_OUTPUT | |
fi | |
if [[ "${{inputs.override-cdt}}" != "" ]]; then | |
echo cdt-target=${{inputs.override-cdt}} >> $GITHUB_OUTPUT | |
fi | |
if [[ "${{inputs.override-cdt-prerelease}}" == +(true|false) ]]; then | |
echo cdt-prerelease=${{inputs.override-cdt-prerelease}} >> $GITHUB_OUTPUT | |
fi | |
- name: Download cdt | |
uses: AntelopeIO/asset-artifact-download-action@v3 | |
with: | |
owner: AntelopeIO | |
repo: cdt | |
file: 'cdt_.*amd64.deb' | |
target: '${{steps.versions.outputs.cdt-target}}' | |
prereleases: ${{fromJSON(steps.versions.outputs.cdt-prerelease)}} | |
artifact-name: cdt_ubuntu_package_amd64 | |
- name: Download antelope-spring-dev | |
uses: AntelopeIO/asset-artifact-download-action@v3 | |
with: | |
owner: AntelopeIO | |
repo: spring | |
file: 'antelope-spring-dev.*ubuntu22\.04_amd64.deb' | |
target: '${{steps.versions.outputs.antelope-spring-dev-target}}' | |
prereleases: ${{fromJSON(steps.versions.outputs.antelope-spring-dev-prerelease)}} | |
artifact-name: antelope-spring-dev-ubuntu22-amd64 | |
container-package: antelope-spring-experimental-binaries | |
- name: Install packages | |
run: | | |
sudo apt-get update && sudo apt-get upgrade -y | |
sudo apt install ./*.deb | |
sudo apt-get install cmake | |
rm ./*.deb | |
- uses: actions/checkout@v4 | |
with: | |
path: src | |
- name: Build & Test | |
run: | | |
cmake -S src -B build -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTS=On -DSYSTEM_ENABLE_SPRING_VERSION_CHECK=Off -DSYSTEM_ENABLE_CDT_VERSION_CHECK=Off | |
cmake --build build -- -j $(nproc) | |
tar zcf build.tar.gz build | |
ctest --test-dir build/tests --output-on-failure -j $(nproc) | |
- name: Upload builddir | |
uses: actions/upload-artifact@v3 | |
with: | |
name: builddir | |
path: build.tar.gz |