Skip to content

Commit

Permalink
CI: Add further container-based compatibility tests
Browse files Browse the repository at this point in the history
Signed-off-by: Hanno Becker <[email protected]>
  • Loading branch information
hanno-becker committed Dec 22, 2024
1 parent 9f3aa7c commit 4686a2c
Show file tree
Hide file tree
Showing 7 changed files with 335 additions and 56 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# SPDX-License-Identifier: Apache-2.0

name: Setup ubuntu
description: Setup ubuntu
name: Dependencies (apt)
description: Install dependencies via apt

inputs:
packages:
Expand Down
37 changes: 37 additions & 0 deletions .github/actions/setup-os/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# SPDX-License-Identifier: Apache-2.0

name: Setup OS
description: Setup OS

inputs:
packages:
description: Space-separated list of additional packages to install
required: false
default: ''
sudo:
required: false
default: 'sudo'

runs:
using: composite
steps:
- name: Detect OS
shell: bash
run: |
if (which yum > /dev/null); then
echo PKG="yum" >> $GITHUB_ENV
elif (which apt > /dev/null); then
echo PKG="apt" >> $GITHUB_ENV
fi
- name: Setup via yum
if: ${{ env.PKG == 'yum' }}
uses: ./.github/actions/setup-yum
with:
packages: ${{ inputs.packages }}
sudo: ${{ inputs.sudo }}
- name: Setup via apt
if: ${{ env.PKG == 'apt' }}
uses: ./.github/actions/setup-apt
with:
packages: ${{ inputs.packages }}
sudo: ${{ inputs.sudo }}
34 changes: 34 additions & 0 deletions .github/actions/setup-yum/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# SPDX-License-Identifier: Apache-2.0

name: Dependencies (yum)
description: Install dependencies via yum

inputs:
packages:
description: Space-separated list of additional packages to install
required: false
default: ''
sudo:
required: false
default: 'sudo'

runs:
using: composite
steps:
- name: Install base packages
shell: bash
run: |
${{ inputs.sudo }} yum install make git python3-pip -y
${{ inputs.sudo }} pip3 install virtualenv
- name: Install additional packages
if: ${{ inputs.packages != ''}}
shell: bash
run: |
${{ inputs.sudo }} yum install ${{ inputs.packages }} -y
- name: Setup Python venv
shell: bash
run: |
virtualenv venv
source venv/bin/activate
python3 -m pip install -r requirements.txt
echo "$(pwd)/venv/bin/" >> "$GITHUB_PATH"
2 changes: 1 addition & 1 deletion .github/workflows/bench_ec2_reusable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ jobs:
if: ${{ inputs.compiler != '' }}
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: ./.github/actions/setup-ubuntu
- uses: ./.github/actions/setup-apt
with:
packages: ${{ inputs.additional_packages }}
- name: Set compiler
Expand Down
92 changes: 74 additions & 18 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ jobs:
OPT=0 make quickcheck >/dev/null
make clean >/dev/null
OPT=1 make quickcheck >/dev/null
- uses: ./.github/actions/setup-ubuntu
- uses: ./.github/actions/setup-apt
- name: tests func
run: |
./scripts/tests func
Expand Down Expand Up @@ -93,7 +93,7 @@ jobs:
OPT=0 CPPFLAGS=-std=c90 make quickcheck >/dev/null
make clean >/dev/null
OPT=1 CPPFLAGS=-std=c90 make quickcheck >/dev/null
- uses: ./.github/actions/setup-ubuntu
- uses: ./.github/actions/setup-apt
- name: tests func
run: |
CPPFLAGS="-std=c90" ./scripts/tests func
Expand Down Expand Up @@ -417,9 +417,9 @@ jobs:
permissions:
contents: 'read'
id-token: 'write'
uses: ./.github/workflows/ci_ec2_reusable.yml
needs: [quickcheck, quickcheck-windows, quickcheck-c90, quickcheck-lib, examples, lint, lint-markdown-link]
if: github.repository_owner == 'pq-code-package' && !github.event.pull_request.head.repo.fork
uses: ./.github/workflows/ci_ec2_reusable.yml
with:
name: ${{ matrix.target.name }}
ec2_instance_type: ${{ matrix.target.ec2_instance_type }}
Expand All @@ -434,35 +434,91 @@ jobs:
lint: false
verbose: true
secrets: inherit
compatibility_tests:
strategy:
max-parallel: 4
fail-fast: false
matrix:
container:
- id: debian:bullseye
- id: debian:bookworm
name: Compatibility tests (${{ matrix.container.id }})
runs-on: ubuntu-latest
needs: [quickcheck, quickcheck-windows, quickcheck-c90, quickcheck-lib, examples, lint, lint-markdown-link]
container:
${{ matrix.container.id }}
steps:
# We're not using the checkout action here because on it's not supported
# on all containers we want to test. Resort to a manual checkout.

