-
-
Notifications
You must be signed in to change notification settings - Fork 611
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
👷 Deduplicate cron GHA through workflow reuse
This patch melts most of the separate cron workflow into the main CI workflow which it then includes as reusable. Such an approach allows for less duplication of the same CI steps while keeping the cron workflow as a separate entity.
- Loading branch information
Showing
2 changed files
with
53 additions
and
116 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,114 +2,13 @@ name: Cron | |
|
||
on: | ||
schedule: | ||
# Run every day at 00:00 UTC | ||
- cron: 0 0 * * * | ||
# Run everyday at 03:53 UTC | ||
- cron: 53 3 * * * | ||
|
||
jobs: | ||
main: | ||
name: ${{ matrix.os }} / ${{ matrix.python-version }} / ${{ matrix.pip-version }} | ||
runs-on: ${{ matrix.os }}-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: | ||
- Ubuntu | ||
- Windows | ||
- MacOS | ||
python-version: | ||
- "3.11" | ||
- "3.10" | ||
- "3.9" | ||
- "3.8" | ||
pip-version: | ||
- main | ||
include: | ||
- os: Ubuntu | ||
python-version: 3.12-dev | ||
pip-version: main | ||
env: | ||
PY_COLORS: 1 | ||
TOXENV: pip${{ matrix.pip-version }} | ||
TOX_PARALLEL_NO_SPINNER: 1 | ||
steps: | ||
- uses: actions/checkout@main | ||
- name: Set up Python ${{ matrix.python-version }} from GitHub | ||
id: python-install | ||
if: "!endsWith(matrix.python-version, '-dev')" | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Set up Python ${{ matrix.python-version }} from deadsnakes | ||
if: endsWith(matrix.python-version, '-dev') | ||
uses: deadsnakes/[email protected] | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Get pip cache dir | ||
id: pip-cache | ||
shell: bash | ||
run: | | ||
echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT | ||
- name: Pip cache | ||
uses: actions/cache@v3 | ||
with: | ||
path: ${{ steps.pip-cache.outputs.dir }} | ||
key: >- | ||
${{ runner.os }}-pip-${{ hashFiles('setup.cfg') }}-${{ | ||
hashFiles('pyproject.toml') }}-${{ hashFiles('tox.ini') }}-${{ | ||
hashFiles('.pre-commit-config.yaml') }} | ||
restore-keys: | | ||
${{ runner.os }}-pip- | ||
${{ runner.os }}- | ||
- name: Install test dependencies | ||
run: python -m pip install -U tox virtualenv | ||
- name: Prepare test environment | ||
run: tox --notest -p auto --parallel-live | ||
- name: Test pip ${{ matrix.pip-version }} | ||
run: tox | ||
|
||
pypy: | ||
name: ${{ matrix.os }} / ${{ matrix.python-version }} / ${{ matrix.pip-version }} | ||
runs-on: ${{ matrix.os }}-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: | ||
- Ubuntu | ||
- MacOS | ||
- Windows | ||
python-version: | ||
- pypy-3.8 | ||
pip-version: | ||
- latest | ||
env: | ||
PY_COLORS: 1 | ||
TOXENV: pip${{ matrix.pip-version }} | ||
TOX_PARALLEL_NO_SPINNER: 1 | ||
steps: | ||
- uses: actions/checkout@main | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Get pip cache dir | ||
id: pip-cache | ||
shell: bash | ||
run: | | ||
echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT | ||
- name: Pip cache | ||
uses: actions/cache@v3 | ||
with: | ||
path: ${{ steps.pip-cache.outputs.dir }} | ||
key: >- | ||
${{ runner.os }}-pip-${{ hashFiles('setup.cfg') }}-${{ | ||
hashFiles('pyproject.toml') }}-${{ hashFiles('tox.ini') }}-${{ | ||
hashFiles('.pre-commit-config.yaml') }} | ||
restore-keys: | | ||
${{ runner.os }}-pip- | ||
${{ runner.os }}- | ||
- name: Install tox | ||
run: pip install tox | ||
- name: Prepare test environment | ||
run: tox --notest -p auto --parallel-live | ||
- name: Test pip ${{ matrix.pip-version }} | ||
run: tox | ||
name: CI | ||
uses: ./.github/workflows/ci.yml | ||
with: | ||
cpython-pip-version: >- | ||
["main", "latest", "previous"] |