Skip to content

Commit

Permalink
Build the Docker images and use them for system-testing
Browse files Browse the repository at this point in the history
Signed-off-by: Benoit Donneaux <[email protected]>
  • Loading branch information
btlogy committed Dec 2, 2024
1 parent 9dab64a commit fa68229
Show file tree
Hide file tree
Showing 3 changed files with 154 additions and 18 deletions.
4 changes: 3 additions & 1 deletion .circleci/run-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -95,5 +95,7 @@ if [ -n "${ARTIFACTS}" ]; then
# Create a junitxml results area.
mkdir -p "$(dirname "${JUNITXML}")"

"${WORKDIR}/${TAHOE_LAFS_TOX_ENVIRONMENT}/bin/subunit2junitxml" < "${SUBUNIT2}" > "${JUNITXML}" || "${alternative}"
"${WORKDIR}/${TAHOE_LAFS_TOX_ENVIRONMENT}/bin/subunit2junitxml" --help
"${WORKDIR}/${TAHOE_LAFS_TOX_ENVIRONMENT}/bin/subunit2junitxml" \
-o "${JUNITXML}" < "${SUBUNIT2}" || "${alternative}"
fi
166 changes: 150 additions & 16 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,14 @@ jobs:
matrix:
include:
- os: macos-12
python-version: "3.12"
python_version: "3.12"
# We only support PyPy on Linux at the moment.
- os: ubuntu-latest
python-version: "pypy-3.9"
python_version: "pypy-3.9"
- os: ubuntu-latest
python-version: "3.12"
python_version: "3.12"
- os: windows-latest
python-version: "3.12"
python_version: "3.12"

steps:
# See https://github.com/actions/checkout. A fetch-depth of 0
Expand All @@ -63,10 +63,10 @@ jobs:
with:
fetch-depth: 0

