Skip to content

Commit

Permalink
[#47] Re-enable compat tests. (#69)
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
dumol authored Nov 25, 2024
1 parent bb41ace commit 09101e6
Show file tree
Hide file tree
Showing 5 changed files with 73 additions and 23 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/bare.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down Expand Up @@ -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: |
Expand Down Expand Up @@ -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: |
Expand Down
32 changes: 25 additions & 7 deletions .github/workflows/docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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
Expand All @@ -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.
Expand Down
36 changes: 23 additions & 13 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -260,28 +260,38 @@ 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.
echo "::group::Compat tests"
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::"
}
Expand Down
2 changes: 1 addition & 1 deletion pkg_checks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions pythia.conf
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# When building a new major Python version, e.g. 3.11->3.12,
# update this in advance (e.g. use "[email protected]"),
# and remove BUILD_ENV_* files (e.g. with `./build.sh clean -a`).
PYTHON_CONFIGURATION="[email protected].ac6595f"
PYTHON_CONFIGURATION="[email protected].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.
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"

0 comments on commit 09101e6

Please sign in to comment.