Skip to content

Build & Test

Build & Test #4607

Workflow file for this run

name: "Build & Test"
on:
push:
branches:
- main
- "release/*"
pull_request:
workflow_dispatch:
inputs:
override-cdt:
description: 'Override cdt target'
type: string
override-cdt-prerelease:
type: choice
description: Override cdt prelease
options:
- default
- true
- false
override-eos-system-contracts:
description: 'Override eos-system-contracts ref'
type: string
permissions:
packages: read
contents: read
defaults:
run:
shell: bash
jobs:
platform-cache:
name: Platform Cache
uses: AntelopeIO/platform-cache-workflow/.github/workflows/platformcache.yaml@main
permissions:
contents: read
packages: write
with:
runs-on: '["self-hosted", "enf-x86-beefy"]'
platform-files: |
.cicd/platforms
tools/reproducible.Dockerfile:builder
build-base:
name: Run Build Workflow
uses: ./.github/workflows/build_base.yaml
needs: [platform-cache]
with:
platforms: ${{needs.platform-cache.outputs.platforms}}
platform-list: ${{needs.platform-cache.outputs.platform-list}}
v:
name: Discover Versions
runs-on: ubuntu-latest
outputs:
cdt-target: ${{steps.versions.outputs.cdt-target}}
cdt-prerelease: ${{steps.versions.outputs.cdt-prerelease}}
eos-system-contracts-ref: ${{steps.versions.outputs.eos-system-contracts-ref}}
steps:
- name: Setup cdt and eos-system-contracts 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 cdt-target=$(echo "$DEFAULTS_JSON" | jq -r '.cdt.target') >> $GITHUB_OUTPUT
echo cdt-prerelease=$(echo "$DEFAULTS_JSON" | jq -r '.cdt.prerelease') >> $GITHUB_OUTPUT
echo eos-system-contracts-ref=$(echo "$DEFAULTS_JSON" | jq -r '.eossystemcontracts.ref') >> $GITHUB_OUTPUT
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
if [[ "${{inputs.override-eos-system-contracts}}" != "" ]]; then
echo eos-system-contracts-ref=${{inputs.override-eos-system-contracts}} >> $GITHUB_OUTPUT
fi
package:
name: Build leap.deb packages
needs: [platform-cache, build-base]
strategy:
fail-fast: false
matrix:
platform: [ubuntu20, ubuntu22, reproducible]
runs-on: ubuntu-latest
container: ${{fromJSON(needs.platform-cache.outputs.platforms)[matrix.platform].image}}
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Download builddir
uses: actions/download-artifact@v3
with:
name: ${{matrix.platform}}-build
- name: Build packages
run: |
zstdcat build.tar.zst | tar x
cd build
cpack
../tools/tweak-deb.sh leap_*.deb
- name: Install dev package
if: matrix.platform != 'reproducible'
run: |
apt-get update && apt-get upgrade -y
apt-get install -y ./build/leap_*.deb ./build/leap-dev*.deb
- name: Test using TestHarness
if: matrix.platform != 'reproducible'
run: |
python3 -c "from TestHarness import Cluster"
- name: Upload dev package
uses: actions/upload-artifact@v3
if: matrix.platform != 'reproducible'
with:
name: leap-dev-${{matrix.platform}}-amd64
path: build/leap-dev*.deb
- name: Upload leap package
uses: actions/upload-artifact@v3
if: matrix.platform == 'reproducible'
with:
name: leap-deb-amd64
path: build/leap_*.deb
tests:
name: Tests ${{matrix.cfg.name}}
needs: [platform-cache, build-base]
strategy:
fail-fast: false
matrix:
include:
- cfg: {name: 'ubuntu20', base: 'ubuntu20', builddir: 'ubuntu20'}
- cfg: {name: 'ubuntu22', base: 'ubuntu22', builddir: 'ubuntu22'}
- cfg: {name: 'ubuntu20repro', base: 'ubuntu20', builddir: 'reproducible'}
- cfg: {name: 'ubuntu22repro', base: 'ubuntu22', builddir: 'reproducible'}
runs-on: ["self-hosted", "enf-x86-hightier"]
container:
image: ${{fromJSON(needs.platform-cache.outputs.platforms)[matrix.cfg.base].image}}
options: --security-opt seccomp=unconfined
steps:
- uses: actions/checkout@v3
- name: Download builddir
uses: actions/download-artifact@v3
with:
name: ${{matrix.cfg.builddir}}-build
- name: Run Parallel Tests
run: |
# https://github.com/actions/runner/issues/2033 -- need this because of full version label test looking at git revs
chown -R $(id -u):$(id -g) $PWD
zstdcat build.tar.zst | tar x
cd build
ctest --output-on-failure -j $(nproc) -LE "(nonparallelizable_tests|long_running_tests)" --timeout 420
- name: Check CPU Features
run: awk 'BEGIN {err = 1} /bmi2/ && /adx/ {err = 0} END {exit err}' /proc/cpuinfo