Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test mac on self-hosted runner #334

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading