|
| 1 | +name: Run Sage CI |
| 2 | +## |
| 3 | +## This GitHub Actions workflow uses the portability testing framework |
| 4 | +## of passagemath (https://github.com/passagemath). |
| 5 | +## |
| 6 | +## - Documentation: https://doc.sagemath.org/html/en/developer/portability_testing.html |
| 7 | +## |
| 8 | +## - Deployment of ci-sage.yml in upstream projects is tracked at |
| 9 | +## https://github.com/passagemath/passagemath/issues/704 |
| 10 | +## |
| 11 | +## - Contact: @passagemath/ci team on GitHub |
| 12 | +## |
| 13 | +## This GitHub Actions workflow provides: |
| 14 | +## |
| 15 | +## - portability testing, by building and testing this project on many platforms |
| 16 | +## (Linux variants and macOS), each with two configurations (installed packages), |
| 17 | +## |
| 18 | +## - continuous integration, by building and testing other software |
| 19 | +## that depends on this project. |
| 20 | +## |
| 21 | +## It runs on every push of a tag to the GitHub repository |
| 22 | +## and can also be invoked manually ("workflow_dispatch"). |
| 23 | +## |
| 24 | +## The testing can be monitored in the "Actions" tab of the GitHub repository. |
| 25 | +## |
| 26 | +## After all jobs have finished (or are canceled) and a short delay, |
| 27 | +## tar files of all logs are made available as "build artifacts". |
| 28 | +## |
| 29 | +## The workflow consists of two jobs: |
| 30 | +## |
| 31 | +## - First, it builds a source distribution of the project |
| 32 | +## and generates a script "update-pkgs.sh". It uploads them |
| 33 | +## as a build artifact named upstream. |
| 34 | +## |
| 35 | +## - Second, it checks out a copy of the SageMath source tree. |
| 36 | +## It downloads the upstream artifact and replaces the project's |
| 37 | +## package in the SageMath distribution by the newly packaged one |
| 38 | +## from the upstream artifact, by running the script "update-pkgs.sh". |
| 39 | +## Then it builds a small portion of the Sage distribution. |
| 40 | +## |
| 41 | +## Many copies of the second step are run in parallel for each of the tested |
| 42 | +## systems/configurations. |
| 43 | + |
| 44 | +on: |
| 45 | + push: |
| 46 | + tags: |
| 47 | + - '*' |
| 48 | + workflow_dispatch: |
| 49 | + # Allow to run manually |
| 50 | + |
| 51 | +concurrency: |
| 52 | + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} |
| 53 | + cancel-in-progress: true |
| 54 | + |
| 55 | +env: |
| 56 | + # Ubuntu packages to install so that the project's "make dist" can succeed |
| 57 | + DIST_PREREQ: git |
| 58 | + # Name of this project in the Sage distribution |
| 59 | + SPKG: macaulay2 |
| 60 | + REMOVE_PATCHES: "*" |
| 61 | + |
| 62 | +jobs: |
| 63 | + |
| 64 | + dist: |
| 65 | + runs-on: ubuntu-latest |
| 66 | + steps: |
| 67 | + - name: Check out ${{ env.SPKG }} |
| 68 | + uses: actions/checkout@v4 |
| 69 | + with: |
| 70 | + path: build/pkgs/${{ env.SPKG }}/src |
| 71 | + - name: Install prerequisites |
| 72 | + run: | |
| 73 | + sudo DEBIAN_FRONTEND=noninteractive apt-get update |
| 74 | + sudo DEBIAN_FRONTEND=noninteractive apt-get install $DIST_PREREQ |
| 75 | +
|
| 76 | + - name: Run make dist, prepare upstream artifact |
| 77 | + run: | |
| 78 | + (cd build/pkgs/${{ env.SPKG }}/src && git archive --format=tar.gz --prefix=${{ env.SPKG }}-git/ HEAD > ${{ env.SPKG }}-git.tar.gz) \ |
| 79 | + && mkdir -p upstream && cp build/pkgs/${{ env.SPKG }}/src/*.tar.gz upstream/${{ env.SPKG }}-git.tar.gz \ |
| 80 | + && echo "sage-package create ${{ env.SPKG }} --version git --tarball ${{ env.SPKG }}-git.tar.gz --type=optional" > upstream/update-pkgs.sh \ |
| 81 | + && if [ -n "${{ env.REMOVE_PATCHES }}" ]; then echo "(cd ../build/pkgs/${{ env.SPKG }}/patches && rm -f ${{ env.REMOVE_PATCHES }}; :)" >> upstream/update-pkgs.sh; fi \ |
| 82 | + && ls -l upstream/ |
| 83 | + - uses: actions/upload-artifact@v4 |
| 84 | + with: |
| 85 | + path: upstream |
| 86 | + name: upstream |
| 87 | + |
| 88 | + linux: |
| 89 | + uses: passagemath/passagemath/.github/workflows/docker.yml@main |
| 90 | + with: |
| 91 | + extra_sage_packages: gdbm git libxml2 gfortran cmake python3 openblas zlib readline sqlite libpng bzip2 liblzma libffi openssl |
| 92 | + targets: SAGE_CHECK=no SAGE_CHECK_PACKAGES="macaulay2" macaulay2 |
| 93 | + # Standard setting: Test the current HEAD of passagemath: |
| 94 | + sage_repo: passagemath/passagemath |
| 95 | + sage_ref: main |
| 96 | + upstream_artifact: upstream |
| 97 | + # We prefix the image name with the SPKG name ("macaulay2-") to avoid the error |
| 98 | + # 'Package "sage-docker-..." is already associated with another repository.' |
| 99 | + docker_push_repository: ghcr.io/${{ github.repository }}/macaulay2- |
| 100 | + needs: [dist] |
| 101 | + |
| 102 | + macos: |
| 103 | + uses: passagemath/passagemath/.github/workflows/macos.yml@main |
| 104 | + with: |
| 105 | + extra_sage_packages: gdbm git libxml2 gfortran cmake python3 openblas zlib readline sqlite libpng bzip2 liblzma libffi openssl |
| 106 | + targets: SAGE_CHECK=no SAGE_CHECK_PACKAGES="macaulay2" macaulay2 |
| 107 | + # Standard setting: Test the current HEAD of passagemath: |
| 108 | + sage_repo: passagemath/passagemath |
| 109 | + sage_ref: main |
| 110 | + upstream_artifact: upstream |
| 111 | + needs: [dist] |
0 commit comments