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 d05d4a0
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 63 deletions.
26 changes: 13 additions & 13 deletions .github/workflows/coverage_report.yml
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
name: Coverage Report
on:
pull_request:
paths-ignore:
- 'doc/**'
- 'docs/**'
types: [opened, reopened, synchronize]
paths:
- '**.py'
jobs:
pytest-coverage:
runs-on: ubuntu-latest
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=dev,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 All @@ -40,7 +40,7 @@ jobs:

- name: Check the output coverage
run: |
echo "Coverage Percantage - ${{ steps.coverage-comment.outputs.coverage }}"
echo "Coverage Percentage - ${{ steps.coverage-comment.outputs.coverage }}"
echo "Coverage Warnings - ${{ steps.coverage-comment.outputs.warnings }}"
echo "Coverage Errors - ${{ steps.coverage-comment.outputs.errors }}"
echo "Coverage Failures - ${{ steps.coverage-comment.outputs.failures }}"
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
24 changes: 7 additions & 17 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,19 @@
name: Linting & Code Quality
name: Pre-commit hooks
on:
pull_request:
types: [opened, reopened, synchronize]
jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Checkout
uses: actions/checkout@v4

# Python 3.8 because we want lowest supported version for syntax checks (format, lint)
- name: Set up Python 3.8
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: "3.8"

- 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
- name: Run Pre-Commit
run: |
poetry run pre-commit run --all-files
- name: Run pre-commit hooks
uses: pre-commit/[email protected]
31 changes: 15 additions & 16 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,31 @@
name: Pytest
on:
pull_request:
paths-ignore:
- "doc/**"
- "docs/**"
types: [opened, reopened, synchronize]
paths:
- '**.py'
jobs:
Python:
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 d05d4a0

Please sign in to comment.