- name: Set up Python ${{ matrix.python-version }}
- name: Set up Python ${{ matrix.python_version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
python_version: ${{ matrix.python_version }}
cache: 'pip' # caching pip dependencies

- name: Install Python packages
Expand Down Expand Up @@ -120,7 +120,7 @@ jobs:
# Every source of coverage reports needs a unique "flag name".
# Construct one by smashing a few variables from the matrix together
# here.
COVERALLS_FLAG_NAME: "run-${{ matrix.os }}-${{ matrix.python-version }}"
COVERALLS_FLAG_NAME: "run-${{ matrix.os }}-${{ matrix.python_version }}"
# Mark the data as just one piece of many because we have more than
# one instance of this job (Windows, macOS) which collects and
# reports coverage. This is necessary to cause Coveralls to merge
Expand Down Expand Up @@ -162,13 +162,13 @@ jobs:
- ubuntu-20.04
- macos-12
- windows-latest
python-version:
python_version:
- "3.11"
force-foolscap:
- false
include:
- os: ubuntu-20.04
python-version: "3.12"
python_version: "3.12"
force-foolscap: true
steps:

Expand All @@ -179,7 +179,7 @@ jobs:
# TODO: See https://tahoe-lafs.org/trac/tahoe-lafs/ticket/3744.
# We have to use an older version of Tor for running integration
# tests on macOS.
- name: Install Tor [macOS, ${{ matrix.python-version }} ]
- name: Install Tor [macOS, ${{ matrix.python_version }} ]
if: ${{ contains(matrix.os, 'macos') }}
run: |
brew install tor
Expand All @@ -195,10 +195,10 @@ jobs:
with:
fetch-depth: 0

- name: Set up Python ${{ matrix.python-version }}
- name: Set up Python ${{ matrix.python_version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
python_version: ${{ matrix.python_version }}
cache: 'pip' # caching pip dependencies

- name: Install Python packages
Expand Down Expand Up @@ -236,6 +236,140 @@ jobs:
name: integration.eliot-${{ matrix.run-on }}.json
path: integration.eliot.json

systemtest:
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
image:
- distro: "debian"
tag: "11"
python_version: "3.9"
tox_environment: "py39"
- distro: "ubuntu"
tag: "20.04"
python_version: "3.9"
tox_environment: "py39"
- distro: "ubuntu"
tag: "22.04"
python_version: "3.10"
tox_environment: "py310"
- distro: "fedora"
tag: "35"
python_version: "3.10"
tox_environment: "py310"
- distro: "oraclelinux"
tag: "8"
python_version: "3.9"
tox_environment: "py39"
env:
CONTEXT: .circleci
PREFIX: tahoelafsci
TAG: ${{ matrix.image.tag }}
PYTHON_VERSION: ${{ matrix.image.python_version }}
DISTRO: ${{ matrix.image.distro }}
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Verify Docker
run: |
docker run --rm hello-world:latest > /dev/null
docker rmi hello-world:latest > /dev/null
docker version
- name: Cache docker images
uses: ScribeMD/[email protected]
with:
key: |
docker-${{ matrix.image.distro }}_${{ matrix.image.tag }}-py${{ matrix.image.python_version }}-${{ hashFiles(
format('{0}/Dockerfile.{1}', env.CONTEXT, matrix.image.distro)
) }}
- name: Build Docker image
run: |
docker images --filter "reference=${PREFIX}/${DISTRO}"
docker images --filter "reference=${PREFIX}/${DISTRO}:${TAG}-py${PYTHON_VERSION}" \
--quiet | grep -v "^$" \
|| docker \
build \
--build-arg TAG=${TAG} \
--build-arg PYTHON_VERSION=${PYTHON_VERSION} \
-t ${PREFIX}/${DISTRO}:${TAG}-py${PYTHON_VERSION} \
-f ${CONTEXT}/Dockerfile.${DISTRO} \
. \
&& docker images --filter "reference=${PREFIX}/${DISTRO}"
- name: Prepare environment variables
run: |
cat > secret-env-plain <<-EOF
# In general, the test suite is not allowed to fail while the job
# succeeds. But you can set this to "yes" if you want it to be
# otherwise.
ALLOWED_FAILURE="no"
# Tell Hypothesis which configuration we want it to use.
TAHOE_LAFS_HYPOTHESIS_PROFILE="ci"
# Tell the C runtime things about character encoding (mainly to do with
# filenames and argv).
LANG="en_US.UTF-8"
# Select a tox environment to run for this job.
TAHOE_LAFS_TOX_ENVIRONMENT=${{ matrix.image.tox_environment }}
# Additional arguments to pass to tox.
TAHOE_LAFS_TOX_ARGS=""
# The path in which test artifacts will be placed.
ARTIFACTS_OUTPUT_PATH="/tmp/artifacts"
# Convince all of our pip invocations to look at the cached wheelhouse
# we maintain.
WHEELHOUSE_PATH="/tmp/wheelhouse"
PIP_FIND_LINKS="file:///tmp/wheelhouse"
# Upload the coverage report.
UPLOAD_COVERAGE=""
EOF
- name: Start the container
id: run
run: |
CID=$(docker run \
--rm --tty --detach \
-v .:/tmp/project \
-w /tmp/project \
--env-file secret-env-plain \
"${PREFIX}/${DISTRO}:${TAG}-py${PYTHON_VERSION}" \
)
docker exec $CID python3 -VV
docker exec $CID env
echo "cid=$CID" >> $GITHUB_OUTPUT
- name: Setup virtualenv
run: |
docker exec \
${{ steps.run.outputs.cid }} \
/tmp/project/.circleci/setup-virtualenv.sh \
"/tmp/venv" \
"/tmp/project" \
"\${WHEELHOUSE_PATH}" \
"\${TAHOE_LAFS_TOX_ENVIRONMENT}" \
"\${TAHOE_LAFS_TOX_ARGS}"
- name: Run test suite
run: |
docker exec \
${{ steps.run.outputs.cid }} \
/tmp/project/.circleci/run-tests.sh \
"/tmp/venv" \
"/tmp/project" \
"\${ALLOWED_FAILURE}" \
"\${ARTIFACTS_OUTPUT_PATH}" \
"\${TAHOE_LAFS_TOX_ENVIRONMENT}" \
"\${TAHOE_LAFS_TOX_ARGS}"
timeout-minutes: 20

- name: Stop the container
if: ${{ always() }}
run: |
docker stop --time 3 \
${{ steps.run.outputs.cid }}
packaging:
runs-on: ${{ matrix.os }}
strategy:
Expand All @@ -245,7 +379,7 @@ jobs:
- macos-12
- windows-latest
- ubuntu-latest
python-version:
python_version:
- 3.9

steps:
Expand All @@ -255,10 +389,10 @@ jobs:
with:
fetch-depth: 0

- name: Set up Python ${{ matrix.python-version }}
- name: Set up Python ${{ matrix.python_version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
python_version: ${{ matrix.python_version }}
cache: 'pip' # caching pip dependencies

- name: Install Python packages
Expand All @@ -279,5 +413,5 @@ jobs:
- name: Upload PyInstaller package
uses: actions/upload-artifact@v4
with:
name: Tahoe-LAFS-${{ matrix.os }}-Python-${{ matrix.python-version }}
name: Tahoe-LAFS-${{ matrix.os }}-Python-${{ matrix.python_version }}
path: dist/Tahoe-LAFS-*-*.*
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ zope.interface-*.egg
/misc/python3/results.xml
/misc/python3/results.subunit2

# This is the plaintext of the private environment needed for some CircleCI
# This is the plaintext of the private environment needed for some CI
# operations. It's never supposed to be checked in.
secret-env-plain

Expand Down

0 comments on commit fa68229

Please sign in to comment.