Skip to content

Commit 0a5d895

Browse files
Add workflow to run on specific branch and fork
1 parent 0d514d8 commit 0a5d895

File tree

1 file changed

+92
-0
lines changed

1 file changed

+92
-0
lines changed

.github/workflows/custom-branch.yml

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
name: Run tests on custom libsemigroups branch
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
branch:
6+
description: "The branch of libsemigroups to clone"
7+
required: true
8+
type: string
9+
fork:
10+
description: "The fork of libsemigroups to clone"
11+
required: false
12+
type: string
13+
default: libsemigroups/libsemigroups
14+
15+
concurrency:
16+
group: ${{ github.workflow }}-${{ github.ref }}
17+
cancel-in-progress: true
18+
19+
jobs:
20+
run-tests:
21+
name: "${{ inputs.branch }}, ${{ matrix.os }}, Python 3.13"
22+
strategy:
23+
fail-fast: false
24+
matrix:
25+
os: ["ubuntu-latest", "macOS-latest"]
26+
include:
27+
- os: "ubuntu-latest"
28+
compiler: "ccache g++"
29+
- os: "macOS-latest"
30+
compiler: "ccache clang++"
31+
runs-on: ${{ matrix.os }}
32+
timeout-minutes: 15
33+
steps:
34+
- uses: actions/checkout@v4
35+
- name: "Setup ccache . . ."
36+
uses: Chocobo1/setup-ccache-action@v1
37+
with:
38+
update_packager_index: false
39+
install_ccache: true
40+
# We could remove this step and instead install Python with micromamba.
41+
# This would mean we could avoid specifying LD_LIBRARY_PATH and LDFLAGS.
42+
# However, JDE thinks the current setup better reflects how a developer
43+
# might wish to install the package, so we have opted for this.
44+
- name: "Setup Python . . ."
45+
uses: actions/setup-python@v5
46+
with:
47+
python-version: 3.13
48+
cache: "pip"
49+
- name: "Create micromamba environment . . ."
50+
uses: mamba-org/setup-micromamba@v1
51+
with:
52+
environment-name: libsemigroups
53+
create-args: >-
54+
fmt
55+
- name: "Set environment variables . . ."
56+
run: |
57+
echo "PKG_CONFIG_PATH=$MAMBA_ROOT_PREFIX/envs/libsemigroups/lib/pkgconfig:$MAMBA_ROOT_PREFIX/envs/libsemigroups/share/pkgconfig:/usr/local/lib/pkgconfig" >> $GITHUB_ENV
58+
echo "LD_LIBRARY_PATH=$MAMBA_ROOT_PREFIX/envs/libsemigroups/lib:/usr/local/lib" >> $GITHUB_ENV
59+
echo "LDFLAGS=-Wl,-rpath,$MAMBA_ROOT_PREFIX/envs/libsemigroups/lib" >> $GITHUB_ENV
60+
echo "PATH=$MAMBA_ROOT_PREFIX/envs/libsemigroups/bin:$PATH" >> $GITHUB_ENV
61+
- name: "Check Python version . . ."
62+
run: |
63+
python --version
64+
pip --version
65+
- name: "Install make requirements . . ."
66+
if: ${{ matrix.os == 'macOS-latest' }}
67+
run: brew install autoconf automake libtool
68+
- name: "Install requirements libsemigroups . . ."
69+
run: pip install -r requirements.txt
70+
- name: "Install libsemigroups . . ."
71+
run: |
72+
git clone --depth 1 --branch ${{ inputs.branch }} https://github.com/${{ inputs.fork }}.git
73+
cd libsemigroups
74+
./autogen.sh
75+
./configure CXX="$CXX" CXXFLAGS="$CXXFLAGS" --disable-hpcombi --with-external-fmt
76+
sudo make install -j8
77+
ccache -s
78+
- name: "Run tests . . ."
79+
run: |
80+
python -m pytest -vv tests/test_*.py
81+
- name: "Run doc tests . . ."
82+
run: |
83+
etc/make-doc.sh # so that all files are generated!
84+
cd docs
85+
python -m sphinx -b doctest -d _build/doctrees source _build/doctest
86+
- name: "Pip install pylint + cpplint . . ."
87+
run: |
88+
pip install pylint cpplint
89+
- name: "Run pylint and cpplint . . ."
90+
run: |
91+
python -m pylint setup.py tests/*.py libsemigroups_pybind11/*.py
92+
python -m cpplint src/*.hpp src/*.cpp

0 commit comments

Comments
 (0)