[pre-commit.ci] pre-commit autoupdate #279
Workflow file for this run
This file contains hidden or 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: Python Package | |
on: | |
pull_request: | |
merge_group: | |
push: | |
branches: | |
- 'main' | |
tags: | |
- '*' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
name: Wheel | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v5 | |
with: | |
fetch-depth: 0 | |
submodules: 'recursive' | |
- name: Set up Python | |
uses: actions/setup-python@v6 | |
with: | |
python-version: "3.12" | |
- name: Install Python packages | |
run: python -m pip install --upgrade pip setuptools build | |
- name: build | |
run: python -m build | |
- name: Store the packages | |
uses: actions/upload-artifact@v4 | |
with: | |
name: python-package-distributions | |
path: dist | |
test: | |
needs: | |
- build | |
runs-on: ${{ matrix.os }} | |
name: Test Python ${{ matrix.python.version }} (${{ matrix.os }}) | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- ubuntu-latest | |
- windows-latest | |
python: | |
- {version: '3.11', wheel: 'cp311-cp311'} | |
- {version: '3.12', wheel: 'cp312-cp312'} | |
- {version: '3.13', wheel: 'cp313-cp313'} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v5 | |
- name: remove code outside of wheel | |
run: rm -rf src | |
shell: bash | |
- name: Set up Python | |
uses: actions/setup-python@v6 | |
with: | |
python-version: ${{ matrix.python.version }} | |
- name: Download all the dists | |
uses: actions/download-artifact@v5 | |
with: | |
name: python-package-distributions | |
path: dist/ | |
- name: Install Python packages | |
run: python -m pip install --upgrade pip | |
- name: install built wheel | |
run: python -m pip install "$(ls dist/*.whl)[test]" | |
shell: bash | |
- name: run pytest | |
run: python -m pytest | |
pypi: | |
runs-on: 'ubuntu-latest' | |
needs: | |
- test | |
permissions: | |
id-token: write | |
steps: | |
- name: Download all the dists | |
uses: actions/download-artifact@v5 | |
with: | |
name: python-package-distributions | |
path: dist/ | |
- name: Publish 📦 to TestPyPI | |
if: ${{ github.ref == 'refs/heads/main' }} | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
repository-url: https://test.pypi.org/legacy/ | |
- name: Publish 📦 to PyPI | |
if: ${{ startsWith(github.ref, 'refs/tags/') }} | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
package: | |
runs-on: 'ubuntu-latest' | |
needs: | |
- build | |
outputs: | |
version: ${{ steps.package_details.outputs.version }} | |
steps: | |
- name: Set up Python | |
uses: actions/setup-python@v6 | |
with: | |
python-version: 3.12 | |
- name: Download all the dists | |
uses: actions/download-artifact@v5 | |
with: | |
name: python-package-distributions | |
path: dist/ | |
- name: Install Python packages | |
run: python -m pip install --upgrade pip | |
- name: install built wheel | |
run: python -m pip install "$(ls dist/*.whl)[test]" | |
shell: bash | |
- name: Create Zip | |
run: python -m factorio_randovania_mod generate-zip --output-path mod-dist | |
- name: Get Package details | |
id: package_details | |
shell: bash | |
run: | | |
echo "version=$(python -c "import factorio_randovania_mod.mod_lua_api; print(factorio_randovania_mod.mod_lua_api.mod_version())")" >> $GITHUB_OUTPUT | |
- name: Store the Mod Package | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Mod Package | |
path: mod-dist | |
release-modportal: | |
runs-on: ubuntu-latest | |
needs: | |
- package | |
if: startsWith(github.ref, 'refs/tags/') | |
steps: | |
- name: Download the mod package | |
uses: actions/download-artifact@v5 | |
with: | |
name: Mod Package | |
path: mod-dist/ | |
- name: Factorio release | |
uses: henriquegemignani/factorio-mod-uploader@v1 | |
with: | |
zip_file: "mod-dist/randovania_${{ needs.package.outputs.version }}.zip" | |
api_key: "${{ secrets.FACTORIO_API_KEY }}" |