# We can't hoist this into an action since calling an action can only
# be done after checkout.
- name: Manual checkout
shell: bash
run: |
if (which yum > /dev/null); then
yum install git -y
elif (which apt > /dev/null); then
apt update
apt install git -y
fi
git config --global --add safe.directory $GITHUB_WORKSPACE
git init
git remote add origin $GITHUB_SERVER_URL/$GITHUB_REPOSITORY
git fetch origin --depth 1 $GITHUB_SHA
git checkout FETCH_HEAD
- uses: ./.github/actions/setup-os
with:
sudo: ""
- name: make quickcheck
run: |
OPT=0 make quickcheck >/dev/null
make clean >/dev/null
OPT=1 make quickcheck >/dev/null
- name: Functional Tests
uses: ./.github/actions/multi-functest
with:
nix-shell: ""
gh_token: ${{ secrets.AWS_GITHUB_TOKEN }}
ec2_compatibilitytests:
strategy:
max-parallel: 12
fail-fast: false
matrix:
container:
- id: ubuntu-22.04:gcc-12x
- id: ubuntu-22.04:gcc-11x
- id: ubuntu-20.04:gcc-8x
- id: ubuntu-20.04:gcc-7x
- id: ubuntu-20.04:clang-9x
- id: ubuntu-20.04:clang-8x
- id: ubuntu-20.04:clang-7x-bm-framework
- id: ubuntu-20.04:clang-7x
- id: ubuntu-20.04:clang-10x
- id: ubuntu-22.04:base
- id: ubuntu-20.04:base
- id: amazonlinux-2-aarch:base
- id: amazonlinux-2-aarch:gcc-7x
- id: amazonlinux-2-aarch:clang-7x
- id: amazonlinux-2023-aarch:base
- id: amazonlinux-2023-aarch:gcc-11x
- id: amazonlinux-2023-aarch:clang-15x
- id: amazonlinux-2023-aarch:clang-15x-sanitizer
# - id: amazonlinux-2023-aarch:cryptofuzz Not yet supported
- id: ubuntu-22.04-aarch:gcc-12x
- id: ubuntu-22.04-aarch:gcc-11x
- id: ubuntu-20.04-aarch:gcc-8x
- id: ubuntu-20.04-aarch:gcc-7x
- id: ubuntu-20.04-aarch:clang-9x
- id: ubuntu-20.04-aarch:clang-8x
- id: ubuntu-20.04-aarch:clang-7x-bm-framework
- id: ubuntu-20.04-aarch:clang-7x
- id: ubuntu-20.04-aarch:clang-10x
- id: ubuntu-22.04-aarch:base
- id: ubuntu-20.04-aarch:base
name: Compatibility tests (${{ matrix.container.id }})
needs: [ec2_functests]
needs: [quickcheck, quickcheck-windows, quickcheck-c90, quickcheck-lib, examples, lint, lint-markdown-link]
permissions:
contents: 'read'
id-token: 'write'
uses: ./.github/workflows/ci_ec2_reusable.yml
uses: ./.github/workflows/ci_ec2_container.yml
if: github.repository_owner == 'pq-code-package' && !github.event.pull_request.head.repo.fork
with:
container: ${{ matrix.container.id }}
name: ${{ matrix.container.id }}
ec2_instance_type: c7g.medium
ec2_instance_type: t4g.small
ec2_ami: ubuntu-latest (custom AMI)
ec2_ami_id: ami-0f4b26c5372aa0525 # Has docker images preinstalled
ec2_ami_id: ami-0c9bc1901ef0d1066 # Has docker images preinstalled
compile_mode: native
opt: all
functest: true
Expand Down
Loading

0 comments on commit 4686a2c

Please sign in to comment.