Skip to content

Commit f7a2cf5

Browse files
committed
Migrate to GitHub Actions
1 parent 2613780 commit f7a2cf5

File tree

6 files changed

+111
-19
lines changed

6 files changed

+111
-19
lines changed

.github/workflows/docker.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Docker image
2+
3+
on:
4+
push:
5+
# Publish `main` as Docker `latest` image.
6+
branches:
7+
- main
8+
9+
# Publish `v1.2.3` tags as releases.
10+
tags:
11+
- v*
12+
13+
pull_request:
14+
15+
env:
16+
IMAGE_NAME: cellsium
17+
18+
jobs:
19+
# See also https://docs.docker.com/docker-hub/builds/
20+
push:
21+
runs-on: ubuntu-latest
22+
permissions:
23+
packages: write
24+
contents: read
25+
26+
steps:
27+
- uses: actions/checkout@v2
28+
29+
- name: Build image
30+
run: docker build . --file Dockerfile --tag $IMAGE_NAME --label "runnumber=${GITHUB_RUN_ID}"
31+
32+
- name: Log in to registry
33+
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
34+
35+
- name: Push image
36+
run: |
37+
IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME
38+
39+
# Change all uppercase to lowercase
40+
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
41+
# Strip git ref prefix from version
42+
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
43+
# Strip "v" prefix from tag name
44+
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
45+
# Use Docker `latest` tag convention
46+
[ "$VERSION" == "main" ] && VERSION=latest
47+
echo IMAGE_ID=$IMAGE_ID
48+
echo VERSION=$VERSION
49+
docker tag $IMAGE_NAME $IMAGE_ID:$VERSION
50+
docker push $IMAGE_ID:$VERSION

.github/workflows/python-package.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Python package
2+
3+
on: [push]
4+
5+
jobs:
6+
build:
7+
runs-on: ubuntu-latest
8+
strategy:
9+
matrix:
10+
python-versions: [3.8]
11+
12+
steps:
13+
- uses: actions/checkout@v2
14+
- uses: actions/setup-python@v2
15+
with:
16+
python-version: ${{ matrix.python-version }}
17+
- name: Install dependencies
18+
run: |
19+
python -m pip install --upgrade pip wheel build
20+
- name: Building packages
21+
run: python -m build
22+
- uses: actions/upload-artifact@v2
23+
with:
24+
name: cellsium-package
25+
path: dist/*

.github/workflows/python-test.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Python tests
2+
3+
on: [push]
4+
5+
jobs:
6+
build:
7+
runs-on: ubuntu-latest
8+
strategy:
9+
matrix:
10+
python-versions: [3.8]
11+
12+
steps:
13+
- uses: actions/checkout@v2
14+
- uses: actions/setup-python@v2
15+
with:
16+
python-version: ${{ matrix.python-version }}
17+
- name: Install dependencies
18+
run: |
19+
python -m pip install --upgrade pip wheel
20+
pip install ".[check,test,doc]"
21+
- name: Syntax check with black
22+
run: black --check cellsium
23+
- name: Syntax check with isort
24+
run: isort --check cellsium
25+
- name: Syntax check with pflake8
26+
run: pflake8 cellsium
27+
- name: unittests with pytest
28+
run: pytest
29+
- uses: codecov/codecov-action@v2

.travis.yml

Lines changed: 0 additions & 12 deletions
This file was deleted.

README.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@ CellSium Readme
99
.. image:: https://img.shields.io/badge/docs-latest-brightgreen.svg?style=flat
1010
:target: https://cellsium.readthedocs.io/en/latest/
1111

12-
.. image:: https://api.travis-ci.com/modsim/CellSium.svg?branch=main
13-
:target: https://app.travis-ci.com/github/modsim/CellSium
12+
.. image:: https://github.com/modsim/CellSium/actions/workflows/python-test.yml/badge.svg
13+
:target: https://github.com/modsim/CellSium/actions/workflows/python-test.yml
1414

1515
.. image:: https://codecov.io/gh/modsim/CellSium/branch/main/graph/badge.svg?token=L36RQXYBW7
1616
:target: https://codecov.io/gh/modsim/CellSium
1717

18-
.. image:: https://img.shields.io/docker/build/modsim/cellsium.svg
19-
:target: https://hub.docker.com/r/modsim/cellsium
18+
.. image:: https://img.shields.io/badge/Docker-image-green?logo=docker
19+
:target: https://github.com/modsim/CellSium/pkgs/container/cellsium
2020

2121
.. image:: https://img.shields.io/pypi/l/cellsium.svg
2222
:target: https://opensource.org/licenses/BSD-2-Clause
@@ -118,10 +118,10 @@ An alternative to installing CellSium locally is running it via Docker. To run C
118118

119119
.. code-block:: bash
120120
121-
> docker run --tty --interactive --rm --volume `pwd`:/data --user `id -u` cellsium
121+
> docker run --tty --interactive --rm --volume `pwd`:/data --user `id -u` ghcr.io/modsim/cellsium
122122
123123
To use interactive (GUI) elements such as the :code:`PlotRenderer`, an X server must be reachable; under Linux the following command can be used:
124124

125125
.. code-block:: bash
126126
127-
> docker run --tty --interactive --rm --volume `pwd`:/data --user `id -u` --env DISPLAY=$DISPLAY --volume /tmp/.X11-unix:/tmp/.X11-unix cellsium
127+
> docker run --tty --interactive --rm --volume `pwd`:/data --user `id -u` --env DISPLAY=$DISPLAY --volume /tmp/.X11-unix:/tmp/.X11-unix ghcr.io/modsim/cellsium

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ multi_line_output = 3
5757

5858
[tool.pytest.ini_options]
5959
minversion = "6.0"
60-
addopts = "--cov=cellsium -vv --durations=0"
60+
addopts = "--cov=cellsium --cov-report=xml -vv --durations=0"
6161

6262
[tool.flake8]
6363
max-line-length = 88

0 commit comments

Comments
 (0)