Skip to content

Commit

Permalink
Use GitHub actions for continuous-integration (#28)
Browse files Browse the repository at this point in the history
This change replaces GitLab CI/CD config with its GitHub actions
counterpart.
  • Loading branch information
tristan0x authored Mar 15, 2024
1 parent e08a5a0 commit c0cdb6c
Show file tree
Hide file tree
Showing 8 changed files with 99 additions and 104 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/check-packaging.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Check packaging
on:
pull_request:
push:
branches:
- main
jobs:
check-packaging:
name: Build and check the distribution package
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install test dependencies
run: |
python3 -m pip install --upgrade pip setuptools
python3 -m pip install tox-gh-actions
- name: Run tox
run: |
tox -e check-packaging
20 changes: 20 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Static code analysis
on:
pull_request:
push:
branches:
- main
jobs:
lint:
name: Perform static analysis of the code
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install test dependencies
run: |
python3 -m pip install --upgrade pip setuptools
python3 -m pip install tox-gh-actions
- name: Run tox
run: |
tox -e lint
23 changes: 23 additions & 0 deletions .github/workflows/publish-sdist.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Publish source tarball to PyPi
on:
push:
tags:
- '*'
jobs:
build-n-publish:
name: Build and publish the release on PyPI
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.12
uses: actions/setup-python@v4
with:
python-version: "3.12"
- name: Build a source tarball
run: |
python setup.py sdist
- name: Publish distribution package to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_PASSWORD }}
32 changes: 32 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Test the contribution
on:
pull_request:
push:
branches:
- main
env:
apt_options: -o Acquire::Retries=3
PETSC_DIR: /usr/lib/petscdir/petsc3.15/x86_64-linux-gnu-real
jobs:
test:
name: Build and test the contribution
runs-on: ubuntu-latest
steps:
- name: Setup MPI
uses: mpi4py/setup-mpi@v1
with:
mpi: openmpi
- name: Checkout repository
uses: actions/checkout@v3
- name: Install system packages
run: |
sudo apt-get ${{env.apt_options}} update -y
sudo apt-get ${{env.apt_options}} install python3-petsc4py python3-mpi4py libopenmpi-dev libpetsc-real3.15-dev
- name: Install test dependencies
run: |
python -m pip install --upgrade pip setuptools
python -m pip install tox-gh-actions
- name: Run tox
run: tox
env:
PYTHONPATH: ${{env.PETSC_DIR}}/lib/python3/dist-packages
93 changes: 0 additions & 93 deletions .gitlab-ci.yml

This file was deleted.

2 changes: 0 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
default_language_version:
python: python3.11
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"h5py",
"networkx",
"morphio",
"mpi4py",
"vascpy",
"matplotlib",
"seaborn",
Expand Down
12 changes: 3 additions & 9 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -41,24 +41,18 @@ commands =
twine check {envtmpdir}/dist/*

[testenv:lint]
skip_install = true
allowlist_externals = bash
deps =
codespell
pre-commit
pylint
pylint-exit
commands =
codespell --config .codespellrc -i 3 -x .codespellignorelines -w {[base]files} README.md CHANGELOG.md docs/source
pre-commit run --all-files --show-diff-on-failure
bash -c "pylint -j {env:PYLINT_NPROCS:1} {[base]files} || pylint-exit $?"

[testenv:format]
skip_install = true
deps =
codespell
pre-commit
commands =
codespell --config .codespellrc -i 3 -x .codespellignorelines -w {[base]files} README.md CHANGELOG.md docs/source
pre-commit run --all-files

[testenv:docs]
changedir = docs
extras = docs
Expand Down

0 comments on commit c0cdb6c

Please sign in to comment.