Skip to content

Commit

Permalink
Merge 5ce2c08 into 372992f
Browse files Browse the repository at this point in the history
  • Loading branch information
graingert committed Oct 1, 2020
2 parents 372992f + 5ce2c08 commit 8e729eb
Show file tree
Hide file tree
Showing 4 changed files with 90 additions and 28 deletions.
91 changes: 69 additions & 22 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,33 +1,80 @@
# This is a basic workflow to help you get started with Actions

name: CI

# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on:
push:
branches: [ master ]
branches:
- master
tags:
- v*
pull_request:
branches: [ master ]

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
tox:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python-version: [3.6, 3.7, 3.8]
os: [macOS-latest, ubuntu-latest, windows-latest]

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- name: Checkout
uses: actions/checkout@v2

# Runs a single command using the runners shell
- name: Run a one-line script
run: echo Hello, world!
- name: Set Up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

# Runs a set of commands using the runners shell
- name: Run a multi-line script
- name: Get pip cache dir
id: pip-cache
run: |
echo Add other actions to build,
echo test, and deploy your project.
echo "::set-output name=dir::$(pip cache dir)"
- name: pip cache
uses: actions/cache@v2
with:
path: ${{ steps.pip-cache.outputs.dir }}
key:
${{ runner.os }}-pip-${{ hashFiles('pyproject.toml', 'setup.py',
'setup.cfg') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install
run: |
pip install tox
- name: tox
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: tox -e py,lint,coveralls,release

- name: upload dist
uses: actions/upload-artifact@v2
with:
name: ${{ matrix.os }}_${{ matrix.python-version}}_dist
path: dist

all-successful:
# https://github.community/t/is-it-possible-to-require-all-github-actions-tasks-to-pass-without-enumerating-them/117957/4?u=graingert
runs-on: ubuntu-latest
needs: [tox]
steps:
- name: Download dists for PyPI
uses: actions/download-artifact@v2
with:
name: ubuntu-latest_3.8_dist
path: dist

- name: Display structure of donwloaded files
run: ls -R

- name: Publish package
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.pypi_password }}

- name: note that all tests succeeded
run: echo "🎉"
2 changes: 1 addition & 1 deletion django_js_reverse/tests/unit_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def node_jseval(expr):
module = 'console.log({});'.format(expr)
stdout = (
subprocess
.check_output(['node', '-e', module.encode('utf8')])
.check_output([b'node', b'-e', module.encode('utf8')])
.decode('utf8')
)
return re.sub(r'\n$', '', stdout)
Expand Down
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = [ "setuptools >= 35.0.2", "wheel >= 0.29.0"]
build-backend = "setuptools.build_meta"
22 changes: 17 additions & 5 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ envlist =
py{27}-django{111,110,19,18,17,16,15},
py34-django{20,111,110,19,18,17,16,15},
py{35,36,37}-django{22,21,20,111,110,19,18},
check,
lint,
prepare_npm

[testenv]
Expand All @@ -25,13 +25,25 @@ deps=
django22: Django>=2.2,<2.23


[testenv:prepare_npm]
commands = python -m prepare_npm
[testenv:coveralls]
passenv = GITHUB_*
deps =
django~=2.2.4
coveralls
coverage>=5.3
commands = coveralls

[testenv:release]
deps =
pep517
django~=2.2.4
whitelist_externals =
rm
commands =
rm -rf {toxinidir}/dist
python -m prepare_npm
{envpython} -m pep517.build --binary --source --out-dir={toxinidir}/dist {toxinidir}

[testenv:check]
[testenv:lint]
commands = ./setup.py check --restructuredtext --strict --metadata
deps =
docutils==0.14
Expand Down

0 comments on commit 8e729eb

Please sign in to comment.