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

Improve CI workflow, auto-merge depdenencies #66

Merged
merged 2 commits into from
Aug 29, 2023
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
20 changes: 20 additions & 0 deletions .github/workflows/dependency.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Dependency auto-merge
on: pull_request_target

permissions:
contents: write
pull-requests: write

jobs:
dependency:
runs-on: ubuntu-latest
if: ${{ github.actor == 'dependabot[bot]' || github.actor == 'pre-commit-ci[bot]' }}
steps:
- name: Enable auto-merge for Dependency PRs
run: gh pr merge --auto --merge "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

- name: Automatically approve the PR
uses: hmarr/auto-approve-action@v3
42 changes: 22 additions & 20 deletions .github/workflows/python.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,22 @@
name: Python Package

name: Python package

on:
pull_request:
push:
branches:
- '*'
- main
tags:
- '*'

merge_group:
pull_request:
branches:
- main

jobs:
build:
runs-on: ubuntu-latest
name: Wheel
name: Build Wheel

steps:
- name: Checkout
Expand All @@ -23,12 +28,12 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
python-version: "3.11"

- name: Install Python packages
run: python -m pip install --upgrade build pip
run: python -m pip install --upgrade build

- name: build sdist
- name: build
run: PYTHONWARNINGS=error python -m build

- name: Store the packages
Expand All @@ -41,14 +46,15 @@ jobs:
needs:
- build

runs-on: ubuntu-latest
name: Test Python ${{ matrix.python.version }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python:
- {version: '3.10', wheel: 'cp310-cp310'}
- {version: '3.11', wheel: 'cp311-cp311'}
- { version: "3.10" }
- { version: "3.11" }
- { version: "3.12.0-beta - 3.12.0" }

steps:
- name: Checkout
Expand All @@ -72,15 +78,12 @@ jobs:
name: python-package-distributions
path: dist/

- name: Install Python packages
run: python -m pip install --upgrade pip pytest

- name: install built wheel
run: python -m pip install dist/*.whl
- name: Install built wheel
run: python -m pip install "$(ls dist/*.whl)[test]"
shell: bash

- name: test
run: python -m pytest
run: python -m pytest # don't include coverage, since we've deleted the source dir

pypi:
runs-on: 'ubuntu-latest'
Expand All @@ -99,7 +102,7 @@ jobs:
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.testpypi_password }}
repository_url: https://test.pypi.org/legacy/
repository-url: https://test.pypi.org/legacy/

- name: Create GitHub release
uses: svenstaro/[email protected]
Expand Down Expand Up @@ -132,10 +135,10 @@ jobs:
run: python -m venv venv

- name: Install Python packages
run: venv/bin/python -m pip install --upgrade pip pytest pytest-cov pytest-xdist
run: venv/bin/python -m pip install --upgrade pip pytest-xdist

- name: install built wheel
run: venv/bin/python -m pip install -e .
run: venv/bin/python -m pip install -e ".[test]"

- name: Run Tests
run:
Expand All @@ -144,7 +147,6 @@ jobs:
- name: codecov
uses: codecov/codecov-action@v3
with:
fail_ci_if_error: false
files: ./coverage.xml
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
6 changes: 6 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ content-type = "text/markdown"
[project.urls]
Homepage = "https://github.com/randovania/mercury-engine-data-structures"

[project.optional-dependencies]
test = [
"pytest",
"pytest-cov",
]

# Entry Points for PyInstaller
[project.entry-points.pyinstaller40]
hook-dirs = "mercury_engine_data_structures.__pyinstaller:get_hook_dirs"
Expand Down