Skip to content

Commit

Permalink
.github/workflows/build.yml: Combine calls of tj-actions/changed-files
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthias Koeppe committed Jun 3, 2024
1 parent e90d737 commit 148ac0d
Showing 1 changed file with 11 additions and 15 deletions.
26 changes: 11 additions & 15 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,21 +100,25 @@ jobs:
- name: Checkout
id: checkout
uses: actions/checkout@v4
- name: Get all packages that have changed
id: changed-packages
- name: Get changed files and packages
id: changed-files
uses: tj-actions/changed-files@v44
with:
# File extensions for doctests per sage.doctest.control.skipfile
files_yaml: |
configures:
- 'build/pkgs/*/spkg-configure.m4'
pkgs:
- 'build/pkgs/**'
- 'pkgs/**'
doctests:
- 'src/**/*.{py,pyx,pxd,pxi,sage,spyx,rst,tex}'
- '!src/{setup,conftest*}.py'
- name: Determine targets to build
id: build-targets
run: |
uninstall_targets=$(echo $(for a in '' ${{ steps.changed-packages.outputs.configures_all_changed_files }}; do echo $a | sed -E 's,build/pkgs/([a-z0-9][_.a-z0-9]*)/spkg-configure[.]m4 *,\1-uninstall,'; done | sort -u))
build_targets=$(echo $(for a in '' ${{ steps.changed-packages.outputs.pkgs_all_changed_files }}; do SPKG=$(echo $a | sed -E 's,-,_,g;s,(build/)?pkgs/([a-z0-9][-_.a-z0-9]*)/[^ ]* *,\2,;'); if [ -f "build/pkgs/$SPKG/checksums.ini" -o -f "build/pkgs/$SPKG/requirements.txt" -o -f "build/pkgs/$SPKG/spkg-install" ]; then echo "$SPKG-ensure"; fi; done | sort -u))
uninstall_targets=$(echo $(for a in '' ${{ steps.changed-files.outputs.configures_all_changed_files }}; do echo $a | sed -E 's,build/pkgs/([a-z0-9][_.a-z0-9]*)/spkg-configure[.]m4 *,\1-uninstall,'; done | sort -u))
build_targets=$(echo $(for a in '' ${{ steps.changed-files.outputs.pkgs_all_changed_files }}; do SPKG=$(echo $a | sed -E 's,-,_,g;s,(build/)?pkgs/([a-z0-9][-_.a-z0-9]*)/[^ ]* *,\2,;'); if [ -f "build/pkgs/$SPKG/checksums.ini" -o -f "build/pkgs/$SPKG/requirements.txt" -o -f "build/pkgs/$SPKG/spkg-install" ]; then echo "$SPKG-ensure"; fi; done | sort -u))
if [ -n "$uninstall_targets" ]; then
echo "build_targets=$uninstall_targets reconfigure $build_targets ci-build-with-fallback" >> $GITHUB_OUTPUT
else
Expand All @@ -125,7 +129,7 @@ jobs:
with:
ref: ${{ github.base_ref }}
path: worktree-base
if: github.base_ref && steps.changed-packages.outputs.pkgs_all_changed_files
if: github.base_ref && steps.changed-files.outputs.pkgs_all_changed_files
- name: Compute metrics
run: |
export PATH=build/bin:$PATH
Expand Down Expand Up @@ -213,20 +217,12 @@ jobs:
./sage -python -m pytest -c tox.ini -qq --doctest --collect-only || true
shell: sh .ci/docker-exec-script.sh BUILD /sage {0}

- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v44
with:
# File extensions per sage.doctest.control.skipfile
files: src/**/*.{py,pyx,pxd,pxi,sage,spyx,rst,tex}
files_ignore: src/{setup,conftest*}.py

- name: Test changed files (sage -t --new)
if: steps.changed-files.outputs.all_changed_files
if: steps.changed-files.outputs.doctests_all_changed_files
run: |
export MAKE="make -j2 --output-sync=recurse" SAGE_NUM_THREADS=4
# https://github.com/tj-actions/changed-files?tab=readme-ov-file#outputs-
./sage -t --long --format github -p4 ${{ steps.changed-files.outputs.all_changed_files }}
./sage -t --long --format github -p4 ${{ steps.changed-files.outputs.doctests_all_changed_files }}
shell: sh .ci/docker-exec-script.sh BUILD /sage {0}

test-mod:
Expand Down

0 comments on commit 148ac0d

Please sign in to comment.