src/sage/rings/polynomial: Modularization fix, # needs #2189
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: | ||
pull_request: | ||
merge_group: | ||
push: | ||
branches: | ||
- master | ||
- develop | ||
# Ignore pushes on tags to prevent two uploads of codecov reports | ||
tags-ignore: ['**'] | ||
workflow_dispatch: | ||
# Allow to run manually | ||
inputs: | ||
platform: | ||
description: 'Platform' | ||
required: true | ||
default: 'ubuntu-focal' | ||
packages: | ||
description: 'Platform' | ||
required: true | ||
default: 'standard' | ||
docker_tag: | ||
description: 'Docker tag' | ||
required: true | ||
default: 'dev' | ||
concurrency: | ||
# Cancel previous runs of this workflow for the same branch | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
env: | ||
# Adapted from docker.yml | ||
TOX_ENV: "docker-${{ github.event.inputs.platform || 'ubuntu-focal-standard' }}-incremental" | ||
BUILD_IMAGE: "localhost:5000/${{ github.repository }}/sage-${{ github.event.inputs.platform || 'ubuntu-focal-standard' }}-with-targets:ci" | ||
FROM_DOCKER_REPOSITORY: "ghcr.io/sagemath/sage/" | ||
FROM_DOCKER_TARGET: "with-targets" | ||
FROM_DOCKER_TAG: ${{ github.event.inputs.docker_tag || 'dev'}} | ||
EXTRA_CONFIGURE_ARGS: --enable-fat-binary | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
services: | ||
# https://docs.docker.com/build/ci/github-actions/local-registry/ | ||
registry: | ||
image: registry:2 | ||
ports: | ||
- 5000:5000 | ||
steps: | ||
- name: Maximize build disk space | ||
uses: easimon/maximize-build-space@v8 | ||
with: | ||
# need space in /var for Docker images | ||
root-reserve-mb: 40000 | ||
remove-dotnet: true | ||
remove-android: true | ||
remove-haskell: true | ||
remove-codeql: true | ||
remove-docker-images: true | ||
- name: Checkout | ||
id: checkout | ||
uses: actions/checkout@v4 | ||
- name: Install test prerequisites | ||
# From docker.yml | ||
run: | | ||
sudo DEBIAN_FRONTEND=noninteractive apt-get update | ||
sudo DEBIAN_FRONTEND=noninteractive apt-get install tox | ||
sudo apt-get clean | ||
df -h | ||
- name: Merge CI fixes from sagemath/sage | ||
# From docker.yml | ||
# This step needs to happen after the commit sha is put in DOCKER_TAG | ||
# so that multi-stage builds can work correctly. | ||
run: | | ||
.ci/merge-fixes.sh | ||
env: | ||
GH_TOKEN: ${{ github.token }} | ||
SAGE_CI_FIXES_FROM_REPOSITORIES: ${{ vars.SAGE_CI_FIXES_FROM_REPOSITORIES }} | ||
# Building | ||
- name: Generate Dockerfile | ||
# From docker.yml | ||
run: | | ||
tox -e ${{ env.TOX_ENV }} | ||
cp .tox/${{ env.TOX_ENV }}/Dockerfile . | ||
env: | ||
# Only generate the Dockerfile, do not run 'docker build' here | ||
DOCKER_TARGETS: "" | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
with: | ||
driver-opts: network=host | ||
- name: Build Docker image | ||
id: image | ||
uses: docker/build-push-action@v5 | ||
with: | ||
# push and load may not be set together at the moment | ||
push: true | ||
load: false | ||
context: . | ||
tags: ${{ env.BUILD_IMAGE }} | ||
target: with-targets | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max | ||
build-args: | | ||
NUMPROC=4 | ||
USE_MAKEFLAGS=-k V=0 SAGE_NUM_THREADS=3 --output-sync=recurse | ||
TARGETS_PRE=build/make/Makefile | ||
TARGETS=ci-build-with-fallback | ||
- name: Start container | ||
run: | | ||
docker run --name BUILD -dit \ | ||
--mount type=bind,src=$(pwd),dst=$(pwd) \ | ||
--workdir $(pwd) \ | ||
${{ env.BUILD_IMAGE }} /bin/sh | ||
# Testing | ||
test-new: | ||
needs: [build] | ||
runs-on: ubuntu-latest | ||
container: ghcr.io/${{ github.repository }}/sage-${{ github.event.inputs.platform || 'ubuntu-focal' }}-${{ github.event.inputs.packages || 'packages' }}-with-targets:${{ github.sha }} | ||
steps: | ||
- name: Test changed files (sage -t --new) | ||
run: | | ||
export MAKE="make -j2 --output-sync=recurse" SAGE_NUM_THREADS=2 | ||
# We run tests with "sage -t --new"; this only tests the uncommitted changes. | ||
<<<<<<< HEAD | ||
./sage -t --new -p2 --format github | ||
shell: sh .ci/docker-exec-script.sh BUILD /sage {0} | ||
mod: | ||
runs-on: ubuntu-latest | ||
needs: [build] | ||
services: | ||
# https://docs.docker.com/build/ci/github-actions/local-registry/ | ||
registry: | ||
image: registry:2 | ||
ports: | ||
- 5000:5000 | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
targets: | ||
- sagemath_categories-check | ||
steps: | ||
- name: Maximize build disk space | ||
uses: easimon/maximize-build-space@v8 | ||
with: | ||
# need space in /var for Docker images | ||
root-reserve-mb: 40000 | ||
remove-dotnet: true | ||
remove-android: true | ||
remove-haskell: true | ||
remove-codeql: true | ||
remove-docker-images: true | ||
- name: Checkout | ||
id: checkout | ||
uses: actions/checkout@v4 | ||
- name: Install test prerequisites | ||
# From docker.yml | ||
run: | | ||
sudo DEBIAN_FRONTEND=noninteractive apt-get update | ||
sudo DEBIAN_FRONTEND=noninteractive apt-get install tox | ||
sudo apt-get clean | ||
df -h | ||
- name: Merge CI fixes from sagemath/sage | ||
# From docker.yml | ||
# This step needs to happen after the commit sha is put in DOCKER_TAG | ||
# so that multi-stage builds can work correctly. | ||
run: | | ||
.ci/merge-fixes.sh | ||
======= | ||
./sage -t --new -p2 | ||
working-directory: ./worktree-image | ||
>>>>>>> doctester-github-annotations--prod | ||
env: | ||
GH_TOKEN: ${{ github.token }} | ||
# Building | ||
- name: Generate Dockerfile | ||
# From docker.yml | ||
run: | | ||
tox -e ${{ env.TOX_ENV }} | ||
cp .tox/${{ env.TOX_ENV }}/Dockerfile . | ||
env: | ||
# Only generate the Dockerfile, do not run 'docker build' here | ||
DOCKER_TARGETS: "" | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
with: | ||
driver-opts: network=host | ||
- name: Build Docker image | ||
id: image | ||
uses: docker/build-push-action@v5 | ||
with: | ||
push: true | ||
load: false | ||
context: . | ||
tags: ${{ env.BUILD_IMAGE }} | ||
target: with-targets | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max | ||
build-args: | | ||
NUMPROC=4 | ||
USE_MAKEFLAGS=-k V=0 SAGE_NUM_THREADS=3 --output-sync=recurse | ||
TARGETS_PRE=build/make/Makefile | ||
TARGETS=ci-build-with-fallback | ||
- name: Start container | ||
run: | | ||
docker run --name BUILD -dit \ | ||
--mount type=bind,src=$(pwd),dst=$(pwd) \ | ||
--workdir $(pwd) \ | ||
${{ env.BUILD_IMAGE }} /bin/sh | ||
# Testing | ||
- name: Test modularized distributions | ||
run: | | ||
<<<<<<< HEAD | ||
export MAKE="make -j2 --output-sync=recurse" SAGE_NUM_THREADS=2 | ||
make V=0 tox-ensure && make ${{ matrix.targets }} | ||
shell: sh .ci/docker-exec-script.sh BUILD /sage {0} | ||
test-long: | ||
runs-on: ubuntu-latest | ||
needs: [build] | ||
services: | ||
# https://docs.docker.com/build/ci/github-actions/local-registry/ | ||
registry: | ||
image: registry:2 | ||
ports: | ||
- 5000:5000 | ||
steps: | ||
- name: Maximize build disk space | ||
uses: easimon/maximize-build-space@v8 | ||
with: | ||
# need space in /var for Docker images | ||
root-reserve-mb: 40000 | ||
remove-dotnet: true | ||
remove-android: true | ||
remove-haskell: true | ||
remove-codeql: true | ||
remove-docker-images: true | ||
- name: Checkout | ||
id: checkout | ||
uses: actions/checkout@v4 | ||
- name: Install test prerequisites | ||
# From docker.yml | ||
run: | | ||
sudo DEBIAN_FRONTEND=noninteractive apt-get update | ||
sudo DEBIAN_FRONTEND=noninteractive apt-get install tox | ||
sudo apt-get clean | ||
df -h | ||
- name: Merge CI fixes from sagemath/sage | ||
# From docker.yml | ||
# This step needs to happen after the commit sha is put in DOCKER_TAG | ||
# so that multi-stage builds can work correctly. | ||
run: | | ||
.ci/merge-fixes.sh | ||
======= | ||
./sage -python -m pip install coverage pytest-xdist | ||
./sage -python -m coverage run --rcfile=src/tox.ini -m pytest -c src/tox.ini --doctest-modules || true | ||
working-directory: ./worktree-image | ||
>>>>>>> doctester-github-annotations--prod | ||
env: | ||
GH_TOKEN: ${{ github.token }} | ||
# Building | ||
- name: Generate Dockerfile | ||
# From docker.yml | ||
run: | | ||
tox -e ${{ env.TOX_ENV }} | ||
cp .tox/${{ env.TOX_ENV }}/Dockerfile . | ||
env: | ||
# Only generate the Dockerfile, do not run 'docker build' here | ||
DOCKER_TARGETS: "" | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
with: | ||
driver-opts: network=host | ||
- name: Build Docker image | ||
id: image | ||
uses: docker/build-push-action@v5 | ||
with: | ||
push: true | ||
load: false | ||
context: . | ||
tags: ${{ env.BUILD_IMAGE }} | ||
target: with-targets | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max | ||
build-args: | | ||
NUMPROC=4 | ||
USE_MAKEFLAGS=-k V=0 SAGE_NUM_THREADS=3 --output-sync=recurse | ||
TARGETS_PRE=build/make/Makefile | ||
TARGETS=ci-build-with-fallback | ||
- name: Start container | ||
id: container | ||
run: | | ||
docker run --name BUILD -dit \ | ||
--mount type=bind,src=$(pwd),dst=$(pwd) \ | ||
--workdir $(pwd) \ | ||
${{ env.BUILD_IMAGE }} /bin/sh | ||
# Testing | ||
- name: Test all files (sage -t --all --long) | ||
run: | | ||
./sage -python -m pip install coverage | ||
./sage -python -m coverage run --rcfile=src/tox.ini src/bin/sage-runtests --all --long -p2 --format github --random-seed=286735480429121101562228604801325644303 | ||
shell: sh .ci/docker-exec-script.sh BUILD /sage {0} | ||
- name: Copy coverage results | ||
if: (success() || failure()) && steps.container.outcome == 'success' | ||
run: | | ||
./sage -python -m coverage combine --rcfile=src/tox.ini | ||
./sage -python -m coverage xml --rcfile=src/tox.ini | ||
mkdir -p coverage-report | ||
mv coverage.xml coverage-report/ | ||
shell: sh .ci/docker-exec-script.sh BUILD /sage {0} | ||
- name: Upload coverage to codecov | ||
if: (success() || failure()) && steps.container.outcome == 'success' | ||
uses: codecov/codecov-action@v3 | ||
with: | ||
directory: ./coverage-report |