Skip to content

Commit 51f06ab

Browse files
committed
Tune GitHub CI
1 parent 014320b commit 51f06ab

File tree

3 files changed

+79
-34
lines changed

3 files changed

+79
-34
lines changed

.github/workflows/ci.yaml

+77
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
---
2+
name: CI
3+
4+
on:
5+
push:
6+
branches: [master]
7+
tags: [v*]
8+
pull_request:
9+
branches: [master]
10+
workflow_dispatch:
11+
12+
jobs:
13+
lint:
14+
name: Run linters
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v2
18+
- uses: actions/setup-python@v2
19+
- name: Install check-wheel-content, pre-commit, and twine
20+
run: python -m pip install build pre-commit check-wheel-contents twine
21+
- name: Build package
22+
run: python -m build
23+
- name: Run linter
24+
run: python -m pre_commit run --all-files --show-diff-on-failure
25+
- name: Check wheel contents
26+
run: check-wheel-contents dist/*.whl
27+
- name: Check by twine
28+
run: python -m twine check dist/*
29+
30+
test:
31+
strategy:
32+
matrix:
33+
python-version: ['3.7', '3.8', '3.9', '3.10']
34+
runs-on: ubuntu-latest
35+
36+
steps:
37+
- uses: actions/checkout@v2
38+
- name: Set up Python ${{ matrix.python-version }}
39+
uses: actions/setup-python@v2
40+
with:
41+
python-version: ${{ matrix.python-version }}
42+
- name: Install Python ${{ matrix.python-version }} dependencies
43+
run: |
44+
python -m pip install --upgrade pip
45+
pip install .
46+
- name: Run pytest
47+
run: pytest
48+
49+
50+
deploy:
51+
name: Deploy
52+
environment: release
53+
# Run only on pushing a tag
54+
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
55+
needs: [lint, test]
56+
runs-on: ubuntu-latest
57+
steps:
58+
- name: Checkout
59+
uses: actions/[email protected]
60+
with:
61+
fetch-depth: 0
62+
- name: Install build
63+
run: python -m pip install build pre-commit check-wheel-contents twine
64+
- name: Build package
65+
run: python -m build
66+
- name: PyPI upload
67+
uses: pypa/[email protected]
68+
with:
69+
packages_dir: dist
70+
password: ${{ secrets.PYPI_API_TOKEN }}
71+
- name: GitHub Release
72+
uses: ncipollo/release-action@v1
73+
with:
74+
name: pytest-aiohttp ${{ github.ref_name }}
75+
artifacts: dist/*
76+
bodyFile: README.rst
77+
token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/test.yml

-22
This file was deleted.

.pre-commit-config.yaml

+2-12
Original file line numberDiff line numberDiff line change
@@ -46,22 +46,12 @@ repos:
4646
rev: v1.9.0
4747
hooks:
4848
- id: python-use-type-annotations
49-
- repo: https://github.com/rhysd/actionlint
50-
rev: v1.6.8
51-
hooks:
52-
- id: actionlint-docker
53-
args:
54-
- -ignore
55-
- 'SC2155:'
56-
- -ignore
57-
- 'SC2086:'
58-
- -ignore
59-
- 'SC1004:'
6049
- repo: https://github.com/sirosen/check-jsonschema
6150
rev: 0.9.1
6251
hooks:
6352
- id: check-github-actions
53+
- id: check-github-workflows
6454
ci:
6555
skip:
66-
- actionlint-docker
6756
- check-github-actions
57+
- check-github-workflows

0 commit comments

Comments
 (0)