Skip to content

Commit 4a57cb3

Browse files
committed
Update actions
1 parent 52a2d85 commit 4a57cb3

File tree

5 files changed

+129
-70
lines changed

5 files changed

+129
-70
lines changed

.github/workflows/ci.yml

Lines changed: 0 additions & 67 deletions
This file was deleted.

.github/workflows/main.yml

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
name: Django Extra Checks CI
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
tags:
8+
- v*
9+
pull_request:
10+
11+
jobs:
12+
tests:
13+
runs-on: ubuntu-latest
14+
timeout-minutes: 10
15+
strategy:
16+
matrix:
17+
python: [3.6, 3.7, 3.8, 3.9]
18+
19+
steps:
20+
- uses: actions/checkout@v2
21+
- uses: actions/setup-python@v2
22+
if: matrix.python-version != '3.9'
23+
with:
24+
python-version: ${{ matrix.python-version }}
25+
- uses: deadsnakes/[email protected]
26+
if: matrix.python-version == '3.9'
27+
with:
28+
python-version: ${{ matrix.python-version }}
29+
- name: Install Tox
30+
run: python -m pip install tox tox-gh-actions
31+
- name: Run Tox
32+
run: python -m tox
33+
34+
package:
35+
runs-on: ubuntu-latest
36+
needs: tests
37+
timeout-minutes: 5
38+
steps:
39+
- uses: actions/checkout@v2
40+
- name: Setup Python
41+
uses: actions/setup-python@v2
42+
with:
43+
python-version: "3.8"
44+
- name: Install dependencies
45+
run: |
46+
python -m pip install setuptools wheel twine
47+
- name: Package
48+
run: |
49+
python setup.py sdist bdist_wheel
50+
twine check dist/*
51+
- name: Upload dist
52+
uses: actions/upload-artifact@v1
53+
with:
54+
name: dist
55+
path: dist
56+
57+
publish:
58+
runs-on: ubuntu-latest
59+
needs: [tests, package]
60+
if: startsWith(github.ref, 'refs/tags/v')
61+
timeout-minutes: 5
62+
steps:
63+
- uses: actions/checkout@v2
64+
- name: Set release env
65+
id: release_output
66+
run: |
67+
VERSION=$(awk '$1 == "version" {print $3}' setup.cfg)
68+
TAG_VERSION="${GITHUB_REF:11}"
69+
if [[ "$VERSION" != "$TAG_VERSION" ]]; then
70+
echo "Tag doesn't match package version."
71+
exit 1
72+
fi
73+
BODY=$(awk -v RS='### ' '/'$VERSION'.*/ {print $0}' CHANGELOG.md)
74+
if [[ -z "$BODY" ]]; then
75+
echo "No changelog record for version $VERSION."
76+
fi
77+
BODY="${BODY//'%'/'%25'}"
78+
BODY="${BODY//$'\n'/'%0A'}"
79+
BODY="${BODY//$'\r'/'%0D'}"
80+
echo "::set-output name=VERSION::${VERSION}"
81+
echo "::set-output name=BODY::${BODY}"
82+
- name: Setup Python
83+
uses: actions/setup-python@v2
84+
with:
85+
python-version: "3.8"
86+
- name: Download dist
87+
uses: actions/download-artifact@v1
88+
with:
89+
name: dist
90+
- name: Install dependencies
91+
run: |
92+
python -m pip install twine
93+
- name: Publish
94+
env:
95+
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
96+
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
97+
run: |
98+
twine upload dist/*
99+
- name: Create Release
100+
id: create_release
101+
uses: actions/create-release@v1
102+
env:
103+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
104+
with:
105+
tag_name: ${{ github.ref }}
106+
release_name: Release ${{ steps.release_output.outputs.VERSION }}
107+
body: ${{ steps.release_output.outputs.BODY }}
108+
draft: false
109+
prerelease: false

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
## Change Log
2+
3+
### Unreleased
4+
5+
### 0.2.0
6+
7+
- first public release
8+
9+
### 0.1.0
10+
11+
- first alpha

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@ classifiers =
2323
Programming Language :: Python :: 3.6
2424
Programming Language :: Python :: 3.7
2525
Programming Language :: Python :: 3.8
26+
Programming Language :: Python :: 3.9
2627

2728
[options]
2829
package_dir=
2930
=src
3031
packages = find:
31-
install_requires = Django>=2.2
3232
python_requires = >=3.6
3333

3434
[options.packages.find]

tox.ini

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
[tox]
22
envlist =
3-
py{36,37,38}-django{22,30,31,-latest},flake8,black,isort,manifest,mypy
3+
py{36,37,38,39}-django{22,30,31,-latest},flake8,black,isort,manifest,mypy
4+
5+
[gh-actions]
6+
python =
7+
3.6: py36-django{22,30,31,-latest}
8+
3.7: py37-django{22,30,31,-latest}
9+
3.8: py38-django{22,30,31,-latest},flake8,black,isort,manifest,mypy
10+
3.9: py38-django{22,30,31,-latest}
411

512
[testenv]
613
setenv =
@@ -11,7 +18,6 @@ deps =
1118
pytest
1219
pytest-django
1320
pytest-cov
14-
psycopg2-binary
1521
django22: Django>=2.2,<2.3
1622
django30: Django>=3.0,<3.1
1723
django31: Django>=3.0b1,<3.2

0 commit comments

Comments
 (0)