Skip to content

Commit

Permalink
Test mac on self-hosted runner (#334)
Browse files Browse the repository at this point in the history
* Test on self-hosted mac

* Automatically add pipx apps to PATH

* Test all MLIPs on mac

* Remove pipx and poetry installation

* Fix poetry path

* Update MacOS ci for uv

* Fix coveralls

* Update docs for self-hosted runners
  • Loading branch information
ElliottKasoar authored Jan 8, 2025
1 parent 6c4154e commit bf53f87
Show file tree
Hide file tree
Showing 3 changed files with 83 additions and 0 deletions.
53 changes: 53 additions & 0 deletions .github/workflows/mac.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: mac-ci

on: [push, pull_request]

jobs:

tests:
runs-on: [self-hosted, macOS]
if: github.repository == 'stfc/janus-core'
timeout-minutes: 30
strategy:
matrix:
python-version: ['3.9','3.10','3.11','3.12']

steps:
- uses: actions/checkout@v4

- name: Install uv
uses: astral-sh/setup-uv@v4
with:
version: "0.5.7"
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: uv sync --all-extras

- name: Run test suite
env:
# show timings of tests
PYTEST_ADDOPTS: "--durations=0"
run: uv run pytest --run-extra-mlips --cov janus_core --cov-append .

- name: Set Path
run: |
source ~/.zshrc
echo "PATH=$PATH" >> $GITHUB_ENV
- name: Report coverage to Coveralls
uses: coverallsapp/github-action@v2
with:
parallel: true
flag-name: run-${{ matrix.python-version }}
file: coverage.xml
base-path: janus_core

coverage:
needs: tests
runs-on: self-hosted
steps:
- name: Close parallel build
uses: coverallsapp/github-action@v2
with:
parallel-finished: true
29 changes: 29 additions & 0 deletions docs/source/developer_guide/ci.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
======================
Continuous Integration
======================

General instructions for setting up self-hosted GitHub runners can be found `here <https://docs.github.com/en/actions/hosting-your-own-runners>`_.

This process typically involves:

1. Add a new self-hosted runner on GitHub
2. Run instructions from GitHub on your runner to download and configure
3. Ensure tags added to the runner are unique, and match those in ``runs-on`` within the CI workflow


MacOS self-hosted runner
========================

Currently, ``janus-core`` uses a self-hosted runner to run all unit tests on MacOS.

To ensure the self-hosted runner remains active, we currently recommend using

.. code-block:: bash
nohup ./run.sh &!
This runs the script in the background, and disowns the process, allowing the ssh connection to be ended without killing the process.

It would be preferable to `configure the runner application as a service <https://docs.github.com/en/actions/hosting-your-own-runners/managing-self-hosted-runners/configuring-the-self-hosted-runner-application-as-a-service?platform=mac>`_,
but currently this appears to lead to difficulties if the GUI is not active
and/or ``sudo`` permissions are not used in running the service.
1 change: 1 addition & 0 deletions docs/source/developer_guide/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ Developer guide

get_started
tutorial
ci

0 comments on commit bf53f87

Please sign in to comment.