-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: add container gh packaging (#28)
- Loading branch information
Showing
9 changed files
with
176 additions
and
0 deletions.
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
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,78 @@ | ||
# This workflow uses actions that are not certified by GitHub. | ||
# They are provided by a third-party and are governed by | ||
# separate terms of service, privacy policy, and support | ||
# documentation. | ||
|
||
# GitHub recommends pinning actions to a commit SHA. | ||
# To get a newer version, you will need to update the SHA. | ||
# You can also reference a tag or branch, but the action may change without warning. | ||
--- | ||
name: Create and publish a Container image | ||
|
||
on: | ||
push: | ||
branches: | ||
- "master" | ||
tags: | ||
- "v*" | ||
env: | ||
REGISTRY: ghcr.io | ||
IMAGE_NAME: ngine-io/chaotic | ||
|
||
jobs: | ||
build-and-push-image: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.x" | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -U setuptools wheel | ||
- name: Build | ||
run: | | ||
python setup.py sdist bdist_wheel | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v2 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
|
||
- name: Log in to the Container registry | ||
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta | ||
uses: docker/metadata-action@c4ee3adeed93b1fa6a762f209fb01608c1a22f1e | ||
with: | ||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | ||
tags: | | ||
type=ref,event=branch | ||
type=semver,pattern={{version}} | ||
type=semver,pattern={{major}}.{{minor}} | ||
- name: Build and push Docker image | ||
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671 | ||
with: | ||
context: . | ||
push: true | ||
pull: true | ||
platforms: linux/arm64,linux/amd64 | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.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,15 @@ | ||
FROM docker.io/python:3.11.3-slim | ||
|
||
WORKDIR /build | ||
COPY . . | ||
|
||
RUN pip install . | ||
|
||
WORKDIR /app | ||
|
||
RUN rm -rf /build | ||
COPY ./docker/config.yaml . | ||
|
||
USER 1000 | ||
|
||
ENTRYPOINT ["chaotic-ngine"] |
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,21 @@ | ||
clean: | ||
rm -rf *.egg-info | ||
rm -rf *.dist-info | ||
rm -rf dist | ||
rm -rf build | ||
find -name '__pycache__' -exec rm -fr {} || true \; | ||
|
||
build: clean | ||
python3 setup.py sdist bdist_wheel | ||
|
||
test-release: | ||
twine upload --repository testpypi dist/* | ||
|
||
release: | ||
twine upload dist/* | ||
|
||
test: | ||
tox | ||
|
||
update: | ||
pip-compile -U --no-header --no-annotate --strip-extras --resolver backtracking |
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,5 @@ | ||
include *.txt | ||
include *.yml | ||
include tox.ini | ||
graft tests | ||
global-exclude *.py[cod] |
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,4 @@ | ||
--- | ||
kind: unset | ||
dry_run: true | ||
configs: {} |
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,10 @@ | ||
cloudscale-sdk | ||
cs | ||
hcloud | ||
proxmoxer<2.0 | ||
python-digitalocean | ||
python-dotenv | ||
python-json-logger | ||
pyyaml | ||
requests | ||
schedule |
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 |
---|---|---|
@@ -1,10 +1,19 @@ | ||
certifi==2022.12.7 | ||
charset-normalizer==3.1.0 | ||
cloudscale-sdk==0.7.0 | ||
cs==3.0.0 | ||
hcloud==1.19.0 | ||
idna==3.4 | ||
jsonpickle==3.0.1 | ||
proxmoxer==1.3.1 | ||
python-dateutil==2.8.2 | ||
python-digitalocean==1.17.0 | ||
python-dotenv==1.0.0 | ||
python-json-logger==2.0.7 | ||
pytz==2023.3 | ||
pyyaml==6.0 | ||
requests==2.29.0 | ||
schedule==1.2.0 | ||
six==1.16.0 | ||
urllib3==1.26.15 | ||
xdg==6.0.0 |
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,30 @@ | ||
[tox] | ||
envlist = py{310,311} | ||
skip_missing_interpreters = True | ||
skipsdist = True | ||
|
||
[gh-actions] | ||
python = | ||
3.10: py310 | ||
3.11: py311 | ||
|
||
[testenv] | ||
changedir = tests | ||
deps = | ||
-r{toxinidir}/requirements.txt | ||
-r{toxinidir}/requirements.dev.txt | ||
commands = | ||
python --version | ||
pytest -v --cov --cov-append --cov-report=xml | ||
|
||
[testenv:report] | ||
deps = coverage | ||
skip_install = true | ||
commands = | ||
coverage report | ||
coverage html | ||
|
||
[testenv:clean] | ||
deps = coverage | ||
skip_install = true | ||
commands = coverage erase |