Merge remote-tracking branch 'upstream' #1
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
name: Distribution | |
on: | |
push: | |
branches-ignore: | |
- dependabot/** | |
- deepsource** | |
tags: | |
- '*' | |
pull_request: | |
permissions: | |
contents: read | |
jobs: | |
setup: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.11' | |
cache: pip | |
cache-dependency-path: requirements/*.txt | |
- name: Install apt dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y libgettextpo-dev | |
- name: Update pip | |
run: python -m pip install --upgrade pip wheel | |
- name: Install pip dependencies | |
run: | | |
pip install -r requirements/dev.txt | |
- name: Build sdist | |
run: make build | |
- name: Twine check | |
run: twine check dist/* | |
- name: Install test (source) | |
run: | | |
virtualenv test-ttk-release-src | |
. ./test-ttk-release-src/bin/activate | |
pip install dist/translate-toolkit-*.tar.gz | |
moz2po --help | |
python ./test-ttk-release-src/lib/python*/site-packages/translate/lang/identify.py README.rst | |
- name: Install test (wheel) | |
run: | | |
virtualenv test-ttk-release-whl | |
. ./test-ttk-release-whl/bin/activate | |
pip install dist/translate_toolkit*.whl | |
moz2po --help | |
python ./test-ttk-release-whl/lib/python*/site-packages/translate/lang/identify.py README.rst | |
- name: Run build | |
run: coverage run ./setup.py build | |
- name: Run setup | |
run: coverage run --append ./setup.py sdist | |
- name: Coverage | |
run: coverage xml | |
- uses: codecov/codecov-action@v4 | |
with: | |
name: setup | |
- uses: actions/upload-artifact@v4 | |
with: | |
path: ./dist/* | |
pypi-publish: | |
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/') | |
needs: | |
- setup | |
runs-on: ubuntu-22.04 | |
permissions: | |
# this permission is mandatory for trusted publishing | |
id-token: write | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
# unpacks default artifact into dist/ | |
# if `name: artifact` is omitted, the action will create extra parent dir | |
name: artifact | |
path: dist | |
- name: Publish package distributions to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
github-publish: | |
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/') | |
needs: | |
- setup | |
runs-on: ubuntu-22.04 | |
permissions: | |
# this permission is mandatory for creating a release | |
contents: write | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
# unpacks default artifact into dist/ | |
# if `name: artifact` is omitted, the action will create extra parent dir | |
name: artifact | |
path: dist | |
- uses: ncipollo/release-action@v1 | |
with: | |
artifacts: dist/* |