Skip to content

Commit

Permalink
Update GitHub Actions workflows
Browse files Browse the repository at this point in the history
Use conda environments for better consistency
  • Loading branch information
fabcor-maxiv committed Feb 5, 2024
1 parent 5668661 commit b4c5748
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 57 deletions.
19 changes: 9 additions & 10 deletions .github/workflows/coverage_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,23 @@ jobs:
permissions:
pull-requests: write
steps:
- uses: actions/checkout@v3
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python 3.10
uses: actions/setup-python@v4
- name: Set up conda environment with micromamba
uses: mamba-org/setup-micromamba@v1
with:
python-version: "3.10"
cache-environment: true
environment-file: conda-environment-dev.yml
post-cleanup: "all"

- name: Install dependencies
run: |
sudo apt-get update && sudo apt-get install -y libsasl2-dev libldap2-dev libssl-dev
python -m pip install --upgrade pip
python -m pip install poetry --user
python -m poetry install --extras=tango
run: "${MAMBA_EXE} run --name mxcubecore poetry install --only=main --extras=tango"

- name: Run and write pytest
run: |
set -o pipefail
poetry run pytest --cov=mxcubecore --junitxml=pytest.xml --cov-report=term-missing:skip-covered | tee pytest-coverage.txt
${MAMBA_EXE} run --name mxcubecore pytest --cov=mxcubecore --junitxml=pytest.xml --cov-report=term-missing:skip-covered | tee pytest-coverage.txt
- name: Pytest coverage comment
id: coverage-comment
Expand Down
27 changes: 10 additions & 17 deletions .github/workflows/pages.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,31 +21,24 @@ jobs:
- name: "Checkout"
uses: "actions/checkout@v4" # tested with v4.1.0

- name: "Set up Python 3.8"
uses: "actions/setup-python@v4" # tested with v4.7.0
- name: "Setup conda environment with micromamba"
uses: "mamba-org/setup-micromamba@v1"
with:
python-version: "3.8"

- name: "Install OpenLDAP's dev package with apt"
run: |
sudo apt-get update
sudo apt-get install --no-install-recommends --yes libldap2-dev libsasl2-dev
cache-environment: true
environment-file: "conda-environment-dev.yml"
post-cleanup: "all"

- name: "Install dependencies with Poetry"
run: |
python -m pip install --upgrade pip
python -m pip install poetry --user
python -m poetry install --only=docs,main
run: "${MAMBA_EXE} run --name mxcubecore poetry install --only=docs,main"

- name: "Build documentation with Sphinx"
run: |
poetry run make --directory=./docs/ html
run: "${MAMBA_EXE} run --name mxcubecore make --directory=./docs/ html"

- name: "Upload artifact for GitHub Pages"
# This could potentially be run only when we intend to deploy...
# ...but it can be useful to have the artifact for debugging
# if: "github.ref_name == github.event.repository.default_branch"
uses: "actions/upload-pages-artifact@v2" # tested with v2.0.0
uses: "actions/upload-pages-artifact@v3"
with:
path: "docs/build/html"

Expand All @@ -69,11 +62,11 @@ jobs:
steps:

- name: "Setup GitHub Pages"
uses: "actions/configure-pages@v3" # tested with v3.0.6
uses: "actions/configure-pages@v4"

- name: "Deploy to GitHub Pages"
id: "deployment"
uses: "actions/deploy-pages@v2" # tested with 2.0.4
uses: "actions/deploy-pages@v4"


... # EOF
29 changes: 13 additions & 16 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,21 @@ jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Set up Python 3.8
uses: actions/setup-python@v4
# Python 3.8 because we want lowest supported version for syntax checks (format, lint)
- name: Setup conda environment with micromamba
uses: mamba-org/setup-micromamba@v1
with:
python-version: "3.8"
cache-environment: true
create-args: >-
python=3.8
environment-file: conda-environment-dev.yml
post-cleanup: all

- name: Install openldap
run: |
sudo apt-get update && sudo apt-get upgrade -y
sudo apt-get install -y libldap2-dev libsasl2-dev slapd ldap-utils tox lcov valgrind
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install poetry --user
python -m poetry install
# `pre-commit` is listed as a `dev` dependency in `pyproject.toml`
- name: Install dependencies with Poetry
run: "${MAMBA_EXE} run --name mxcubecore poetry install --only=dev"

- name: Run Pre-Commit
run: |
poetry run pre-commit run --all-files
run: "${MAMBA_EXE} run --name mxcubecore pre-commit run --all-files"
26 changes: 12 additions & 14 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,22 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10"]
python-version: ["3.8", "3.9", "3.10"]
steps:
- uses: actions/checkout@v3
- name: Checkout
uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
- name: Setup conda environment with micromamba for Python ${{ matrix.python-version }}
uses: mamba-org/setup-micromamba@v1
with:
python-version: ${{ matrix.python-version }}

- name: Install openldap
run: sudo apt-get update && sudo apt-get install -y libldap2-dev libsasl2-dev slapd ldap-utils tox lcov valgrind
cache-environment: true
create-args: >-
python=${{ matrix.python-version }}
environment-file: conda-environment-dev.yml
post-cleanup: all

- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install poetry --user
python -m poetry install --extras=tango
run: "${MAMBA_EXE} run --name mxcubecore poetry install --extras=tango --only=dev,main"

- name: Test with pytest
run: |
python -m poetry run pytest --no-cov
run: "${MAMBA_EXE} run --name mxcubecore pytest --no-cov"

0 comments on commit b4c5748

Please sign in to comment.