Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Building a self-contained package #39

Merged
merged 1 commit into from
Jul 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .github/workflows/publish-artifacts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,28 @@ on:
- '**'

jobs:
build-release-pkg:
name: Builds and publishes a self-contained package to the release
runs-on: ubuntu-latest
steps:
- name: Checkout main
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Write version
run: ./scripts/insert-version-pyproject.sh ${{github.ref_name}}

- name: Build package
run: |
make pkg
mv ./dist/main ./generic-k8s-webhook-linux-${{github.ref_name}}

- name: Publish package
uses: softprops/action-gh-release@v2
with:
files: generic-k8s-webhook-linux-${{github.ref_name}}

build-and-publish-to-ghcr:
# Explicitly grant the `secrets.GITHUB_TOKEN` permissions.
permissions:
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/test-pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ jobs:
- name: Install Python libraries
run: poetry install

- name: Build self-contained package
run: make pkg

- name: Linter
run: make lint

Expand Down
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ check-pyproject:
docker:
docker build -t generic-k8s-webhook:latest .

.PHONY: pkg
pkg: build
poetry run pyinstaller ./generic_k8s_webhook/main.py --onefile --recursive-copy-metadata generic_k8s_webhook

all-tests: check-pyproject lint unittests docker

all-tests-seq: | check-pyproject lint unittests docker
123 changes: 121 additions & 2 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ authors = ["jordi <[email protected]>"]
license = "Apache License"

[tool.poetry.dependencies]
python = "^3.11"
python = ">=3.11,<3.13"
PyYAML = "^6.0"
jsonpatch = "^1.33"
requests = "^2.31.0"
Expand All @@ -23,6 +23,7 @@ isort = "^5.12.0"
black = "^23.3.0"
pylint = "^2.17.4"
pytest-cov = "^5.0.0"
pyinstaller = "^6.9.0"

[tool.isort]
line_length = 120
Expand Down
Loading