-
Notifications
You must be signed in to change notification settings - Fork 2
Set up Github Actions #1
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
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
4fb57b4
Fix readme and project links
mgax ac7509e
Set up Github Actions with tox
mgax 783b4e2
We don't support py38
mgax b24f55b
Fix pytest configuration
mgax 54dc173
No need to install package to run tox
mgax f6e83bf
Fix tox version mapping for Github Actions
mgax 9b76fe1
Test Django 4.2 with more Python versions
mgax fb6f264
Fix nightly workflow
mgax dc6112b
Trim down to supported Wagtail versions only
mgax e8c3810
Add support for Python 3.13
mgax 7a86c9c
PR feedback
mgax File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| """ | ||
| Called by GH Actions when the nightly build fails. | ||
|
|
||
| This reports an error to the #nightly-build-failures Slack channel. | ||
| """ | ||
|
|
||
| import os | ||
|
|
||
| import requests | ||
|
|
||
|
|
||
| if "SLACK_WEBHOOK_URL" in os.environ: | ||
| print("Reporting to #nightly-build-failures slack channel") | ||
| response = requests.post( | ||
| os.environ["SLACK_WEBHOOK_URL"], | ||
| json={ | ||
| "text": "A Nightly build failed. See https://github.com/torchbox/django-birdbath/actions/runs/" | ||
| + os.environ["GITHUB_RUN_ID"], | ||
| }, | ||
| timeout=30, | ||
| ) | ||
|
|
||
| print("Slack responded with:", response) | ||
|
|
||
| else: | ||
| print( | ||
| "Unable to report to #nightly-build-failures slack channel because SLACK_WEBHOOK_URL is not set" | ||
| ) |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| name: Nightly Wagtail Test | ||
|
|
||
| on: | ||
| schedule: | ||
| - cron: '0 1 * * *' | ||
| # At 01:00, daily | ||
| workflow_dispatch: | ||
|
|
||
| jobs: | ||
| nightly-wagtail-test: | ||
| runs-on: ubuntu-latest | ||
| env: | ||
| WEBHOOK_EXISTS: ${{ secrets.SLACK_WEBHOOK_URL != '' }} | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: '3.12' | ||
|
|
||
| - run: git clone https://github.com/wagtail/wagtail.git | ||
|
|
||
| - run: python -m pip install flit | ||
| - run: flit install --extras dev | ||
| - run: python -m pip install ./wagtail | ||
|
|
||
| - run: pytest | ||
|
|
||
| - name: Report failure | ||
| run: | | ||
| python -m pip install requests | ||
| python ./.github/scripts/report_nightly_build_failure.py | ||
| if: ${{ failure() && env.WEBHOOK_EXISTS == 'true' }} | ||
| env: | ||
| SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| # See https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/ | ||
| # for a detailed guide | ||
| name: Publish to PyPI | ||
|
|
||
| on: | ||
| release: | ||
| types: [published] | ||
|
|
||
| jobs: | ||
| build: | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read # to fetch code (actions/checkout) | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Set up Python 3.11 | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: '3.11' | ||
|
|
||
| - name: Install dependencies | ||
| run: | | ||
| python -m pip install --upgrade pip | ||
| python -m pip install flit | ||
| python -m flit install --symlink | ||
|
|
||
| - name: Build | ||
| run: python -m flit build | ||
|
|
||
| - uses: actions/upload-artifact@v4 | ||
| with: | ||
| path: ./dist | ||
|
|
||
| publish: | ||
| needs: build | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: none | ||
| id-token: write # required for trusted publishing | ||
| environment: publish | ||
| steps: | ||
| - uses: actions/download-artifact@v4 | ||
|
|
||
| - name: Publish to PyPI | ||
| uses: pypa/gh-action-pypi-publish@release/v1 | ||
| with: | ||
| packages-dir: artifact/ | ||
| print-hash: true |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| name: Django Birdbath CI | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - main | ||
| - 'stable/**' | ||
|
|
||
| pull_request: | ||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| permissions: | ||
| contents: read # to fetch code (actions/checkout) | ||
|
|
||
| jobs: | ||
| lint: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
| - name: Set up Python 3.12 | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: '3.12' | ||
| - uses: pre-commit/action@v3.0.1 | ||
|
|
||
| test: | ||
| runs-on: ubuntu-latest | ||
| needs: lint | ||
| strategy: | ||
| matrix: | ||
| python: ['3.9', '3.10', '3.11', '3.12', '3.13'] | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: Set up Python ${{ matrix.python }} | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: ${{ matrix.python }} | ||
| - name: Install | ||
| run: | | ||
| python -m pip install --upgrade pip tox tox-gh-actions | ||
| - name: Test | ||
| run: tox |
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
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
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.