Skip to content

Commit b86cad6

Browse files
Development (#20)
Fixes on pyproject, workflows, requirements, etc
2 parents 977f00e + aeb343d commit b86cad6

19 files changed

Lines changed: 388 additions & 318 deletions

.github/workflows/build.yaml

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ on:
99

1010
env:
1111
REGISTRY: ghcr.io
12+
PYTHON_VERSION: '3.10'
1213

1314
permissions:
1415
contents: read
@@ -17,10 +18,20 @@ jobs:
1718
lint:
1819
runs-on: ubuntu-latest
1920
steps:
20-
- uses: actions/checkout@v3.0.2
21-
- uses: ptxmac/yapf-action@master
21+
- uses: actions/checkout@v4
2222
with:
23-
args: --recursive --verbose
23+
fetch-depth: 0
24+
- name: Set up Python
25+
uses: actions/setup-python@v5
26+
with:
27+
python-version: ${{ env.PYTHON_VERSION }}
28+
- name: Install yapf
29+
run: |
30+
python -m pip install --upgrade pip
31+
pip install yapf
32+
- name: Run yapf
33+
run: |
34+
yapf --recursive --verbose --diff .
2435
2536
build:
2637
runs-on: ubuntu-latest
@@ -31,7 +42,7 @@ jobs:
3142
username: ${{ github.repository_owner }}
3243
password: ${{ secrets.REGISTRY_TOKEN }}
3344
steps:
34-
- uses: actions/checkout@v3.0.2
45+
- uses: actions/checkout@v4
3546
with:
3647
fetch-depth: 0
3748
set-safe-directory: true
@@ -41,14 +52,13 @@ jobs:
4152
- name: Install dependencies
4253
run: |
4354
python3 -m pip install --upgrade pip wheel setuptools setuptools-scm
44-
python3 -m pip install virtualenv
4555
python3 -m pip install build
4656
- name: Build package
4757
run: python3 -m build
4858
- name: Install snow
4959
run: pip install dist/*.tar.gz
5060
- name: Upload artifacts
51-
uses: actions/upload-artifact@v3
61+
uses: actions/upload-artifact@v4
5262
with:
5363
name: snow-artifacts
5464
path: dist/*
@@ -65,7 +75,7 @@ jobs:
6575
username: ${{ github.repository_owner }}
6676
password: ${{ secrets.REGISTRY_TOKEN }}
6777
steps:
68-
- uses: actions/checkout@v3.0.2
78+
- uses: actions/checkout@v4
6979
with:
7080
fetch-depth: 0
7181
set-safe-directory: true
@@ -76,16 +86,15 @@ jobs:
7686
# run: |
7787
# pip3 install pytest
7888
# pip3 install pytest-cov
79-
- uses: actions/download-artifact@v3
80-
id: download
89+
- uses: actions/download-artifact@v4
8190
with:
8291
name: snow-artifacts
8392
path: dist/
8493
- name: Install snow from artifacts
8594
run: pip3 install dist/*.tar.gz
8695
#- name: Test with pytest and pycov
87-
# run: pytest --cov=csromer --cov-report xml:coverage.xml --cov-report term-missing tests/ -W "ignore" -v
88-
#- uses: codecov/codecov-action@v2
96+
# run: pytest --cov=snow --cov-report xml:coverage.xml --cov-report term-missing tests/ -W "ignore" -v
97+
#- uses: codecov/codecov-action@v4
8998
# with:
9099
# token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos
91100
# files: ./coverage.xml

.github/workflows/build_base_container.yaml

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,31 +6,42 @@ on:
66
- feature/refactoring
77
- development
88
paths:
9-
- .github/build_base_container.yaml
9+
- .github/workflows/build_base_container.yaml
1010
- Dockerfile
1111
pull_request:
1212
branches:
1313
- master
14+
paths:
15+
- .github/workflows/build_base_container.yaml
16+
- Dockerfile
1417

1518
env:
1619
REGISTRY: ghcr.io
1720

21+
permissions:
22+
contents: read
23+
packages: write
24+
1825
jobs:
1926
build:
2027
runs-on: ubuntu-latest
2128
steps:
2229
- name: Checkout Code
23-
uses: actions/checkout@v3.0.2
30+
uses: actions/checkout@v4
2431
- name: Login to GitHub Container Registry
25-
uses: docker/login-action@v1
32+
uses: docker/login-action@v3
2633
with:
2734
registry: ${{ env.REGISTRY }}
2835
username: ${{ github.repository_owner }}
2936
password: ${{ secrets.REGISTRY_TOKEN }}
3037
- name: Setup Docker Buildx
31-
uses: docker/setup-buildx-action@v2
38+
uses: docker/setup-buildx-action@v3
3239
- name: Build and Push Docker Image
33-
uses: docker/build-push-action@v2
40+
uses: docker/build-push-action@v5
3441
with:
35-
push: true # Will only build if this is not here
42+
context: .
43+
file: ./Dockerfile
44+
push: true
3645
tags: ${{ env.REGISTRY }}/${{ github.repository }}:base
46+
cache-from: type=gha
47+
cache-to: type=gha,mode=max

.github/workflows/build_latest_container.yaml

Lines changed: 40 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,28 +5,41 @@ on:
55
branches: [master]
66
paths:
77
- '**.py'
8-
- .github/build_latest_container.yaml
8+
- .github/workflows/build_latest_container.yaml
99
- Dockerfile.prod
1010
release:
1111
types: [published]
1212

1313
env:
1414
REGISTRY: ghcr.io
15+
PYTHON_VERSION: '3.10'
16+
17+
permissions:
18+
contents: read
19+
packages: write
1520

1621
jobs:
1722
lint:
1823
runs-on: ubuntu-latest
1924
steps:
20-
- uses: actions/checkout@v3.0.2
25+
- uses: actions/checkout@v4
2126
with:
2227
fetch-depth: 0
2328
set-safe-directory: true
29+
- name: Set up Python
30+
uses: actions/setup-python@v5
31+
with:
32+
python-version: ${{ env.PYTHON_VERSION }}
2433
- name: Check git version and our path
2534
run: |
2635
git config --global --add safe.directory "$GITHUB_WORKSPACE"
27-
- uses: ptxmac/yapf-action@master
28-
with:
29-
args: --recursive --verbose
36+
- name: Install yapf
37+
run: |
38+
python -m pip install --upgrade pip
39+
pip install yapf
40+
- name: Run yapf
41+
run: |
42+
yapf --recursive --verbose --diff .
3043
build:
3144
runs-on: ubuntu-latest
3245
needs: lint
@@ -36,7 +49,7 @@ jobs:
3649
username: ${{ github.repository_owner }}
3750
password: ${{ secrets.REGISTRY_TOKEN }}
3851
steps:
39-
- uses: actions/checkout@v3.0.2
52+
- uses: actions/checkout@v4
4053
with:
4154
fetch-depth: 0
4255
set-safe-directory: true
@@ -46,15 +59,15 @@ jobs:
4659
- name: Install dependencies
4760
run: |
4861
python3 -m pip install --upgrade pip wheel setuptools setuptools-scm
49-
python3 -m pip install virtualenv
5062
python3 -m pip install build
5163
- name: Build package
5264
run: python3 -m build
5365
- name: Install snow
5466
run: pip install dist/*.tar.gz
5567
- name: Upload artifacts
56-
uses: actions/upload-artifact@v3
68+
uses: actions/upload-artifact@v4
5769
with:
70+
name: snow-artifacts
5871
path: dist/*
5972
- name: Run commands to test that everything is finished
6073
run: |
@@ -65,18 +78,32 @@ jobs:
6578
needs: build
6679
steps:
6780
- name: Checkout Code
68-
uses: actions/checkout@v1
81+
uses: actions/checkout@v4
82+
- name: Free up disk space
83+
run: |
84+
sudo rm -rf /usr/share/dotnet
85+
sudo rm -rf /opt/ghc
86+
sudo rm -rf /opt/hostedtoolcache/CodeQL
87+
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
88+
df -h
6989
- name: Login to GitHub Container Registry
70-
uses: docker/login-action@v1
90+
uses: docker/login-action@v3
7191
with:
7292
registry: ${{ env.REGISTRY }}
7393
username: ${{ github.repository_owner }}
7494
password: ${{ secrets.REGISTRY_TOKEN }}
7595
- name: Setup Docker Buildx
76-
uses: docker/setup-buildx-action@v2
96+
uses: docker/setup-buildx-action@v3
97+
- name: Prune Docker system
98+
run: docker system prune -af --volumes || true
7799
- name: Build and Push Docker Image
78-
uses: docker/build-push-action@v2
100+
uses: docker/build-push-action@v5
79101
with:
102+
context: .
80103
file: ./Dockerfile.prod
81-
push: true # Will only build if this is not here
104+
push: true
82105
tags: ${{ env.REGISTRY }}/${{ github.repository }}:latest
106+
cache-from: type=gha
107+
cache-to: type=gha,mode=max
108+
build-args: |
109+
BUILDKIT_INLINE_CACHE=1

.github/workflows/publishpypi.yaml

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ on:
1212
permissions:
1313
contents: read
1414

15+
env:
16+
PYTHON_VERSION: '3.10'
17+
1518
jobs:
1619
deploy:
1720
runs-on: ubuntu-latest
@@ -21,30 +24,23 @@ jobs:
2124
username: ${{ github.repository_owner }}
2225
password: ${{ secrets.REGISTRY_TOKEN }}
2326
steps:
24-
- uses: actions/checkout@v3.0.2
27+
- uses: actions/checkout@v4
2528
with:
2629
fetch-depth: 0
2730
set-safe-directory: true
2831
- name: Force directory safe
2932
run: |
3033
git config --global --add safe.directory "$GITHUB_WORKSPACE"
31-
- name: Set up Python
32-
uses: actions/setup-python@v3
33-
with:
34-
python-version: '3.8'
3534
- name: Install dependencies
3635
run: |
3736
python3 -m pip install --upgrade pip wheel setuptools setuptools-scm
38-
python3 -m pip install virtualenv
3937
python3 -m pip install build
4038
- name: Build package
4139
run: python3 -m build
42-
- name: Build bdist package
43-
run: python3 setup.py bdist_wheel
44-
- name: Publish package
45-
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
46-
uses: pypa/gh-action-pypi-publish@master
40+
- name: Publish package to PyPI
41+
uses: pypa/gh-action-pypi-publish@release/v1
4742
with:
4843
user: __token__
4944
password: ${{ secrets.PYPI_API_TOKEN }}
50-
verify_metadata: false
45+
verify_metadata: true
46+
skip_existing: false

.github/workflows/testpypi.yaml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,12 @@ on:
99
release:
1010
types: [draft]
1111

12-
1312
permissions:
1413
contents: read
1514

15+
env:
16+
PYTHON_VERSION: '3.10'
17+
1618
jobs:
1719
deploy:
1820
runs-on: ubuntu-latest
@@ -22,7 +24,7 @@ jobs:
2224
username: ${{ github.repository_owner }}
2325
password: ${{ secrets.REGISTRY_TOKEN }}
2426
steps:
25-
- uses: actions/checkout@v3.0.2
27+
- uses: actions/checkout@v4
2628
with:
2729
fetch-depth: 0
2830
set-safe-directory: true
@@ -32,15 +34,14 @@ jobs:
3234
- name: Install dependencies
3335
run: |
3436
python3 -m pip install --upgrade pip wheel setuptools setuptools-scm
35-
python3 -m pip install virtualenv
3637
python3 -m pip install build
3738
- name: Build package
3839
run: python3 -m build
39-
- name: Build bdist package
40-
run: python3 setup.py bdist_wheel
41-
- name: Publish package
42-
uses: pypa/gh-action-pypi-publish@master
40+
- name: Publish package to TestPyPI
41+
uses: pypa/gh-action-pypi-publish@release/v1
4342
with:
4443
user: __token__
4544
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
4645
repository_url: https://test.pypi.org/legacy/
46+
verify_metadata: true
47+
skip_existing: false

.pre-commit-config.yaml

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
repos:
22
- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
3-
rev: v2.12.0
3+
rev: v2.15.0
44
hooks:
55
- id: pretty-format-yaml
66
args: [--autofix, --indent, '2']
77
- id: pretty-format-toml
88
args: [--autofix]
99

1010
- repo: https://github.com/pre-commit/pre-commit-hooks
11-
rev: v4.5.0
11+
rev: v6.0.0
1212
hooks:
1313
- id: check-yaml
1414
- id: end-of-file-fixer
@@ -19,19 +19,23 @@ repos:
1919
# hooks:
2020
# id: black
2121
- repo: https://github.com/python-jsonschema/check-jsonschema
22-
rev: 0.27.3
22+
rev: 0.36.0
2323
hooks:
2424
- id: check-github-actions
2525
- id: check-github-workflows
2626

27-
- repo: https://github.com/pre-commit/mirrors-yapf
28-
rev: v0.32.0
27+
- repo: https://github.com/google/yapf
28+
rev: v0.43.0
2929
hooks:
3030
- id: yapf
31-
additional_dependencies: [toml]
31+
name: yapf
32+
language: python
33+
entry: yapf
34+
args: [-i]
35+
types: [python]
3236

3337
- repo: https://github.com/igorshubovych/markdownlint-cli
34-
rev: v0.38.0
38+
rev: v0.47.0
3539
hooks:
3640
- id: markdownlint-fix
3741
entry: markdownlint -f '**/*.md' --disable MD013 MD036 MD046 MD033 MD041 MD040

0 commit comments

Comments
 (0)