-
-
Notifications
You must be signed in to change notification settings - Fork 482
159 lines (144 loc) · 5.22 KB
/
ci-macos.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
name: CI macOS
## This GitHub Actions workflow runs SAGE_ROOT/tox.ini with select environments,
## whenever a GitHub pull request is opened or synchronized in a repository
## where GitHub Actions are enabled.
##
## It builds and checks some sage spkgs as defined in TARGETS.
##
## A job succeeds if there is no error.
##
## The build is run with "make V=0", so the build logs of individual packages are suppressed.
##
## At the end, all package build logs that contain an error are printed out.
##
## After all jobs have finished (or are canceled) and a short delay,
## tar files of all logs are made available as "build artifacts".
#on: [push, pull_request]
on:
push:
tags:
- '*'
workflow_dispatch:
# Allow to run manually
env:
TARGETS_PRE: all-sage-local
TARGETS: build doc-html
TARGETS_OPTIONAL: ptest
jobs:
stage-1:
uses: ./.github/workflows/macos.yml
with:
stage: "1"
timeout: 14400
stage-2:
uses: ./.github/workflows/macos.yml
with:
stage: "2"
needs: [stage-1]
if: ${{ success() || failure() }}
stage-2-optional-0-o:
uses: ./.github/workflows/macos.yml
with:
stage: "2-optional-0-o"
needs: [stage-2]
if: ${{ success() || failure() }}
stage-2-optional-p-z:
uses: ./.github/workflows/macos.yml
with:
stage: "2-optional-p-z"
needs: [stage-2-optional-0-o]
if: ${{ success() || failure() }}
stage-2-experimental-0-o:
uses: ./.github/workflows/macos.yml
with:
stage: "2-optional-0-o"
needs: [stage-2-optional-p-z]
if: ${{ success() || failure() }}
stage-2-experimental-p-z:
uses: ./.github/workflows/macos.yml
with:
stage: "2-experimental-p-z"
needs: [stage-2-experimental-0-o]
if: ${{ success() || failure() }}
dist:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 500
- name: fetch tags
run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
- name: Install bootstrap prerequisites
run: |
sudo DEBIAN_FRONTEND=noninteractive apt-get update
sudo DEBIAN_FRONTEND=noninteractive apt-get install $(build/bin/sage-get-system-packages debian _bootstrap)
- name: Bootstrap with sage-update-version
# We set SAGE_ROOT and SAGE_SRC by hand
# because 'sage -sh' does not work with an unconfigured tree,
# giving: Error: SAGE_SCRIPTS_DIR is set to a bad value
run: |
git config --global user.email "nobody@example.com"
git config --global user.name "Sage GitHub CI"
SAGE_ROOT=. SAGE_SRC=./src src/bin/sage-update-version $(cat src/VERSION.txt).dev0 || echo "(ignoring error)"
- name: make dist
run: |
./configure --enable-download-from-upstream-url && make dist
- uses: actions/upload-artifact@v3
with:
path: "dist/*.tar.gz"
name: dist
local-macos-nohomebrew:
needs: [dist]
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
max-parallel: 4
matrix:
os: [ macos-12, macos-13, macos-14 ]
tox_system_factor: [macos-nobootstrap]
tox_packages_factor: [minimal]
xcode_version_factor: [default]
env:
TOX_ENV: local-${{ matrix.tox_system_factor }}-${{ matrix.tox_packages_factor }}
LOGS_ARTIFACT_NAME: logs-commit-${{ github.sha }}-tox-local-${{ matrix.tox_system_factor }}-${{ matrix.tox_packages_factor }}-xcode_${{ matrix.xcode_version_factor }}
steps:
- uses: actions/checkout@v4
if: "!contains(matrix.tox_system_factor, 'nobootstrap')"
- uses: actions/download-artifact@v3
with:
path: .
name: dist
if: contains(matrix.tox_system_factor, 'nobootstrap')
- name: Unpack sage dist
run: |
tar xf sage*.tar.gz --strip-components=1
if: contains(matrix.tox_system_factor, 'nobootstrap')
- name: Move homebrew away
run: |
(cd $(brew --prefix) && for a in bin etc include lib opt sbin share; do sudo mv $a $a-moved; done)
- name: Select Xcode version
run: |
if [ ${{ matrix.xcode_version_factor }} != default ]; then sudo xcode-select -s /Applications/Xcode_${{ matrix.xcode_version_factor }}.app; fi
- name: Install test prerequisites
run: |
sudo /usr/bin/python3 -m pip install tox
- name: Build and test with tox
# We use a high parallelization on purpose in order to catch possible parallelization bugs in the build scripts.
# For doctesting, we use a lower parallelization to avoid timeouts.
run: |
(sleep 20000; pkill make) &
MAKE="make -j12" tox -e $TOX_ENV -- SAGE_NUM_THREADS=6 $TARGETS
- name: Prepare logs artifact
run: |
mkdir -p "artifacts/$LOGS_ARTIFACT_NAME"; cp -r .tox/*/log "artifacts/$LOGS_ARTIFACT_NAME"
if: always()
- uses: actions/upload-artifact@v3
with:
path: artifacts
name: ${{ env.LOGS_ARTIFACT_NAME }}
if: always()
- name: Print out logs for immediate inspection
# and markup the output with GitHub Actions logging commands
run: |
.github/workflows/scan-logs.sh "artifacts/$LOGS_ARTIFACT_NAME"
if: always()