-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
10dc96c
commit 92c153c
Showing
6 changed files
with
240 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
name: Publish Python 🐍 distributions 📦 to PyPI | ||
|
||
on: | ||
push: | ||
tags: | ||
- '*' | ||
|
||
|
||
jobs: | ||
build-n-publish: | ||
name: Build and publish Python 🐍 distributions 📦 to PyPI | ||
runs-on: ubuntu-latest | ||
environment: | ||
name: release | ||
url: https://pypi.org/p/wagtail-parler | ||
permissions: | ||
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.x" | ||
- name: Install pypa/build | ||
run: >- | ||
python3 -m | ||
pip install | ||
build | ||
--user | ||
- name: Build a binary wheel and a source tarball | ||
run: >- | ||
python3 -m | ||
build | ||
--sdist | ||
--wheel | ||
--outdir dist/ | ||
. | ||
- name: Publish package distributions to PyPi | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
user: __token__ | ||
password: ${{ secrets.PYPI_API_TOKEN }} |
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 |
---|---|---|
@@ -0,0 +1,124 @@ | ||
name: Wagtail Parler CI | ||
|
||
on: [push, pull_request] | ||
|
||
permissions: | ||
pull-requests: write | ||
contents: read | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
# Current configuration: | ||
# - python 3.7, django 3.2, wagtail 4.1 | ||
# - python 3.7, django 3.2, wagtail 4.2 | ||
# - python 3.7, django 3.2, wagtail 5.0 | ||
# - python 3.9, django 4.2, wagtail 5.0 | ||
# - python 3.9, django 4.2, wagtail 5.1 | ||
# - python 3.11, django 4.2, wagtail 5.1 | ||
# - python 3.11, django main, wagtail main | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
continue-on-error: ${{ matrix.experimental }} | ||
strategy: | ||
matrix: | ||
include: | ||
- python: '3.7' | ||
django: 'Django>=3.2,<3.3' | ||
wagtail: 'wagtail>=4.1,<4.2' | ||
experimental: false | ||
- python: '3.7' | ||
django: 'Django>=3.2,<3.3' | ||
wagtail: 'wagtail>=4.2,<4.3' | ||
experimental: false | ||
- python: '3.7' | ||
django: 'Django>=3.2,<3.3' | ||
wagtail: 'wagtail>=5.0,<5.1' | ||
experimental: false | ||
- python: '3.9' | ||
django: 'Django>=4.2,<4.3' | ||
wagtail: 'wagtail>=5.0,<5.1' | ||
experimental: false | ||
- python: '3.9' | ||
django: 'Django>=4.2,<4.3' | ||
wagtail: 'wagtail>=5.1,<5.2' | ||
experimental: false | ||
- python: '3.11' | ||
django: 'Django>=4.2,<4.3' | ||
wagtail: 'wagtail>=5.1,<5.2' | ||
experimental: false | ||
- python: '3.11' | ||
django: 'git+https://github.com/django/django.git@main#egg=Django' | ||
wagtail: 'git+https://github.com/wagtail/wagtail.git@main#egg=wagtail' | ||
experimental: true | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Python ${{ matrix.python }} | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python }} | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -e .[testing] | ||
pip install "${{ matrix.django }}" | ||
pip install "${{ matrix.wagtail }}" | ||
- name: Test | ||
run: | | ||
coverage run --parallel-mode ./runtests.py | ||
- name: Upload coverage data | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: coverage-data | ||
path: .coverage.* | ||
|
||
qa: | ||
needs: | ||
- test | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out the repo | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.10' | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install coverage black flake8 mypy types-requests | ||
- name: Check black | ||
run: | | ||
black --check ./ | ||
- name: Check flake8 | ||
run: | | ||
flake8 | ||
- name: Check mypy | ||
run: | | ||
mypy -p wagtail_parler | ||
- name: Download coverage data | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: coverage-data | ||
|
||
- name: Save PR number and combine coverage data | ||
run: | | ||
mkdir -p ./pr | ||
coverage combine | ||
coverage report -m --format="markdown" > ./pr/coverage.md | ||
coverage report --format="total" > ./pr/coverage_total | ||
echo ${{ github.event.number }} > ./pr/NR | ||
- uses: actions/upload-artifact@v2 | ||
with: | ||
name: pr | ||
path: pr/ |
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 |
---|---|---|
@@ -0,0 +1,69 @@ | ||
name: QA | ||
|
||
on: | ||
workflow_run: | ||
workflows: ["Wagtail Parler CI"] | ||
types: | ||
- completed | ||
|
||
jobs: | ||
qa: | ||
runs-on: ubuntu-latest | ||
if: > | ||
github.event.workflow_run.event == 'pull_request' && | ||
github.event.workflow_run.conclusion == 'success' | ||
steps: | ||
- name: 'Download artifact' | ||
uses: actions/[email protected] | ||
with: | ||
script: | | ||
var artifacts = await github.actions.listWorkflowRunArtifacts({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
run_id: ${{github.event.workflow_run.id }}, | ||
}); | ||
var matchArtifact = artifacts.data.artifacts.filter((artifact) => { | ||
return artifact.name == "pr" | ||
})[0]; | ||
var download = await github.actions.downloadArtifact({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
artifact_id: matchArtifact.id, | ||
archive_format: 'zip', | ||
}); | ||
var fs = require('fs'); | ||
fs.writeFileSync('${{github.workspace}}/pr.zip', Buffer.from(download.data)); | ||
- run: unzip pr.zip | ||
|
||
- name: 'Comment on PR v1' | ||
uses: actions/github-script@v3 | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
script: | | ||
var fs = require('fs'); | ||
var issue_number = Number(fs.readFileSync('./NR')); | ||
var coverage = fs.readFileSync('./coverage.md'); | ||
var coverage_total = fs.readFileSync('./coverage_total'); | ||
if (coverage_total == 100) { | ||
emoji='🦄'; | ||
} else if (coverage_total >= 95) { | ||
emoji='🏆'; | ||
} else if (coverage_total >= 90) { | ||
emoji='🥇'; | ||
} else if (coverage_total >= 85) { | ||
emoji='🥈'; | ||
} else if (coverage_total >= 80) { | ||
emoji='🥉'; | ||
} else { | ||
emoji='❌'; | ||
} | ||
await github.issues.createComment({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
issue_number: issue_number, | ||
body: `<details><summary>${emoji} coverage ${coverage_total} %</summary> | ||
${coverage} | ||
</details>` | ||
}); |
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
[version] | ||
current = "0.0.0" | ||
current = "0.1.0" | ||
|
||
# valid versions: | ||
# we use semver | ||
|
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 |
---|---|---|
@@ -1 +1 @@ | ||
__version__ = "0.0.0" | ||
__version__ = "0.1.0" |