Skip to content

Commit ebf03c9

Browse files
Joseph-Edwardsjames-d-mitchell
authored andcommitted
Refactor out repeated code
1 parent 9e8538f commit ebf03c9

1 file changed

Lines changed: 13 additions & 62 deletions

File tree

.github/workflows/tests.yml

Lines changed: 13 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -6,73 +6,25 @@ concurrency:
66
cancel-in-progress: true
77

88
jobs:
9-
ubuntu:
9+
run-tests:
10+
name: ${{ matrix.os }} Python ${{ matrix.python_version }}
1011
strategy:
1112
fail-fast: false
1213
matrix:
1314
python_version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
14-
runs-on: ubuntu-latest
15+
os: [ubuntu-latest, macOS-latest]
16+
include:
17+
- os: ubuntu-latest
18+
compiler: g++
19+
- os: macOS-latest
20+
compiler: clang++
21+
runs-on: ${{ matrix.os }}
1522
timeout-minutes: 15
1623
defaults:
1724
run:
1825
shell: bash -l {0}
1926
env:
20-
CXX: "ccache g++"
21-
CXXFLAGS: "-O2 -g"
22-
steps:
23-
- uses: actions/checkout@v4
24-
- name: "Create micromamba environment"
25-
uses: mamba-org/setup-micromamba@v1
26-
with:
27-
environment-name: libsemigroups
28-
create-args: >-
29-
python=${{ matrix.python_version }}
30-
fmt
31-
- name: "Set environment variables . . ."
32-
run: |
33-
echo "PKG_CONFIG_PATH=$MAMBA_ROOT_PREFIX/envs/libsemigroups/lib/pkgconfig:$MAMBA_ROOT_PREFIX/envs/libsemigroups/share/pkgconfig:/usr/local/lib/pkgconfig" >> $GITHUB_ENV
34-
echo "LD_LIBRARY_PATH=$MAMBA_ROOT_PREFIX/envs/libsemigroups/lib:/usr/local/lib" >> $GITHUB_ENV
35-
- name: "Setup ccache . . ."
36-
uses: Chocobo1/setup-ccache-action@v1
37-
with:
38-
update_packager_index: false
39-
install_ccache: true
40-
- name: "Install libsemigroups . . ."
41-
run: |
42-
git clone --depth 1 --branch main https://github.com/libsemigroups/libsemigroups.git
43-
cd libsemigroups
44-
./autogen.sh && ./configure CXX="$CXX" CXXFLAGS="$CXXFLAGS" --disable-hpcombi --with-external-fmt && sudo make install -j8
45-
ccache -s
46-
- name: "Python version . . ."
47-
run: |
48-
python --version
49-
pip3 --version
50-
- name: "Pip installing requirements.txt . . ."
51-
run: |
52-
pip3 install -r requirements.txt
53-
- name: "Pip3 installing libsemigroups_pybind11 . . ."
54-
run: |
55-
echo $PKG_CONFIG_PATH
56-
pip3 install . -v
57-
- name: "python -m pytest -vv tests/test_*.py . . ."
58-
run: |
59-
python -m pytest -vv tests/test_*.py
60-
- name: "Run doc tests . . ."
61-
run: |
62-
etc/make-doc.sh # so that all files are generated!
63-
cd docs
64-
python -m sphinx -b doctest -d _build/doctrees source _build/doctest
65-
- name: "Running ruff, pylint and cpplint . . ."
66-
run: make lint
67-
macosx:
68-
strategy:
69-
fail-fast: false
70-
matrix:
71-
python_version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
72-
runs-on: macOS-latest
73-
timeout-minutes: 15
74-
env:
75-
CXX: "ccache clang++"
27+
CXX: "ccache ${{ matrix.compiler }}"
7628
CXXFLAGS: "-O2 -g"
7729
steps:
7830
- uses: actions/checkout@v4
@@ -88,7 +40,8 @@ jobs:
8840
echo "PKG_CONFIG_PATH=$MAMBA_ROOT_PREFIX/envs/libsemigroups/lib/pkgconfig:$MAMBA_ROOT_PREFIX/envs/libsemigroups/share/pkgconfig:/usr/local/lib/pkgconfig" >> $GITHUB_ENV
8941
echo "LD_LIBRARY_PATH=$MAMBA_ROOT_PREFIX/envs/libsemigroups/lib:/usr/local/lib" >> $GITHUB_ENV
9042
echo "PATH=$MAMBA_ROOT_PREFIX/envs/libsemigroups/bin:$PATH" >> $GITHUB_ENV
91-
- name: "Install libsemigroups dependencies . . ."
43+
- name: "macOS only: Install libsemigroups dependencies . . ."
44+
if: ${{ matrix.os == 'macOS-latest' }}
9245
run: brew install autoconf automake libtool
9346
- name: "Setup ccache . . ."
9447
uses: Chocobo1/setup-ccache-action@v1
@@ -99,9 +52,7 @@ jobs:
9952
run: |
10053
git clone --depth 1 --branch main https://github.com/libsemigroups/libsemigroups.git
10154
cd libsemigroups
102-
./autogen.sh
103-
./configure CXX="$CXX" CXXFLAGS="$CXXFLAGS" --disable-hpcombi --with-external-fmt
104-
sudo make install -j8
55+
./autogen.sh && ./configure CXX="$CXX" CXXFLAGS="$CXXFLAGS" --disable-hpcombi --with-external-fmt && sudo make install -j8
10556
ccache -s
10657
- name: "Python version . . ."
10758
run: |

0 commit comments

Comments
 (0)