diff --git a/.github/workflows/mac.yml b/.github/workflows/mac.yml new file mode 100644 index 00000000..f296f151 --- /dev/null +++ b/.github/workflows/mac.yml @@ -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 diff --git a/docs/source/developer_guide/ci.rst b/docs/source/developer_guide/ci.rst new file mode 100644 index 00000000..2b553275 --- /dev/null +++ b/docs/source/developer_guide/ci.rst @@ -0,0 +1,29 @@ +====================== +Continuous Integration +====================== + +General instructions for setting up self-hosted GitHub runners can be found `here `_. + +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 `_, +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. diff --git a/docs/source/developer_guide/index.rst b/docs/source/developer_guide/index.rst index 5de224d0..28f342c9 100644 --- a/docs/source/developer_guide/index.rst +++ b/docs/source/developer_guide/index.rst @@ -7,3 +7,4 @@ Developer guide get_started tutorial + ci