From 09101e6ec8f4c7d8eaf64180fcc90a3eed41469b Mon Sep 17 00:00:00 2001 From: dumol Date: Mon, 25 Nov 2024 13:37:00 +0200 Subject: [PATCH] [#47] Re-enable `compat` tests. (#69) * Use production packages. * Updated populating cache for compat tests. * Readded compat tests through GHA. * Readded compat tests through GHA, take 2. * Readded compat tests through GHA, take 3. * Run docker builds and tests as a regular user. * Run docker builds and tests as a regular user, take 2 * Run docker builds and tests as a regular user, take 3 * Run docker builds and tests as a regular user, take 4 * Run docker builds and tests as a regular user, take 5 * Put paxctl where it's easier to find. * Also try test_ci2 compat tests. * Install sudo for elevated tests. * Final tweaks. * Final tweaks, take 2. * Final tweaks, take 3. * Changes after own review. * Changes after own review, take two. * Changes after own review, take three. --- .github/workflows/bare.yaml | 22 +++++++++++++++++++++ .github/workflows/docker.yaml | 32 ++++++++++++++++++++++++------- build.sh | 36 ++++++++++++++++++++++------------- pkg_checks.sh | 2 +- pythia.conf | 4 ++-- 5 files changed, 73 insertions(+), 23 deletions(-) diff --git a/.github/workflows/bare.yaml b/.github/workflows/bare.yaml index cc238d46..9c1fb32b 100644 --- a/.github/workflows/bare.yaml +++ b/.github/workflows/bare.yaml @@ -14,6 +14,9 @@ concurrency: group: bare-${{ github.ref }} cancel-in-progress: true +env: + CI: 'true' + jobs: windows: # The type of runner that the job will run on @@ -40,6 +43,13 @@ jobs: timeout-minutes: 5 run: bash ./build.sh test + - name: Test compat + timeout-minutes: 10 + env: + USER: runneradmin + CODECOV_TOKEN: local + run: bash ./build.sh compat + # Commit changed requirements.txt back to the repository - uses: chevah/git-auto-commit-action@HEAD with: @@ -127,6 +137,12 @@ jobs: timeout-minutes: 5 run: ./build.sh test + - name: Test compat + timeout-minutes: 10 + env: + CODECOV_TOKEN: local + run: ./build.sh compat + - name: Upload testing package timeout-minutes: 5 run: | @@ -161,6 +177,12 @@ jobs: timeout-minutes: 5 run: ./build.sh test + - name: Test compat + timeout-minutes: 10 + env: + CODECOV_TOKEN: local + run: ./build.sh compat + - name: Upload testing package timeout-minutes: 5 run: | diff --git a/.github/workflows/docker.yaml b/.github/workflows/docker.yaml index dd10ccf8..bb7f5107 100644 --- a/.github/workflows/docker.yaml +++ b/.github/workflows/docker.yaml @@ -15,6 +15,8 @@ concurrency: group: docker-${{ github.ref }} cancel-in-progress: true +env: + CI: 'true' # Using a job name that doesn't contain the OS name, to minimize the risk of # confusion with the OS names of the containers, which are the relevant ones. @@ -35,16 +37,16 @@ jobs: if: startsWith(matrix.container, 'alpine') run: | apk upgrade -U - apk add git curl bash gcc make m4 patch musl-dev linux-headers lddtree shadow openssh-client file unzip perl g++ musl-locales dejagnu + apk add git curl bash gcc make m4 patch musl-dev linux-headers lddtree shadow openssh-client file unzip perl g++ musl-locales dejagnu sudo apk del util-linux-dev - curl --output /usr/local/bin/paxctl https://bin.chevah.com:20443/third-party-stuff/alpine/paxctl-3.12 - chmod +x /usr/local/bin/paxctl + curl --output /usr/bin/paxctl https://bin.chevah.com:20443/third-party-stuff/alpine/paxctl-3.12 + chmod +x /usr/bin/paxctl - name: Amazon setup if: startsWith(matrix.container, 'amazonlinux') run: | yum -y upgrade - yum -y install git-core gcc make m4 patch tar unzip perl perl-Test-Simple perl-IPC-Cmd xz gcc-c++ dejagnu bzip2 + yum -y install git-core gcc make m4 patch tar unzip perl perl-Test-Simple perl-IPC-Cmd xz gcc-c++ dejagnu bzip2 sudo # To avoid linking against libdb and gdmb libraries on Amazon Linux 2. # Can't simply uninstall libdb-devel and gdmb-devel, they are required by perl-IPC-Cmd. rm -v /usr/include/libdb/db.h @@ -57,25 +59,41 @@ jobs: run: | apt update apt --yes dist-upgrade - apt --yes install wget curl gcc make m4 patch openssh-client unzip git libtest-simple-perl xz-utils g++ dejagnu + apt --yes install wget curl gcc make m4 patch openssh-client unzip git libtest-simple-perl xz-utils g++ dejagnu sudo + # actions/checkout doesn't work on Amazon Linux 2, requires glibc 2.27. - name: Clone repo independently run: | git clone https://github.com/chevah/pythia.git cd pythia git checkout ${GITHUB_HEAD_REF} + - name: Chevah user setup + run: | + useradd -g adm -s /bin/bash -m chevah + echo '%adm ALL=NOPASSWD: ALL' > /etc/sudoers + - name: Build Pythia timeout-minutes: 30 run: | + chown -R chevah pythia cd pythia - ./build.sh build + su chevah -c "./build.sh build" - name: Test Pythia timeout-minutes: 5 run: | cd pythia - ./build.sh test + su chevah -c "./build.sh test" + + - name: Test compat + timeout-minutes: 10 + env: + USER: chevah + CODECOV_TOKEN: local + run: | + cd pythia + su chevah -c "./build.sh compat" # Using `~/` is problematic under Docker, use `/root/`. # Remove key in same step to avoid leaving it on disk if publishing fails. diff --git a/build.sh b/build.sh index 864b31bc..0f152f08 100755 --- a/build.sh +++ b/build.sh @@ -260,7 +260,7 @@ command_test() { # shellcheck disable=SC2034 # Only used through compgen. help_text_compat="Run the test suite from chevah/compat master." command_compat() { - local new_python_conf="$PYTHON_BUILD_VERSION.$PYTHIA_VERSION" + local new_python_ver="$PYTHON_BUILD_VERSION.$PYTHIA_VERSION" execute pushd "$BUILD_DIR" # This is quite hackish, as compat is arm-twisted to use the local version. @@ -268,20 +268,30 @@ command_compat() { echo "#### Running chevah's compat tests... ####" echo "## Removing any pre-existing compat code... ##" execute rm -rf compat/ + echo "## Cloning compat's master branch... ##" execute git clone https://github.com/chevah/compat.git --depth=1 -b master execute pushd compat - # Copy over current pythia stuff, as some changes might require it. - execute cp ../../pythia.{conf,sh} ./ - # Patch compat to use the newly-built Python, then copy it to cache/. - echo -e "\nPYTHON_CONFIGURATION=default@${new_python_conf}" >> pythia.conf - execute mkdir cache - execute cp -r ../"$PYTHON_BUILD_DIR" cache/ - # Make sure everything is done from scratch in the current dir. - unset CHEVAH_CACHE CHEVAH_BUILD - # Some tests might still fail due to causes not related to the new Python. - execute ./pythia.sh deps - execute ./pythia.sh test_ci - + # Make sure everything is done from scratch in the current dir. + echo "## Unsetting CHEVAH_CACHE and CHEVAH_BUILD... ##" + unset CHEVAH_CACHE CHEVAH_BUILD + # Copy over current pythia stuff, as some changes might require it. + echo "## Patching compat code to use current pythia version... ##" + execute cp ../../pythia.{conf,sh} ./ + # Patch compat to use the current's branch version. + echo -e "\nPYTHON_CONFIGURATION=default@${new_python_ver}" >>pythia.conf + execute mkdir cache + # Copy dist file to local cache, if existing. If not, maybe it's online. + cp ../../"$DIST_DIR"/"$PYTHON_BUILD_VERSION.$PYTHIA_VERSION"/* cache/ + # Some tests could fail due to causes not related to the new Python. + echo "## Getting compat deps... ##" + execute ./pythia.sh deps + echo "## Running normal compat tests... ##" + # Why not test_normal? See https://github.com/chevah/compat/issues/691. + execute ./pythia.sh test -vs normal + if [ "${CI:-}" = "true" ]; then + echo "## Running ci2 compat tests... ##" + execute ./pythia.sh test_ci2 + fi execute popd echo "::endgroup::" } diff --git a/pkg_checks.sh b/pkg_checks.sh index 38026f4a..1d0102e5 100644 --- a/pkg_checks.sh +++ b/pkg_checks.sh @@ -55,7 +55,7 @@ case "$OS" in linux*) if [ -x /sbin/apk ]; then # Assumes Alpine Linux 3.15. - CHECK_CMD=(apk info -q -e) + CHECK_CMD=(/sbin/apk info -q -e) PACKAGES="$APK_PKGS" elif [ -x /usr/bin/dpkg ]; then # Assumes Ubuntu Linux 16.04. diff --git a/pythia.conf b/pythia.conf index e78a1d03..fa3ce3ad 100644 --- a/pythia.conf +++ b/pythia.conf @@ -1,7 +1,7 @@ # When building a new major Python version, e.g. 3.11->3.12, # update this in advance (e.g. use "default@3.12.0.deadbeef"), # and remove BUILD_ENV_* files (e.g. with `./build.sh clean -a`). -PYTHON_CONFIGURATION="default@3.12.7.ac6595f" +PYTHON_CONFIGURATION="default@3.12.7.bb41ace" # This is defined as a Bash array of options to be passed to commands. BASE_REQUIREMENTS=("chevah-brink==1.0.15" "paver==1.3.4") # Use our private PyPi server instead of the default one set in pythia.sh. @@ -9,6 +9,6 @@ PIP_INDEX_URL="https://bin.chevah.com:20443/pypi/simple" # Use our production server instead of the GitHub releases set by default. BINARY_DIST_URI="https://bin.chevah.com:20443/production" # For testing packages, make sure this one is the last uncommented instance: -BINARY_DIST_URI="https://bin.chevah.com:20443/testing" +#BINARY_DIST_URI="https://bin.chevah.com:20443/testing" # This directory is used by the Python runtime. CHEVAH_BUILD_DIR="build-py3"