|
76 | 76 | EXTRA_CONFIGURE_ARGS: --enable-fat-binary
|
77 | 77 |
|
78 | 78 | jobs:
|
79 |
| - test-new: |
80 |
| - runs-on: ubuntu-latest |
81 |
| - outputs: |
82 |
| - build_targets: ${{ steps.build-targets.outputs.build_targets }} |
83 |
| - services: |
84 |
| - # https://docs.docker.com/build/ci/github-actions/local-registry/ |
85 |
| - registry: |
86 |
| - image: registry:2 |
87 |
| - ports: |
88 |
| - - 5000:5000 |
89 |
| - steps: |
90 |
| - - name: Maximize build disk space |
91 |
| - uses: easimon/maximize-build-space@v10 |
92 |
| - with: |
93 |
| - # need space in /var for Docker images |
94 |
| - root-reserve-mb: 30000 |
95 |
| - remove-dotnet: true |
96 |
| - remove-android: true |
97 |
| - remove-haskell: true |
98 |
| - remove-codeql: true |
99 |
| - remove-docker-images: true |
100 |
| - |
101 |
| - - name: Checkout |
102 |
| - id: checkout |
103 |
| - uses: actions/checkout@v4 |
104 |
| - |
105 |
| - - name: Get changed files and packages |
106 |
| - id: changed-files |
107 |
| - uses: tj-actions/changed-files@v46 |
108 |
| - with: |
109 |
| - # File extensions for doctests per sage.doctest.control.skipfile |
110 |
| - # Also src/sage/doctests/tests/ are excluded because of nodoctest file |
111 |
| - # which would make sage.doctest.control.skipdir return True |
112 |
| - files_yaml: | |
113 |
| - configures: |
114 |
| - - 'build/pkgs/*/spkg-configure.m4' |
115 |
| - pkgs: |
116 |
| - - 'build/pkgs/**' |
117 |
| - - '!build/pkgs/_**' |
118 |
| - - '!build/pkgs/configure/**' |
119 |
| - - 'pkgs/**' |
120 |
| - doctests: |
121 |
| - - 'src/**/*.{py,pyx,pxd,pxi,sage,spyx,rst,tex}' |
122 |
| - - '!src/{setup,conftest*}.py' |
123 |
| - - '!src/sage/doctest/tests/*' |
124 |
| -
|
125 |
| - - name: Determine targets to build |
126 |
| - id: build-targets |
127 |
| - run: | |
128 |
| - uninstall_targets=$(echo $( |
129 |
| - for a in '' ${{ steps.changed-files.outputs.configures_all_changed_files }}; do |
130 |
| - # Extract package name from the file path and append '-uninstall' |
131 |
| - echo $a | sed -E 's,build/pkgs/([a-z0-9][_.a-z0-9]*)/spkg-configure[.]m4 *,\1-uninstall,' |
132 |
| - done | sort -u # Sort and ensure uniqueness |
133 |
| - )) |
134 |
| - build_targets=$(echo $( |
135 |
| - for a in '' ${{ steps.changed-files.outputs.pkgs_all_changed_files }}; do |
136 |
| - # Extract package name, replace '-' with '_', and strip extra parts from the path |
137 |
| - SPKG=$(echo $a | sed -E 's,-,_,g;s,(build/)?pkgs/([a-z0-9][-_.a-z0-9]*)/[^ ]* *,\2,;') |
138 |
| - # Check if key files exist in the package directory |
139 |
| - if [ -f "build/pkgs/$SPKG/checksums.ini" ] || \ |
140 |
| - [ -f "build/pkgs/$SPKG/requirements.txt" ] || \ |
141 |
| - [ -f "build/pkgs/$SPKG/spkg-install" ]; then |
142 |
| - echo "$SPKG-ensure" # add the "$SPKG-ensure" target |
143 |
| - fi |
144 |
| - done | sort -u # Sort and ensure uniqueness |
145 |
| - )) |
146 |
| - if [ -n "$uninstall_targets" ]; then |
147 |
| - echo "build_targets=$uninstall_targets reconfigure $build_targets ci-build-with-fallback" >> $GITHUB_OUTPUT |
148 |
| - else |
149 |
| - echo "build_targets=$build_targets ci-build-with-fallback" >> $GITHUB_OUTPUT |
150 |
| - fi |
151 |
| - cat $GITHUB_OUTPUT |
152 |
| -
|
153 |
| - - uses: actions/checkout@v4 |
154 |
| - with: |
155 |
| - ref: ${{ github.base_ref }} |
156 |
| - path: worktree-base |
157 |
| - if: github.base_ref && steps.changed-files.outputs.pkgs_all_changed_files |
158 |
| - |
159 |
| - - name: Compute metrics |
160 |
| - run: | |
161 |
| - export PATH=build/bin:$PATH |
162 |
| - if [ -d worktree-base ]; then |
163 |
| - (echo "# $GITHUB_BASE_REF"; SAGE_ROOT=worktree-base sage-package metrics :all:) > base-metrics.txt |
164 |
| - (echo "# $GITHUB_REF"; sage-package metrics :all:) > metrics.txt |
165 |
| - diff --color=always --width=100 --side-by-side --left-column base-metrics.txt metrics.txt || true |
166 |
| - else |
167 |
| - sage-package metrics :all: |
168 |
| - fi |
169 |
| -
|
170 |
| - - name: Install test prerequisites |
171 |
| - # From docker.yml |
172 |
| - run: | |
173 |
| - sudo DEBIAN_FRONTEND=noninteractive apt-get update |
174 |
| - sudo DEBIAN_FRONTEND=noninteractive apt-get install tox |
175 |
| - sudo apt-get clean |
176 |
| - df -h |
177 |
| -
|
178 |
| - - name: Merge CI fixes from sagemath/sage |
179 |
| - # From docker.yml |
180 |
| - # This step needs to happen after the commit sha is put in DOCKER_TAG |
181 |
| - # so that multi-stage builds can work correctly. |
182 |
| - run: | |
183 |
| - mkdir -p upstream |
184 |
| - .ci/merge-fixes.sh 2>&1 | tee upstream/ci_fixes.log |
185 |
| - env: |
186 |
| - GH_TOKEN: ${{ github.token }} |
187 |
| - SAGE_CI_FIXES_FROM_REPOSITORIES: ${{ vars.SAGE_CI_FIXES_FROM_REPOSITORIES }} |
188 |
| - |
189 |
| - # Building |
190 |
| - |
191 |
| - - name: Generate Dockerfile |
192 |
| - # From docker.yml |
193 |
| - run: | |
194 |
| - tox -e ${{ env.TOX_ENV }} |
195 |
| - cp .tox/${{ env.TOX_ENV }}/Dockerfile . |
196 |
| - env: |
197 |
| - # Only generate the Dockerfile, do not run 'docker build' here |
198 |
| - DOCKER_TARGETS: "" |
199 |
| - |
200 |
| - - name: Set up Docker Buildx |
201 |
| - uses: docker/setup-buildx-action@v3 |
202 |
| - with: |
203 |
| - driver-opts: network=host |
204 |
| - |
205 |
| - - name: Build Docker image |
206 |
| - id: image |
207 |
| - uses: docker/build-push-action@v6 |
208 |
| - with: |
209 |
| - # push and load may not be set together at the moment |
210 |
| - # |
211 |
| - # We are using "push" (to the local registry) because it was |
212 |
| - # more reliable than "load", for which we observed random failure |
213 |
| - # conditions in which the built image could not be found. |
214 |
| - # |
215 |
| - push: ${{ steps.changed-files.outputs.doctests_all_changed_files && true || false }} |
216 |
| - load: false |
217 |
| - context: . |
218 |
| - tags: ${{ env.BUILD_IMAGE }} |
219 |
| - target: with-targets |
220 |
| - cache-from: type=gha |
221 |
| - cache-to: type=gha,mode=max |
222 |
| - build-args: | |
223 |
| - NUMPROC=6 |
224 |
| - USE_MAKEFLAGS=-k V=0 SAGE_NUM_THREADS=4 --output-sync=recurse |
225 |
| - TARGETS_PRE=build/make/Makefile |
226 |
| - TARGETS=${{ steps.build-targets.outputs.build_targets }} |
227 |
| -
|
228 |
| - - name: Start container |
229 |
| - id: container |
230 |
| - # Try to continue when "exporting to GitHub Actions Cache" failed with timeout |
231 |
| - if: (success() || failure()) && steps.changed-files.outputs.doctests_all_changed_files |
232 |
| - run: | |
233 |
| - docker run --name BUILD -dit \ |
234 |
| - --mount type=bind,src=$(pwd),dst=$(pwd) \ |
235 |
| - --workdir $(pwd) \ |
236 |
| - ${{ env.BUILD_IMAGE }} /bin/sh |
237 |
| -
|
238 |
| - # Testing |
239 |
| - |
240 |
| - - name: Check that all modules can be imported |
241 |
| - if: (success() || failure()) && steps.container.outcome == 'success' && steps.changed-files.outputs.doctests_all_changed_files |
242 |
| - run: | |
243 |
| - # Increase the length of the lines in the "short summary" |
244 |
| - export COLUMNS=120 |
245 |
| - # The following command checks that all modules can be imported. |
246 |
| - # The output also includes a long list of modules together with the number of tests in each module. |
247 |
| - # This can be ignored. |
248 |
| - ./sage -python -m pip install pytest-xdist |
249 |
| - ./sage -python -m pytest -c tox.ini -qq --doctest --collect-only || true |
250 |
| - shell: sh .ci/docker-exec-script.sh BUILD /sage {0} |
251 |
| - |
252 |
| - - name: Test changed files |
253 |
| - if: (success() || failure()) && steps.container.outcome == 'success' && steps.changed-files.outputs.doctests_all_changed_files |
254 |
| - run: | |
255 |
| - export MAKE="make -j2 --output-sync=recurse" SAGE_NUM_THREADS=4 |
256 |
| - # https://github.com/tj-actions/changed-files?tab=readme-ov-file#outputs- |
257 |
| - ./sage -t --long --format github -p4 ${{ steps.changed-files.outputs.doctests_all_changed_files }} |
258 |
| - shell: sh .ci/docker-exec-script.sh BUILD /sage {0} |
259 |
| - |
260 | 79 | test-long:
|
261 | 80 | runs-on: ubuntu-latest
|
262 |
| - needs: [test-new] |
263 | 81 | services:
|
264 | 82 | # https://docs.docker.com/build/ci/github-actions/local-registry/
|
265 | 83 | registry:
|
@@ -334,8 +152,6 @@ jobs:
|
334 | 152 | context: .
|
335 | 153 | tags: ${{ env.BUILD_IMAGE }}
|
336 | 154 | target: with-targets
|
337 |
| - cache-from: type=gha |
338 |
| - cache-to: type=gha,mode=max |
339 | 155 | build-args: |
|
340 | 156 | NUMPROC=6
|
341 | 157 | USE_MAKEFLAGS=-k V=0 SAGE_NUM_THREADS=4 --output-sync=recurse
|
@@ -454,8 +270,6 @@ jobs:
|
454 | 270 | context: .
|
455 | 271 | tags: ${{ env.BUILD_IMAGE }}
|
456 | 272 | target: with-targets
|
457 |
| - cache-from: type=gha |
458 |
| - cache-to: type=gha,mode=max |
459 | 273 | build-args: |
|
460 | 274 | NUMPROC=6
|
461 | 275 | USE_MAKEFLAGS=-k V=0 SAGE_NUM_THREADS=4 --output-sync=recurse
|
|
0 commit comments