Skip to content

Commit

Permalink
First official release 0.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
DylannCordel committed Sep 13, 2023
1 parent 10dc96c commit 92c153c
Show file tree
Hide file tree
Showing 6 changed files with 240 additions and 4 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/build_n_publish.yml
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 }}
124 changes: 124 additions & 0 deletions .github/workflows/main.yml
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/
69 changes: 69 additions & 0 deletions .github/workflows/qa.yml
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>`
});
2 changes: 1 addition & 1 deletion tbump.toml
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
Expand Down
5 changes: 3 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
[tox]
envlist =
py{37,39}-django32-wagtail{41,42,50},
py{39,311}-django42-wagtail{50,51},
py37-django32-wagtail{41,42,50},
py39-django42-wagtail{50,51},
py311-django42-wagtail51,
; py{39,311}-django42-wagtailmain
qa

Expand Down
2 changes: 1 addition & 1 deletion wagtail_parler/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.0.0"
__version__ = "0.1.0"

0 comments on commit 92c153c

Please sign in to comment.