-
-
Notifications
You must be signed in to change notification settings - Fork 344
141 lines (131 loc) · 5.16 KB
/
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
---
name: macOS
# Build and run tests on macOS
on:
push:
branches:
- main
- releasebranch_*
pull_request:
env:
CACHE_NUMBER: 0
concurrency:
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
cancel-in-progress: true
permissions: {}
jobs:
macos_build:
name: macOS build
runs-on: macos-14
env:
PYTHONWARNINGS: always
steps:
- name: Info
run: |
echo "macOS version $(sw_vers -productVersion)"
echo "architecture $(uname -a)"
- name: Disabling Spotlight
run: sudo mdutil -a -i off
- name: Uninstalling Homebrew
run: |
echo "Moving directories..."
sudo mkdir /opt/local-off /opt/homebrew-off
test ! -d /usr/local || /usr/bin/sudo /usr/bin/find /usr/local \
-mindepth 1 -maxdepth 1 -type d -print -exec /bin/mv {} \
/opt/local-off/ \;
test ! -d /opt/homebrew || /usr/bin/sudo /usr/bin/find /opt/homebrew \
-mindepth 1 -maxdepth 1 -type d -print -exec /bin/mv {} \
/opt/homebrew-off/ \;
echo "Removing files..."
test ! -d /usr/local || /usr/bin/sudo /usr/bin/find /usr/local \
-mindepth 1 -maxdepth 1 -type f -print -delete
test ! -d /opt/homebrew || /usr/bin/sudo /usr/bin/find /opt/homebrew \
-mindepth 1 -maxdepth 1 -type f -print -delete
# Rehash to forget about the deleted files
hash -r
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Get current date cache key segment
id: date
# Year and week of year so cache key changes weekly
run: echo "date=$(date +%Y-%U)" >> "${GITHUB_OUTPUT}"
- name: Prepare Conda environment file
env:
test_dependencies: |
ipython
pytest
pytest-github-actions-annotate-failures
pytest-timeout
pytest-xdist
pyyaml
run: |
cp ./macos/files/conda-requirements-dev-arm64.txt "${RUNNER_TEMP}/macos_dependencies.txt"
echo "$test_dependencies" | sed "s/ /\n/g" >> "${RUNNER_TEMP}/macos_dependencies.txt"
- name: Setup Mamba
uses: mamba-org/setup-micromamba@0dea6379afdaffa5d528b3d1dabc45da37f443fc # v2.0.4
with:
init-shell: bash
environment-file: ${{ runner.temp }}/macos_dependencies.txt
environment-name: grass-env
# Persist on the same period (date).
cache-environment-key: environment-${{ steps.date.outputs.date }}
- name: Environment info
shell: bash -el {0}
run: |
printenv | sort
$CC --version
- name: Create installation directory
run: mkdir $HOME/install
- name: Build and install
shell: micromamba-shell {0}
run: source ./.github/workflows/macos_install.sh $HOME/install
- name: Add the bin directory to PATH
run: echo "$HOME/install/bin" >> $GITHUB_PATH
- name: Check installed version
if: ${{ !cancelled() }}
shell: micromamba-shell {0}
run: source ./.github/workflows/print_versions.sh
- name: Run pytest with multiple workers in parallel
shell: micromamba-shell {0}
run: |
export PYTHONPATH=$(grass --config python_path):$PYTHONPATH
export LD_LIBRARY_PATH=$(grass --config path)/lib:$LD_LIBRARY_PATH
pytest --verbose --color=yes --durations=0 --durations-min=0.5 \
--numprocesses auto \
-ra . \
-m 'not needs_solo_run'
- name: Run pytest with a single worker (for tests marked with needs_solo_run)
shell: micromamba-shell {0}
run: |
export PYTHONPATH=$(grass --config python_path):$PYTHONPATH
export LD_LIBRARY_PATH=$(grass --config path)/lib:$LD_LIBRARY_PATH
pytest --verbose --color=yes --durations=0 --durations-min=0.5 \
-ra . \
-m 'needs_solo_run'
- name: Cache GRASS Sample Dataset
id: cached-data
uses: actions/cache@0c907a75c2c80ebcb7f088228285e798b750cf8f # v4.2.1
with:
path: sample-data/nc_spm_full_v2alpha2.tar.gz
key: nc_spm_full_v2alpha2.tar.gz
enableCrossOsArchive: true
- name: Download GRASS Sample Dataset
if: steps.cached-data.outputs.cache-hit != 'true'
run: |
mkdir -p sample-data
curl -L "$SAMPLE_DATA" -o sample-data/nc_spm_full_v2alpha2.tar.gz
env:
SAMPLE_DATA: "https://grass.osgeo.org/sampledata/north_carolina/\
nc_spm_full_v2alpha2.tar.gz"
- name: Run gunittest tests
shell: micromamba-shell {0}
run: .github/workflows/test_thorough.sh --config .github/workflows/macos_gunittest.cfg
env:
SAMPLE_DATA_URL: "file://${{ github.workspace }}/sample-data/\
nc_spm_full_v2alpha2.tar.gz"
- name: Make HTML test report available
if: ${{ !cancelled() }}
uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4.6.1
with:
name: testreport-macOS
path: testreport
retention-days: 3