Build & Test #4313
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-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: | |
platforms: | |
name: Run Platforms Workflow | |
uses: ./.github/workflows/platforms.yaml | |
permissions: | |
packages: write | |
contents: read | |
build-base: | |
name: Run Build Workflow | |
uses: ./.github/workflows/build_base.yaml | |
needs: [platforms] | |
with: | |
p: ${{needs.platforms.outputs.p}} | |
platform-matrix: ${{needs.platforms.outputs.platform-matrix}} | |
permissions: | |
packages: write | |
contents: read | |
regen-boringssl: | |
name: Check BoringSSL Files | |
runs-on: ubuntu-latest | |
needs: platforms | |
container: ${{fromJSON(needs.platforms.outputs.p)['ubuntu22'].image}} | |
env: | |
GOPATH: /go | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
- name: Install Go 1.21 | |
run: | | |
apt-get install curl | |
curl -L https://dl.google.com/go/go1.21.0.linux-amd64.tar.gz | tar -C /usr/local -xz | |
echo /usr/local/go/bin:$GOPATH/bin >> $GITHUB_PATH | |
- name: Regen & check BoringSSL files | |
run: | | |
# https://github.com/actions/runner/issues/2033 | |
chown -R $(id -u):$(id -g) $PWD | |
cmake -B build | |
cmake --build build --target regenerate_boringssl | |
git diff --quiet | |
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 | |
dev-package: | |
name: Build leap-dev package | |
needs: [platforms, build-base] | |
if: always() && needs.platforms.result == 'success' && needs.build-base.result == 'success' | |
strategy: | |
fail-fast: false | |
matrix: | |
platform: [ubuntu20, ubuntu22] | |
runs-on: ubuntu-latest | |
container: ${{fromJSON(needs.platforms.outputs.p)[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 dev package | |
run: | | |
zstdcat build.tar.zst | tar x | |
cd build | |
cpack | |
- name: Install dev package | |
run: | | |
apt-get update && apt-get upgrade -y | |
apt-get install -y ./build/leap_*.deb ./build/leap-dev*.deb | |
- name: Test using TestHarness | |
run: | | |
python3 -c "from TestHarness import Cluster" | |
- name: Upload dev package | |
uses: actions/upload-artifact@v3 | |
with: | |
name: leap-dev-${{matrix.platform}}-amd64 | |
path: build/leap-dev*.deb | |
tests: | |
name: Tests | |
needs: [platforms, build-base] | |
if: always() && needs.platforms.result == 'success' && needs.build-base.result == 'success' | |
strategy: | |
fail-fast: false | |
matrix: | |
platform: [ubuntu20, ubuntu22] | |
runs-on: ["self-hosted", "enf-x86-hightier"] | |
container: | |
image: ${{fromJSON(needs.platforms.outputs.p)[matrix.platform].image}} | |
options: --security-opt seccomp=unconfined | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Download builddir | |
uses: actions/download-artifact@v3 | |
with: | |
name: ${{matrix.platform}}-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 | |
np-tests: | |
name: NP Tests | |
needs: [platforms, build-base] | |
if: always() && needs.platforms.result == 'success' && needs.build-base.result == 'success' | |
strategy: | |
fail-fast: false | |
matrix: | |
platform: [ubuntu20, ubuntu22] | |
runs-on: ["self-hosted", "enf-x86-midtier"] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Download builddir | |
uses: actions/download-artifact@v3 | |
with: | |
name: ${{matrix.platform}}-build | |
- name: Run tests in parallel containers | |
uses: ./.github/actions/parallel-ctest-containers | |
with: | |
container: ${{fromJSON(needs.platforms.outputs.p)[matrix.platform].image}} | |
error-log-paths: '["build/etc", "build/var", "build/leap-ignition-wd", "build/TestLogs"]' | |
log-tarball-prefix: ${{matrix.platform}} | |
tests-label: nonparallelizable_tests | |
test-timeout: 420 | |
- name: Upload logs from failed tests | |
uses: actions/upload-artifact@v3 | |
if: failure() | |
with: | |
name: ${{matrix.platform}}-np-logs | |
path: '*-logs.tar.gz' | |
lr-tests: | |
name: LR Tests | |
needs: [platforms, build-base] | |
if: always() && needs.platforms.result == 'success' && needs.build-base.result == 'success' | |
strategy: | |
fail-fast: false | |
matrix: | |
platform: [ubuntu20, ubuntu22] | |
runs-on: ["self-hosted", "enf-x86-lowtier"] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Download builddir | |
uses: actions/download-artifact@v3 | |
with: | |
name: ${{matrix.platform}}-build | |
- name: Run tests in parallel containers | |
uses: ./.github/actions/parallel-ctest-containers | |
with: | |
container: ${{fromJSON(needs.platforms.outputs.p)[matrix.platform].image}} | |
error-log-paths: '["build/etc", "build/var", "build/leap-ignition-wd", "build/TestLogs"]' | |
log-tarball-prefix: ${{matrix.platform}} | |
tests-label: long_running_tests | |
test-timeout: 1800 | |
- name: Upload logs from failed tests | |
uses: actions/upload-artifact@v3 | |
if: failure() | |
with: | |
name: ${{matrix.platform}}-lr-logs | |
path: '*-logs.tar.gz' | |
libtester-tests: | |
name: libtester tests | |
needs: [platforms, build-base, v, dev-package] | |
if: always() && needs.platforms.result == 'success' && needs.v.result == 'success' && needs.dev-package.result == 'success' | |
strategy: | |
fail-fast: false | |
matrix: | |
platform: [ubuntu20, ubuntu22] | |
test: [build-tree, make-dev-install, deb-install] | |
runs-on: ["self-hosted", "enf-x86-midtier"] | |
container: ${{ matrix.test != 'deb-install' && fromJSON(needs.platforms.outputs.p)[matrix.platform].image || matrix.platform == 'ubuntu20' && 'ubuntu:focal' || 'ubuntu:jammy' }} | |
env: | |
DEBIAN_FRONTEND: noninteractive | |
TZ: Etc/UTC | |
steps: | |
- name: Update Package Index & Upgrade Packages | |
run: | | |
apt-get update | |
apt-get upgrade -y | |
# LEAP | |
- if: ${{ matrix.test != 'deb-install' }} | |
name: Clone leap | |
uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
- if: ${{ matrix.test != 'deb-install' }} | |
name: Download leap builddir | |
uses: actions/download-artifact@v3 | |
with: | |
name: ${{matrix.platform}}-build | |
- if: ${{ matrix.test != 'deb-install' }} | |
name: Extract leap build | |
run: | | |
zstdcat build.tar.zst | tar x | |
- if: ${{ matrix.test == 'build-tree' }} | |
name: Set leap_DIR env var | |
run: | | |
echo "leap_DIR=$PWD/build/lib/cmake/leap" >> "$GITHUB_ENV" | |
- if: ${{ matrix.test == 'make-dev-install' }} | |
name: leap dev-install | |
run: | | |
cmake --install build | |
cmake --install build --component dev | |
- if: ${{ matrix.test == 'make-dev-install' }} | |
name: Delete leap artifacts | |
run: | | |
rm -r * | |
- if: ${{ matrix.test == 'deb-install' }} | |
name: Download leap-dev | |
uses: actions/download-artifact@v3 | |
with: | |
name: leap-dev-${{matrix.platform}}-amd64 | |
- if: ${{ matrix.test == 'deb-install' }} | |
name: Install leap-dev Package | |
run: | | |
apt-get install -y ./*.deb | |
rm ./*.deb | |
# CDT | |
- name: Download cdt | |
uses: AntelopeIO/asset-artifact-download-action@v3 | |
with: | |
owner: AntelopeIO | |
repo: cdt | |
file: 'cdt_.*amd64.deb' | |
target: '${{needs.v.outputs.cdt-target}}' | |
prereleases: ${{fromJSON(needs.v.outputs.cdt-prerelease)}} | |
artifact-name: cdt_ubuntu_package_amd64 | |
- name: Install cdt Packages | |
run: | | |
apt-get install -y ./*.deb | |
rm ./*.deb | |
# Reference Contracts | |
- name: checkout eos-system-contracts | |
uses: actions/checkout@v3 | |
with: | |
repository: eosnetworkfoundation/eos-system-contracts | |
path: eos-system-contracts | |
ref: '${{needs.v.outputs.eos-system-contracts-ref}}' | |
- if: ${{ matrix.test == 'deb-install' }} | |
name: Install eos-system-contracts deps | |
run: | | |
apt-get -y install cmake build-essential | |
- name: Build & Test eos-system-contracts | |
run: | | |
cmake -S eos-system-contracts -B eos-system-contracts/build -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTS=On -DSYSTEM_ENABLE_LEAP_VERSION_CHECK=Off -DSYSTEM_ENABLE_CDT_VERSION_CHECK=Off | |
cmake --build eos-system-contracts/build -- -j $(nproc) | |
cd eos-system-contracts/build/tests | |
ctest --output-on-failure -j $(nproc) | |
all-passing: | |
name: All Required Tests Passed | |
needs: [dev-package, tests, np-tests, libtester-tests] | |
if: always() | |
runs-on: ubuntu-latest | |
steps: | |
- if: needs.dev-package.result != 'success' || needs.tests.result != 'success' || needs.np-tests.result != 'success' || needs.libtester-tests.result != 'success' | |
run: false |