tqdm/.github/workflows/test.yml

193 lines
7.0 KiB
YAML

name: Test
on:
push:
pull_request:
schedule:
- cron: '2 1 * * 6' # M H d m w (Saturdays at 1:02)
jobs:
check:
if: github.event_name != 'pull_request' || github.head_ref != 'devel'
name: install
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/setup-python@v2
with:
python-version: '3.x'
- run: pip install .
test-os:
if: github.event_name != 'pull_request' || github.head_ref != 'devel'
strategy:
matrix:
python: [2.7, 3.7]
os: [macos-latest, windows-latest]
name: py${{ matrix.python }}-${{ matrix.os }}
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python }}
- name: install
shell: bash
run: |
pip install -U tox
mkdir -p "$HOME/bin"
curl -sfL https://coverage.codacy.com/get.sh > "$HOME/bin/codacy"
chmod +x "$HOME/bin/codacy"
echo "$HOME/bin" >> $GITHUB_PATH
- run: tox -e py${PYVER/./}
shell: bash
env:
PYVER: ${{ matrix.python }}
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }}
test:
if: github.event_name != 'pull_request' || github.head_ref != 'devel'
strategy:
matrix:
python: [2.7, 3.5, 3.6, 3.7, 3.8, 3.9]
name: py${{ matrix.python }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python }}
- name: install
run: |
pip install -U tox
mkdir -p "$HOME/bin"
curl -sfL https://coverage.codacy.com/get.sh > "$HOME/bin/codacy"
chmod +x "$HOME/bin/codacy"
echo "$HOME/bin" >> $GITHUB_PATH
- name: tox
run: |
if [[ "$PYVER" == py* ]]; then
tox -e $PYVER # basic:pypy
elif [[ "$PYVER" == *3.9 ]]; then
tox -e py${PYVER/./} # basic
elif [[ "$PYVER" == "3.7" ]]; then
tox -e py${PYVER/./}-tf,py${PYVER/./}-tf-keras # full
else
tox -e py${PYVER/./}-tf-keras # normal
fi
env:
PYVER: ${{ matrix.python }}
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }}
- name: Coveralls Parallel
uses: AndreMiras/coveralls-python-action@develop
with:
parallel: true
finish:
if: github.event_name != 'pull_request' || github.head_ref != 'devel'
name: pytest cov
continue-on-error: ${{ github.event_name != 'push' }}
needs: [test, test-os]
runs-on: ubuntu-latest
steps:
- name: Coveralls Finished
uses: AndreMiras/coveralls-python-action@develop
with:
parallel-finished: true
deploy:
if: github.event_name != 'pull_request' || github.head_ref != 'devel'
needs: [check, test, test-os]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install
run: |
sudo apt-get install -yqq pandoc
pip install .[dev]
make build .dockerignore snapcraft.yaml
- if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
uses: casperdcl/deploy-pypi@v1
with:
password: ${{ secrets.PYPI_TOKEN }}
gpg_key: ${{ secrets.GPG_KEY }}
skip_existing: true
- id: collect_assets
name: Collect assets
run: |
echo "::set-output name=asset_path::$(ls dist/*.whl)"
echo "::set-output name=asset_name::$(basename dist/*.whl)"
echo "::set-output name=asset_path_sig::$(ls dist/*.whl.asc 2>/dev/null)"
echo "::set-output name=asset_name_sig::$(basename dist/*.whl.asc 2>/dev/null)"
if [[ $GITHUB_REF == refs/tags/v* ]]; then
echo ::set-output name=docker_tags::latest,${GITHUB_REF/refs\/tags\/v/}
echo ::set-output name=snap_channel::stable,candidate,edge
elif [[ $GITHUB_REF == refs/heads/master ]]; then
echo ::set-output name=docker_tags::master
echo ::set-output name=snap_channel::candidate,edge
elif [[ $GITHUB_REF == refs/heads/devel ]]; then
echo ::set-output name=docker_tags::devel
echo ::set-output name=snap_channel::edge
fi
git log --pretty='format:%d%n- %s%n%b---' $(git tag --sort=v:refname | tail -n2 | head -n1)..HEAD > _CHANGES.md
- if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: tqdm ${{ github.ref }} stable
body_path: _CHANGES.md
draft: true
- if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ steps.collect_assets.outputs.asset_path }}
asset_name: ${{ steps.collect_assets.outputs.asset_name }}
asset_content_type: application/zip
- if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ steps.collect_assets.outputs.asset_path_sig }}
asset_name: ${{ steps.collect_assets.outputs.asset_name_sig }}
asset_content_type: text/plain
- uses: snapcore/action-build@v1
id: snap_build
- if: github.event_name == 'push' && steps.collect_assets.outputs.snap_channel
uses: snapcore/action-publish@v1
with:
store_login: ${{ secrets.SNAP_TOKEN }}
snap: ${{ steps.snap_build.outputs.snap }}
release: ${{ steps.collect_assets.outputs.snap_channel }}
- name: Docker build push
uses: elgohr/Publish-Docker-Github-Action@master
with:
name: ${{ github.repository }}
tags: ${{ steps.collect_assets.outputs.docker_tags }}
password: ${{ secrets.DOCKER_PWD }}
username: ${{ secrets.DOCKER_USR }}
no_push: ${{ steps.collect_assets.outputs.docker_tags == '' }}
- name: Docker push GitHub
uses: elgohr/Publish-Docker-Github-Action@master
with:
name: ${{ github.repository }}/tqdm
tags: ${{ steps.collect_assets.outputs.docker_tags }}
password: ${{ github.token }}
username: ${{ github.actor }}
registry: docker.pkg.github.com
no_push: ${{ steps.collect_assets.outputs.docker_tags == '' }}