From 1e3be031975317ca6266475d12857bcf9446554d Mon Sep 17 00:00:00 2001 From: Joseph Edwards Date: Fri, 13 Jun 2025 19:32:35 +0100 Subject: [PATCH 1/2] Refactor out repeated code --- .github/workflows/tests.yml | 75 +++++++------------------------------ 1 file changed, 13 insertions(+), 62 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 289e50d91..688aa3e19 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -6,73 +6,25 @@ concurrency: cancel-in-progress: true jobs: - ubuntu: + run-tests: + name: ${{ matrix.os }} Python ${{ matrix.python_version }} strategy: fail-fast: false matrix: python_version: ["3.9", "3.10", "3.11", "3.12", "3.13"] - runs-on: ubuntu-latest + os: [ubuntu-latest, macOS-latest] + include: + - os: ubuntu-latest + compiler: g++ + - os: macOS-latest + compiler: clang++ + runs-on: ${{ matrix.os }} timeout-minutes: 15 defaults: run: shell: bash -l {0} env: - CXX: "ccache g++" - CXXFLAGS: "-O2 -g" - steps: - - uses: actions/checkout@v4 - - name: "Create micromamba environment" - uses: mamba-org/setup-micromamba@v1 - with: - environment-name: libsemigroups - create-args: >- - python=${{ matrix.python_version }} - fmt - - name: "Set environment variables . . ." - run: | - echo "PKG_CONFIG_PATH=$MAMBA_ROOT_PREFIX/envs/libsemigroups/lib/pkgconfig:$MAMBA_ROOT_PREFIX/envs/libsemigroups/share/pkgconfig:/usr/local/lib/pkgconfig" >> $GITHUB_ENV - echo "LD_LIBRARY_PATH=$MAMBA_ROOT_PREFIX/envs/libsemigroups/lib:/usr/local/lib" >> $GITHUB_ENV - - name: "Setup ccache . . ." - uses: Chocobo1/setup-ccache-action@v1 - with: - update_packager_index: false - install_ccache: true - - name: "Install libsemigroups . . ." - run: | - git clone --depth 1 --branch main https://github.com/libsemigroups/libsemigroups.git - cd libsemigroups - ./autogen.sh && ./configure CXX="$CXX" CXXFLAGS="$CXXFLAGS" --disable-hpcombi --with-external-fmt && sudo make install -j8 - ccache -s - - name: "Python version . . ." - run: | - python --version - pip3 --version - - name: "Pip installing requirements.txt . . ." - run: | - pip3 install -r requirements.txt - - name: "Pip3 installing libsemigroups_pybind11 . . ." - run: | - echo $PKG_CONFIG_PATH - pip3 install . -v - - name: "python -m pytest -vv tests/test_*.py . . ." - run: | - python -m pytest -vv tests/test_*.py - - name: "Run doc tests . . ." - run: | - etc/make-doc.sh # so that all files are generated! - cd docs - python -m sphinx -b doctest -d _build/doctrees source _build/doctest - - name: "Running ruff, pylint and cpplint . . ." - run: make lint - macosx: - strategy: - fail-fast: false - matrix: - python_version: ["3.9", "3.10", "3.11", "3.12", "3.13"] - runs-on: macOS-latest - timeout-minutes: 15 - env: - CXX: "ccache clang++" + CXX: "ccache ${{ matrix.compiler }}" CXXFLAGS: "-O2 -g" steps: - uses: actions/checkout@v4 @@ -88,7 +40,8 @@ jobs: echo "PKG_CONFIG_PATH=$MAMBA_ROOT_PREFIX/envs/libsemigroups/lib/pkgconfig:$MAMBA_ROOT_PREFIX/envs/libsemigroups/share/pkgconfig:/usr/local/lib/pkgconfig" >> $GITHUB_ENV echo "LD_LIBRARY_PATH=$MAMBA_ROOT_PREFIX/envs/libsemigroups/lib:/usr/local/lib" >> $GITHUB_ENV echo "PATH=$MAMBA_ROOT_PREFIX/envs/libsemigroups/bin:$PATH" >> $GITHUB_ENV - - name: "Install libsemigroups dependencies . . ." + - name: "macOS only: Install libsemigroups dependencies . . ." + if: ${{ matrix.os == 'macOS-latest' }} run: brew install autoconf automake libtool - name: "Setup ccache . . ." uses: Chocobo1/setup-ccache-action@v1 @@ -99,9 +52,7 @@ jobs: run: | git clone --depth 1 --branch main https://github.com/libsemigroups/libsemigroups.git cd libsemigroups - ./autogen.sh - ./configure CXX="$CXX" CXXFLAGS="$CXXFLAGS" --disable-hpcombi --with-external-fmt - sudo make install -j8 + ./autogen.sh && ./configure CXX="$CXX" CXXFLAGS="$CXXFLAGS" --disable-hpcombi --with-external-fmt && sudo make install -j8 ccache -s - name: "Python version . . ." run: | From 6c03818d35365f0c0f664df87d42392b3749c40f Mon Sep 17 00:00:00 2001 From: Joseph Edwards Date: Fri, 13 Jun 2025 19:37:23 +0100 Subject: [PATCH 2/2] Add job that checks for doc errors --- .github/workflows/doc.yml | 67 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 .github/workflows/doc.yml diff --git a/.github/workflows/doc.yml b/.github/workflows/doc.yml new file mode 100644 index 000000000..c626c0bf8 --- /dev/null +++ b/.github/workflows/doc.yml @@ -0,0 +1,67 @@ +name: Check documentation builds +on: [pull_request, workflow_dispatch] + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + ubuntu: + name: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + include: + - os: ubuntu-latest + compiler: g++ + - os: macOS-latest + compiler: clang++ + runs-on: ${{ matrix.os }} + timeout-minutes: 15 + defaults: + run: + shell: bash -l {0} + env: + CXX: "ccache ${{ matrix.compiler }}" + CXXFLAGS: "-O2 -g" + steps: + - uses: actions/checkout@v4 + - name: "Create micromamba environment" + uses: mamba-org/setup-micromamba@v1 + with: + environment-name: libsemigroups + create-args: >- + python + fmt + - name: "Set environment variables . . ." + run: | + echo "PKG_CONFIG_PATH=$MAMBA_ROOT_PREFIX/envs/libsemigroups/lib/pkgconfig:$MAMBA_ROOT_PREFIX/envs/libsemigroups/share/pkgconfig:/usr/local/lib/pkgconfig" >> $GITHUB_ENV + echo "LD_LIBRARY_PATH=$MAMBA_ROOT_PREFIX/envs/libsemigroups/lib:/usr/local/lib" >> $GITHUB_ENV + echo "PATH=$MAMBA_ROOT_PREFIX/envs/libsemigroups/bin:$PATH" >> $GITHUB_ENV + - name: "macOS only: Install libsemigroups dependencies . . ." + if: ${{ matrix.os == 'macOS-latest' }} + run: brew install autoconf automake libtool + - name: "Setup ccache . . ." + uses: Chocobo1/setup-ccache-action@v1 + with: + update_packager_index: false + install_ccache: true + - name: "Install libsemigroups . . ." + run: | + git clone --depth 1 --branch main https://github.com/libsemigroups/libsemigroups.git + cd libsemigroups + ./autogen.sh && ./configure CXX="$CXX" CXXFLAGS="$CXXFLAGS" --disable-hpcombi --with-external-fmt && sudo make install -j8 + ccache -s + - name: "Python version . . ." + run: | + python --version + pip3 --version + - name: "Pip installing requirements.txt . . ." + run: | + pip3 install -r requirements.txt + - name: "Pip3 installing libsemigroups_pybind11 . . ." + run: | + echo $PKG_CONFIG_PATH + pip3 install . -v + - name: "Check doc builds" + run: make doc SPHINXOPTS="-W"