Skip to content

Commit bf53f87

Browse files
Test mac on self-hosted runner (#334)
* 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
1 parent 6c4154e commit bf53f87

File tree

3 files changed

+83
-0
lines changed

3 files changed

+83
-0
lines changed

.github/workflows/mac.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: mac-ci
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
7+
tests:
8+
runs-on: [self-hosted, macOS]
9+
if: github.repository == 'stfc/janus-core'
10+
timeout-minutes: 30
11+
strategy:
12+
matrix:
13+
python-version: ['3.9','3.10','3.11','3.12']
14+
15+
steps:
16+
- uses: actions/checkout@v4
17+
18+
- name: Install uv
19+
uses: astral-sh/setup-uv@v4
20+
with:
21+
version: "0.5.7"
22+
python-version: ${{ matrix.python-version }}
23+
24+
- name: Install dependencies
25+
run: uv sync --all-extras
26+
27+
- name: Run test suite
28+
env:
29+
# show timings of tests
30+
PYTEST_ADDOPTS: "--durations=0"
31+
run: uv run pytest --run-extra-mlips --cov janus_core --cov-append .
32+
33+
- name: Set Path
34+
run: |
35+
source ~/.zshrc
36+
echo "PATH=$PATH" >> $GITHUB_ENV
37+
38+
- name: Report coverage to Coveralls
39+
uses: coverallsapp/github-action@v2
40+
with:
41+
parallel: true
42+
flag-name: run-${{ matrix.python-version }}
43+
file: coverage.xml
44+
base-path: janus_core
45+
46+
coverage:
47+
needs: tests
48+
runs-on: self-hosted
49+
steps:
50+
- name: Close parallel build
51+
uses: coverallsapp/github-action@v2
52+
with:
53+
parallel-finished: true

docs/source/developer_guide/ci.rst

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
======================
2+
Continuous Integration
3+
======================
4+
5+
General instructions for setting up self-hosted GitHub runners can be found `here <https://docs.github.com/en/actions/hosting-your-own-runners>`_.
6+
7+
This process typically involves:
8+
9+
1. Add a new self-hosted runner on GitHub
10+
2. Run instructions from GitHub on your runner to download and configure
11+
3. Ensure tags added to the runner are unique, and match those in ``runs-on`` within the CI workflow
12+
13+
14+
MacOS self-hosted runner
15+
========================
16+
17+
Currently, ``janus-core`` uses a self-hosted runner to run all unit tests on MacOS.
18+
19+
To ensure the self-hosted runner remains active, we currently recommend using
20+
21+
.. code-block:: bash
22+
23+
nohup ./run.sh &!
24+
25+
This runs the script in the background, and disowns the process, allowing the ssh connection to be ended without killing the process.
26+
27+
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>`_,
28+
but currently this appears to lead to difficulties if the GUI is not active
29+
and/or ``sudo`` permissions are not used in running the service.

docs/source/developer_guide/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ Developer guide
77

88
get_started
99
tutorial
10+
ci

0 commit comments

Comments
 (0)