-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reimplement CI changes lost in merge
- Loading branch information
Showing
1 changed file
with
74 additions
and
48 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 |
---|---|---|
@@ -1,85 +1,111 @@ | ||
name: Python CI | ||
|
||
on: [push, pull_request] | ||
on: [ push, pull_request ] | ||
|
||
defaults: | ||
run: | ||
shell: bash | ||
|
||
jobs: | ||
test: | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
python-version: [3.6, 3.7, 3.8] | ||
os: [ubuntu-latest, macos-latest, windows-latest] | ||
python-version: [ 3.7, 3.8, 3.9, '3.10' ] | ||
os: [ ubuntu-latest, macos-latest, windows-latest ] | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Check out repo | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v2 | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Env | ||
run: | | ||
echo "Event name: ${{ github.event_name }}" | ||
echo "Git ref: ${{ github.ref }}" | ||
echo "GH actor: ${{ github.actor }}" | ||
echo "SHA: ${{ github.sha }}" | ||
- name: Get pip cache dir | ||
id: pip-cache | ||
run: | | ||
echo "::set-output name=dir::$(pip cache dir)" | ||
- name: pip cache | ||
uses: actions/cache@v2 | ||
uses: actions/cache@v3 | ||
id: cache | ||
with: | ||
path: ${{ steps.pip-cache.outputs.dir }} | ||
key: ${{ matrix.os }}-${{ matrix.python-version }}-pip-${{ hashFiles('**/Pipfile') }} | ||
restore-keys: | | ||
${{ matrix.os }}-${{ matrix.python-version }}-pip- | ||
- name: Install dependencies | ||
run: | | ||
pip install pipenv | ||
pipenv install --dev | ||
- name: Run black --check . | ||
run: | | ||
pipenv run black --check . | ||
# TODO check `pipenv run pytest` | ||
- name: Test with pytest | ||
run: | | ||
pipenv run python -m pytest | ||
- name: Coverage with pytest-cov | ||
run: | | ||
pipenv run python -m pytest --cov=arc --cov-fail-under=51 --cov-report=html:output/coverage --cov-report=term | ||
- name: Archive code coverage results | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: code-coverage-report ${{ matrix.os }} ${{ matrix.python-version }} | ||
path: output/coverage/ | ||
pipenv run python -m pytest --cov=arc --cov-report=term | ||
# - name: Coverage with pytest-cov | ||
# run: | | ||
# pipenv run python -m pytest --cov=arc --cov-fail-under=51 --cov-report=html:output/coverage --cov-report=term | ||
|
||
# - name: Archive code coverage results | ||
# uses: actions/upload-artifact@v2 | ||
# with: | ||
# name: code-coverage-report ${{ matrix.os }} ${{ matrix.python-version }} | ||
# path: output/coverage/ | ||
|
||
# Build python package | ||
build: | ||
needs: test | ||
runs-on: ubuntu-latest | ||
# build: | ||
# needs: test | ||
# runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v1 | ||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.8 | ||
- name: Install pypa/build | ||
run: >- | ||
python -m | ||
pip install | ||
build | ||
--user | ||
- name: Build a binary wheel and a source tarball | ||
run: >- | ||
python -m | ||
build | ||
--sdist | ||
--wheel | ||
--outdir dist/ | ||
. | ||
- name: Publish distribution 📦 to Test PyPI | ||
uses: pypa/gh-action-pypi-publish@master | ||
with: | ||
password: ${{ secrets.TEST_PYPI_API_TOKEN }} | ||
repository_url: https://test.pypi.org/legacy/ | ||
- name: Publish distribution 📦 to PyPI | ||
if: startsWith(github.ref, 'refs/tags') | ||
uses: pypa/gh-action-pypi-publish@master | ||
with: | ||
password: ${{ secrets.PYPI_API_TOKEN }} | ||
# steps: | ||
# - uses: actions/checkout@v3 | ||
|
||
# - name: Set up Python | ||
# uses: actions/setup-python@v4 | ||
# with: | ||
# python-version: 3.8 | ||
|
||
# - name: Install pypa/build | ||
# run: >- | ||
# python -m | ||
# pip install | ||
# build | ||
# --user | ||
|
||
# - name: Build a binary wheel and a source tarball | ||
# run: >- | ||
# python -m | ||
# build | ||
# --sdist | ||
# --wheel | ||
# --outdir dist/ | ||
# . | ||
|
||
# - name: Publish distribution 📦 to Test PyPI | ||
# uses: pypa/gh-action-pypi-publish@main | ||
# with: | ||
# password: ${{ secrets.TEST_PYPI_API_TOKEN }} | ||
# repository_url: https://test.pypi.org/legacy/ | ||
|
||
# - name: Publish distribution 📦 to PyPI | ||
# if: startsWith(github.ref, 'refs/tags') | ||
# uses: pypa/gh-action-pypi-publish@main | ||
# with: | ||
# password: ${{ secrets.PYPI_API_TOKEN }} |