diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 1fa288f..8d527a8 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,8 +1,24 @@ version: 2 +registries: + pkg-kiwitcms-eu: + type: python-index + replaces-base: false + url: https://pkg.kiwitcms.eu/pypi/ + token: ${{ secrets.GEMFURY_PULL_TOKEN }} + updates: -- package-ecosystem: pip - directory: "/" - schedule: - interval: daily - time: "03:00" - open-pull-requests-limit: 10 + - package-ecosystem: pip + registries: "*" + insecure-external-code-execution: allow + directory: "/" + schedule: + interval: daily + time: "03:00" + open-pull-requests-limit: 10 + + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "weekly" + time: "04:00" + open-pull-requests-limit: 5 diff --git a/.github/workflows/publish-package.yml b/.github/workflows/publish-package.yml new file mode 100644 index 0000000..1577709 --- /dev/null +++ b/.github/workflows/publish-package.yml @@ -0,0 +1,32 @@ +name: publish-package + +on: + push: + tags: + - v* + +permissions: read-all + +jobs: + publish-package: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: [3.11] + + steps: + - uses: actions/checkout@v6 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v6 + with: + python-version: ${{ matrix.python-version }} + + - name: Build and push + env: + TWINE_USERNAME: ${{ secrets.GEMFURY_USERNAME }} + TWINE_PASSWORD: ${{ secrets.GEMFURY_PUSH_TOKEN }} + run: | + pip install -U pip "setuptools<82" twine wheel + + make upload diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 15854e7..37f5220 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -12,6 +12,25 @@ concurrency: permissions: read-all jobs: + build-package: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: [3.11] + + steps: + - uses: actions/checkout@v6 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v6 + with: + python-version: ${{ matrix.python-version }} + + - name: Build me + run: | + pip install -U pip "setuptools<82" wheel twine + + make package postgres: env: @@ -42,16 +61,22 @@ jobs: echo "password = ${{ secrets.TCMS_PASSWORD }}" >> ~/.tcms.conf - name: Install dependencies + env: + PKG_TOKEN: ${{ secrets.GEMFURY_PULL_TOKEN }} run: | sudo apt-get install libkrb5-dev - pip install -r devel.txt + pip install -r devel.txt \ + --index-url https://$PKG_TOKEN@pkg.kiwitcms.eu/pypi/ \ + --extra-index-url https://pypi.org/simple/ + pip install $(curl --silent https://raw.githubusercontent.com/kiwitcms/Kiwi/master/requirements/base.txt | grep PyGithub) - name: Execute tests env: KIWI_GITHUB_APP_ID: ${{ secrets.KIWI_GITHUB_APP_ID }} KIWI_GITHUB_APP_PRIVATE_KEY: ${{ secrets.KIWI_GITHUB_APP_PRIVATE_KEY }} + PKG_TOKEN: ${{ secrets.GEMFURY_PULL_TOKEN }} run: | # report to Kiwi TCMS only if we have access to secrets if [ -n "${{ secrets.TCMS_PASSWORD }}" ]; then diff --git a/Makefile b/Makefile index 6818080..ce906b8 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -# Copyright (c) 2019-2023 Alexander Todorov +# Copyright (c) 2019-2026 Alexander Todorov # # Licensed under GNU Affero General Public License v3 or later (AGPLv3+) # https://www.gnu.org/licenses/agpl-3.0.html @@ -11,7 +11,7 @@ test: if [ ! -d "$(KIWI_INCLUDE_PATH)/kiwi_lint" ]; then \ git clone --depth 1 https://github.com/kiwitcms/Kiwi.git $(KIWI_INCLUDE_PATH); \ pip install -U -r $(KIWI_INCLUDE_PATH)/requirements/base.txt; \ - pip install -U -r requirements.txt; \ + pip install -U -r requirements.txt --index-url https://$(PKG_TOKEN)@pkg.kiwitcms.eu/pypi/ --extra-index-url https://pypi.org/simple/; \ rm -rf $(PATH_TO_SITE_PACKAGES)/test_project; \ fi @@ -32,7 +32,7 @@ pylint: if [ ! -d "$(KIWI_INCLUDE_PATH)/kiwi_lint" ]; then \ git clone --depth 1 https://github.com/kiwitcms/Kiwi.git $(KIWI_INCLUDE_PATH); \ pip install -U -r $(KIWI_INCLUDE_PATH)/requirements/base.txt; \ - pip install -U -r requirements.txt; \ + pip install -U -r requirements.txt; --index-url https://$(PKG_TOKEN)@pkg.kiwitcms.eu/pypi/ --extra-index-url https://pypi.org/simple/; \ rm -rf $(PATH_TO_SITE_PACKAGES)/test_project; \ fi @@ -46,7 +46,7 @@ test_for_missing_migrations: if [ ! -d "$(KIWI_INCLUDE_PATH)/kiwi_lint" ]; then \ git clone --depth 1 https://github.com/kiwitcms/Kiwi.git $(KIWI_INCLUDE_PATH); \ pip install -U -r $(KIWI_INCLUDE_PATH)/requirements/base.txt; \ - pip install -U -r requirements.txt; \ + pip install -U -r requirements.txt; --index-url https://$(PKG_TOKEN)@pkg.kiwitcms.eu/pypi/ --extra-index-url https://pypi.org/simple/; \ rm -rf $(PATH_TO_SITE_PACKAGES)/test_project; \ fi @@ -61,3 +61,17 @@ check: flake8 pylint test_for_missing_migrations test messages: ./manage.py makemessages --locale en --no-obsolete --no-vinaigrette --ignore "test*.py" ls tcms_github_app/locale/*/LC_MESSAGES/*.po | xargs -n 1 -I @ msgattrib -o @ --no-fuzzy @ + + +.PHONY: package +package: + rm -rf build/ dist/ kiwitcms_*.egg-info/ + python setup.py sdist + python setup.py bdist_wheel + twine check dist/* + +.PHONY: upload +upload: package + test -n "$(TWINE_USERNAME)" || exit 1 + test -n "$(TWINE_PASSWORD)" || exit 2 + twine upload dist/* --repository-url https://push.fury.io/kiwitcms