Skip to content

Commit

Permalink
Update workflows (#506)
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasturcani committed Jul 6, 2023
1 parent 990bc57 commit 3edb31d
Show file tree
Hide file tree
Showing 6 changed files with 69 additions and 231 deletions.
41 changes: 0 additions & 41 deletions .github/workflows/build_and_publish_testing_image.yml

This file was deleted.

31 changes: 9 additions & 22 deletions .github/workflows/publish_release.yml
Original file line number Diff line number Diff line change
@@ -1,36 +1,23 @@
name: Publish release

on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+.[0-9]+'

jobs:
publish-release:
runs-on: ubuntu-22.04
container:
image: ghcr.io/lukasturcani/stk-test-environment

env:
VERSION: ${{ github.ref_name }}

steps:
- name: Git checkout
uses: actions/checkout@v2
- name: Install stk
run: |
. /deps/venv/bin/activate
pip install --no-deps -e .
- name: Build stk
run: |
. /deps/venv/bin/activate
pip freeze --all
ls -al src/stk
python -m build
- name: Publish stk
run: >
. /deps/venv/bin/activate
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.11"
cache: "pip"
- run: pip install -e '.[dev]'
- run: python -m build
- name: Publish
run:
twine upload
-u ${{ secrets.PYPI_USERNAME }}
-p ${{ secrets.PYPI_PASSWORD }}
Expand Down
203 changes: 60 additions & 143 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,195 +1,112 @@
name: Tests

on:
push:
branches:
- master
pull_request:
workflow_dispatch:

jobs:
ruff:
runs-on: ubuntu-22.04
container:
image: ghcr.io/lukasturcani/stk-test-environment

steps:
- name: Git checkout
uses: actions/checkout@v3

- name: Install stk
run: |
. /deps/venv/bin/activate
pip install --no-deps -e .
- name: Run ruff
run: |
. /deps/venv/bin/activate
ruff .
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.11"
cache: "pip"
- run: "pip install '.[dev]'"
- run: ruff .
mypy:
runs-on: ubuntu-22.04
container:
image: ghcr.io/lukasturcani/stk-test-environment

steps:
- name: Git checkout
uses: actions/checkout@v3

- name: Install stk
run: |
. /deps/venv/bin/activate
pip install --no-deps -e .
- name: Run mypy
run: |
. /deps/venv/bin/activate
mypy src
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.11"
cache: "pip"
- run: "pip install -e '.[dev]'"
- run: mypy src
black:
runs-on: ubuntu-22.04
container:
image: ghcr.io/lukasturcani/stk-test-environment

steps:
- name: Git checkout
uses: actions/checkout@v3

- name: Install stk
run: |
. /deps/venv/bin/activate
pip install --no-deps -e .
- name: Run black
run: |
. /deps/venv/bin/activate
black --check .
pytest-stable-linux:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.11"
cache: "pip"
- run: "pip install -e '.[dev]'"
- run: black --check .
pytest:
runs-on: ubuntu-22.04
container:
image: ghcr.io/lukasturcani/stk-test-environment

services:
MongoDB:
image: mongo

ports: ["27017:27017"]
steps:
- name: Git checkout
uses: actions/checkout@v3

- name: Install stk
run: |
. /deps/venv/bin/activate
pip install --no-deps -e .
- name: Run pytest
run: |
. /deps/venv/bin/activate
pytest --mongodb_uri='mongodb://MongoDB:27017/'
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.11"
cache: "pip"
- run: "pip install -e '.[dev]'"
- run: pytest
doctest:
runs-on: ubuntu-22.04
container:
image: ghcr.io/lukasturcani/stk-test-environment

services:
MongoDB:
image: mongo

ports: ["27017:27017"]
steps:
- name: Git checkout
uses: actions/checkout@v3

- name: Install stk
run: |
. /deps/venv/bin/activate
pip install --no-deps -e .
- name: Run doctest
run: |
. /deps/venv/bin/activate
MONGODB_URI='mongodb://MongoDB:27017/' make -C docs doctest
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.11"
cache: "pip"
- run: "pip install -e '.[dev]'"
- run: make -C docs doctest
basic-ea:
runs-on: ubuntu-22.04
container:
image: ghcr.io/lukasturcani/stk-test-environment

services:
MongoDB:
image: mongo

ports: ["27017:27017"]
steps:
- name: Git checkout
uses: actions/checkout@v3

- name: Install stk
run: |
. /deps/venv/bin/activate
pip install --no-deps -e .
- name: Install dependencies
run: git clone https://github.com/lukasturcani/basic_ea
--depth 1

- name: Run the EA
run: >
. /deps/venv/bin/activate
python basic_ea/basic_ea.py
--mongodb_uri mongodb://MongoDB:27017
- name: Upload fitness plot
uses: actions/upload-artifact@v2
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.11"
cache: "pip"
- run: "pip install -e '.[dev]'"
- run: git clone https://github.com/lukasturcani/basic_ea --depth 1
- run: python basic_ea/basic_ea.py
- uses: actions/upload-artifact@v2
with:
name: basic-ea-fitness-plot
path: fitness_progress.png

- name: Upload rotatable bonds plot
uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v2
with:
name: basic-ea-rotatable-bonds-plot
path: rotatable_bonds_progress.png

intermediate-ea:
runs-on: ubuntu-22.04
container:
image: ghcr.io/lukasturcani/stk-test-environment

services:
MongoDB:
image: mongo

ports: ["27017:27017"]
steps:
- name: Git checkout
uses: actions/checkout@v3

- name: Install stk
run: |
. /deps/venv/bin/activate
pip install --no-deps -e .
- name: Install dependencies
run: git clone
https://github.com/lukasturcani/intermediate_ea
--depth 1

- name: Run the EA
run: >
. /deps/venv/bin/activate
python intermediate_ea/intermediate_ea.py
--mongodb_uri mongodb://MongoDB:27017
- name: Upload fitness plot
uses: actions/upload-artifact@v2
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.11"
cache: "pip"
- run: "pip install -e '.[dev]'"
- run: git clone https://github.com/lukasturcani/intermediate_ea --depth 1
- run: python intermediate_ea/intermediate_ea.py
- uses: actions/upload-artifact@v2
with:
name: intermediate-ea-fitness-plot
path: fitness_progress.png

- name: Upload rotatable bonds plot
uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v2
with:
name: intermediate-ea-rotatable-bonds-plot
path: rotatable_bonds_progress.png
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
src/stk.egg-info
src/stk/_version.py
/.coverage
docker_testing_environment/requirements.txt
docs/source/_autosummary

**/__pycache__/
Expand Down
13 changes: 0 additions & 13 deletions docker_testing_environment/Dockerfile

This file was deleted.

11 changes: 0 additions & 11 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -40,17 +40,6 @@ fix:
black .
ruff --fix .

# Build the docker testing environment.
build-testing-environment:
pip-compile -o docker_testing_environment/requirements.txt --extra dev pyproject.toml
docker buildx build -t stk-test-environment:latest ./docker_testing_environment

# Enter the docker testing environment.
enter-docker:
docker run -it --rm \
--mount type=bind,source="$(pwd)",target=/code \
stk-test-environment:latest /bin/sh

# Start a MongoDB instance in docker.
mongo:
docker run -d --rm -p 27017:27017 --name mongo mongo:latest

0 comments on commit 3edb31d

Please sign in to comment.