Skip to content

Commit

Permalink
Merge pull request #259 from roocs/ci-updates-docker
Browse files Browse the repository at this point in the history
CI updates and test build docker image
  • Loading branch information
Zeitsperre authored Oct 22, 2024
2 parents ab84046 + 3ac9db9 commit 2e0140f
Show file tree
Hide file tree
Showing 107 changed files with 1,238 additions and 576 deletions.
6 changes: 3 additions & 3 deletions .codacy.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
---
engines:
pylint:
enabled: true
python_version: 3
pylint:
enabled: true
python_version: 3
exclude_paths:
- 'tests/**'
- 'docs/source/conf.py'
45 changes: 25 additions & 20 deletions .cruft.json
Original file line number Diff line number Diff line change
@@ -1,23 +1,28 @@
{
"template": "https://github.com/bird-house/cookiecutter-birdhouse.git",
"commit": "be4eeb281ac2a027c2128c4ef84894ba559c8c24",
"context": {
"cookiecutter": {
"full_name": "Carsten Ehbrecht",
"email": "[email protected]",
"github_username": "roocs",
"project_name": "rook",
"project_slug": "rook",
"project_repo_name": "rook",
"project_readthedocs_name": "rook",
"project_short_description": "A WPS service for roocs.",
"version": "0.13.1",
"open_source_license": "Apache Software License 2.0",
"http_port": "5000",
"_copy_without_render": [
"{{cookiecutter.project_slug}}/templates/*.cfg"
],
"_template": "https://github.com/bird-house/cookiecutter-birdhouse.git"
}
"template": "https://github.com/bird-house/cookiecutter-birdhouse.git",
"commit": "d25191ecc41c091d9b4a392f0ac89d70ff27db55",
"context": {
"cookiecutter": {
"full_name": "Carsten Ehbrecht",
"email": "[email protected]",
"github_username": "roocs",
"project_name": "rook",
"project_slug": "rook",
"project_repo_name": "rook",
"project_readthedocs_name": "rook",
"project_short_description": "A WPS service for roocs.",
"version": "0.13.1",
"open_source_license": "Apache Software License 2.0",
"http_port": "5000",
"use_pytest": "y",
"use_black": "n",
"create_author_file": "y",
"_copy_without_render": [
"{{cookiecutter.project_slug}}/templates/*.cfg"
],
"__gh_slug": "roocs/rook",
"_template": "https://github.com/bird-house/cookiecutter-birdhouse.git"
}
},
"checkout": null
}
55 changes: 55 additions & 0 deletions .github/workflows/docker-testing.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Docker-based Testing Suite

on:
push:
branches:
- master
pull_request:

concurrency:
# For a given workflow, if we push to the same branch, cancel all previous builds on that branch except on master.
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}

permissions:
contents: read

jobs:
build:
name: Build and Test Docker image
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1
with:
disable-sudo: true
egress-policy: audit
- name: Checkout Repository
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Login to Docker Hub
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@988b5a0280414f521da01fcc63a27aeeb4b104db # v3.6.1
- name: Build Docker image (no push)
uses: docker/build-push-action@5cd11c3a4ced054e52742c5fd54dca954e0edd85 # v6.7.0
with:
context: .
file: "Dockerfile"
tags: localrook:latest
load: true
cache-from: type=gha
cache-to: type=gha,mode=max
push: false
- name: Run Docker image
uses: addnab/docker-run-action@4f65fabd2431ebc8d299f8e5a018d79a769ae185 # v3
with:
image: localrook:latest
options: -p 5000:5000
run: |
rook start -d
sleep 2s
rook status
rook stop
135 changes: 98 additions & 37 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,50 +1,111 @@
name: build ⚙️

on: [ push, pull_request ]
on:
push:
branches:
- master
pull_request:

concurrency:
# For a given workflow, if we push to the same branch, cancel all previous builds on that branch except on master.
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}

permissions:
contents: read

jobs:
build:
lint:
name: Lint (Python${{ matrix.python-version }})
runs-on: ubuntu-latest
strategy:
matrix:
python-version:
- "3.9"
steps:
- name: Harden Runner
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
with:
disable-sudo: true
egress-policy: block
allowed-endpoints: >
files.pythonhosted.org:443
github.com:443
pypi.org:443
- name: Checkout Repository
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Setup Python${{ matrix.python-version }}
uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0
with:
python-version: ${{ matrix.python-version }}
cache: pip
- name: Install linting libraries
run: |
python -m pip install flake8
- name: Run Lint 📦
run: |
make lint
build:
name: Conda Build with Python${{ matrix.python-version }}
needs: lint
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11"]
python-version: ["3.9", "3.10", "3.11" ] # "3.12"
defaults:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v3
- name: Install packages
run: |
sudo apt-get -y install pandoc graphviz
- name: Setup Conda (Micromamba) with Python${{ matrix.python-version }}
uses: mamba-org/setup-micromamba@v1
with:
cache-downloads: true
cache-environment: true
environment-file: environment.yml
create-args: >-
conda
python=${{ matrix.python-version }}
- name: Conda and Mamba versions
run: |
conda --version
echo "micromamba: $(micromamba --version)"
- name: Install requirements 📦
run: |
python -m pip install --upgrade pip
pip install -e .
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
if [ -f requirements_dev.txt ]; then pip install -r requirements_dev.txt; fi
- name: Test with pytest ⚙️
run: make test
- name: Lint with flake8 ⚙️
run: make lint
if: matrix.python-version == 3.9
# - name: Check formatting with black ⚙️
# run: black --check --target-version py39 rook tests
# if: matrix.python-version == 3.9
- name: Build docs 🏗️
run: make docs
if: matrix.python-version == 3.9
- name: Checkout Repository
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Install packages
run: |
sudo apt-get -y install pandoc graphviz
- name: Setup Conda (Micromamba) with Python${{ matrix.python-version }}
uses: mamba-org/setup-micromamba@f8b8a1e23a26f60a44c853292711bacfd3eac822 # v1.9.0
with:
cache-downloads: true
cache-environment: true
environment-file: environment.yml
create-args: >-
python=${{ matrix.python-version }}
micromamba-version: 1.5.10-0 # Pin micromamba version because of following issue: https://github.com/mamba-org/setup-micromamba/issues/225
- name: Install requirements 📦
run: |
python -m pip install -e ".[dev]"
- name: Test with pytest ⚙️
run: |
pytest -v -m "not slow and not online" tests
docs:
name: Docs (Python${{ matrix.python-version }})
needs: lint
runs-on: ubuntu-latest
strategy:
matrix:
python-version:
- "3.9"
steps:
- name: Harden Runner
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
with:
disable-sudo: true
egress-policy: block
allowed-endpoints: >
files.pythonhosted.org:443
github.com:443
pypi.org:443
- name: Checkout Repository
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Setup Python${{ matrix.python-version }}
uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0
with:
python-version: ${{ matrix.python-version }}
cache: pip
- name: Install rook with dev requirements 📦
run: |
python -m pip install -e ".[dev]"
- name: Build Docs 📚
run: |
make docs
Loading

0 comments on commit 2e0140f

Please sign in to comment.