-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0b7264e
commit c2f1ba2
Showing
30 changed files
with
1,896 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,150 @@ | ||
name: Build | ||
|
||
on: | ||
push: | ||
|
||
jobs: | ||
package: | ||
name: Python Package | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Check out repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: 3.12 | ||
cache: pip | ||
cache-dependency-path: | | ||
**/pyproject.toml | ||
**/requirements*.txt | ||
- name: Prepare Python env | ||
run: | | ||
python -m pip install -U pip setuptools wheel | ||
- name: Create build info | ||
run: | | ||
bash scripts/build-info.sh | ||
- name: Install dependencies | ||
run: | | ||
pip install -r requirements.txt | ||
- name: Install package | ||
run: | | ||
pip install . | ||
- name: Build package sdist | ||
run: | | ||
python setup.py sdist | ||
- name: Build package bdist (wheel) | ||
run: | | ||
python setup.py bdist_wheel | ||
docker: | ||
name: Docker | ||
runs-on: ubuntu-latest | ||
|
||
env: | ||
PUBLIC_IMAGE_PREFIX: ${{ secrets.DOCKER_HUB_USERNAME }} | ||
DOCKER_IMAGE_NAME: 'dsw-seed-maker' | ||
DOCKER_META_CONTEXT: '.' | ||
DOCKER_META_FILE: 'Dockerfile' | ||
DOCKER_META_PLATFORMS: 'linux/amd64,linux/arm64' | ||
|
||
steps: | ||
- name: Check out repository | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v2 | ||
|
||
- name: Set up Docker Buildx | ||
id: buildx | ||
uses: docker/setup-buildx-action@v2 | ||
|
||
- name: Create build info | ||
run: | | ||
bash scripts/build-info.sh | ||
# TEST DOCKER IMAGE BUILD | ||
- name: Docker meta [test] | ||
id: meta-test | ||
uses: docker/metadata-action@v4 | ||
with: | ||
images: | | ||
${{ env.PUBLIC_IMAGE_PREFIX }}/${{ env.DOCKER_IMAGE_NAME }} | ||
tags: | | ||
type=sha | ||
- name: Docker build [test] | ||
uses: docker/build-push-action@v4 | ||
with: | ||
context: ${{ env.DOCKER_META_CONTEXT }} | ||
file: ${{ env.DOCKER_META_FILE }} | ||
platforms: ${{ env.DOCKER_META_PLATFORMS }} | ||
push: false | ||
tags: ${{ steps.meta-test.outputs.tags }} | ||
labels: ${{ steps.meta-test.outputs.labels }} | ||
|
||
# PREPARE | ||
- name: Docker login [docker.io] | ||
if: github.event_name != 'pull_request' | ||
uses: docker/login-action@v2 | ||
with: | ||
username: ${{ secrets.DOCKER_HUB_USERNAME }} | ||
password: ${{ secrets.DOCKER_HUB_PASSWORD }} | ||
|
||
# DEVELOPMENT IMAGES | ||
- name: Docker meta [dev] | ||
id: meta-dev | ||
if: github.event_name != 'pull_request' | ||
uses: docker/metadata-action@v4 | ||
with: | ||
images: | | ||
${{ secrets.DOCKER_HUB_USERNAME }}/${{ env.DOCKER_IMAGE_NAME }} | ||
tags: | | ||
type=ref,event=branch | ||
- name: Docker build+push [dev] | ||
uses: docker/build-push-action@v4 | ||
if: github.event_name != 'pull_request' && steps.meta-dev.outputs.tags != '' | ||
with: | ||
context: ${{ env.DOCKER_META_CONTEXT }} | ||
file: ${{ env.DOCKER_META_FILE }} | ||
platforms: ${{ env.DOCKER_META_PLATFORMS }} | ||
push: true | ||
tags: ${{ steps.meta-dev.outputs.tags }} | ||
labels: ${{ steps.meta-dev.outputs.labels }} | ||
|
||
# PUBLIC IMAGES (latest, semver) | ||
- name: Docker meta [public] | ||
id: meta-public | ||
if: github.event_name != 'pull_request' | ||
uses: docker/metadata-action@v4 | ||
with: | ||
images: | | ||
${{ env.PUBLIC_IMAGE_PREFIX }}/${{ env.DOCKER_IMAGE_NAME }} | ||
tags: | | ||
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') }} | ||
type=semver,pattern={{version}} | ||
type=semver,pattern={{major}}.{{minor}} | ||
type=semver,pattern={{major}},enable=${{ !startsWith(github.ref, 'refs/tags/v0.') }} | ||
- name: Docker build+push [public] | ||
uses: docker/build-push-action@v4 | ||
if: github.event_name != 'pull_request' && steps.meta-public.outputs.tags != '' | ||
with: | ||
context: ${{ env.DOCKER_META_CONTEXT }} | ||
file: ${{ env.DOCKER_META_FILE }} | ||
platforms: ${{ env.DOCKER_META_PLATFORMS }} | ||
push: true | ||
tags: ${{ steps.meta-public.outputs.tags }} | ||
labels: ${{ steps.meta-public.outputs.labels }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
name: Code Style | ||
|
||
on: | ||
push: | ||
|
||
jobs: | ||
# Flake 8 for basic code style checks | ||
flake8: | ||
name: Flake 8 | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Check out repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: 3.12 | ||
cache: pip | ||
cache-dependency-path: | | ||
**/pyproject.toml | ||
**/requirements*.txt | ||
- name: Create build info | ||
run: | | ||
bash scripts/build-info.sh | ||
- name: Install Flake8 (5.0.4) | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install flake8==5.0.4 | ||
- name: Install dependencies | ||
run: | | ||
pip install -r requirements.txt | ||
- name: Install package | ||
run: | | ||
pip install . | ||
- name: Lint with flake8 | ||
run: | | ||
flake8 src/dsw_seed_maker --count --select=E9,F63,F7,F82 --show-source --statistics | ||
flake8 src/dsw_seed_maker --count --max-complexity=12 --max-line-length=130 --statistics | ||
# Typing checks with MyPy | ||
typing: | ||
name: Typing | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Check out repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: 3.12 | ||
cache: pip | ||
cache-dependency-path: | | ||
**/pyproject.toml | ||
**/requirements*.txt | ||
- name: Create build info | ||
run: | | ||
bash scripts/build-info.sh | ||
- name: Install MyPy (1.4.1) | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install mypy==1.4.1 | ||
- name: Install dependencies | ||
run: | | ||
pip install -r requirements.txt | ||
- name: Install packages | ||
run: | | ||
pip install . | ||
- name: Check typing with MyPy | ||
run: | | ||
mypy --install-types --ignore-missing-imports --check-untyped-defs --non-interactive src/dsw_seed_maker | ||
# Pylint linting | ||
pylint: | ||
name: Pylint | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Check out repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: 3.12 | ||
cache: pip | ||
cache-dependency-path: | | ||
**/pyproject.toml | ||
**/requirements*.txt | ||
- name: Create build info | ||
run: | | ||
bash scripts/build-info.sh | ||
- name: Install PyLint (3.2.5) | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install pylint==3.2.5 | ||
- name: Install dependencies | ||
run: | | ||
pip install -r requirements.txt | ||
- name: Install packages | ||
run: | | ||
pip install . | ||
- name: Lint with PyLint | ||
run: | | ||
pylint --rcfile=.pylintrc.ini src/dsw_seed_maker |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.