From 96abcb81b15ac2835b42b2609b1f1ee9bf8f2890 Mon Sep 17 00:00:00 2001 From: "Brandon T. Willard" Date: Fri, 8 Jan 2021 16:48:09 -0600 Subject: [PATCH] Replace Travis CI with GitHub Actions --- .github/workflows/pypi.yml | 50 +++++++++++++++++++ .github/workflows/tests.yml | 99 +++++++++++++++++++++++++++++++++++++ .travis.yml | 28 ----------- 3 files changed, 149 insertions(+), 28 deletions(-) create mode 100644 .github/workflows/pypi.yml create mode 100644 .github/workflows/tests.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/pypi.yml b/.github/workflows/pypi.yml new file mode 100644 index 0000000..fbe1e2a --- /dev/null +++ b/.github/workflows/pypi.yml @@ -0,0 +1,50 @@ +name: PyPI +on: + push: + branches: + - master + - auto-release + pull_request: + branches: [master] + release: + types: [published] + +jobs: + build: + name: Build source distribution + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + - uses: actions/setup-python@v2 + with: + python-version: "3.8" + - name: Build the sdist + run: | + python setup.py sdist + - name: Check the sdist installs and imports + run: | + mkdir -p test-sdist + cd test-sdist + python -m venv venv-sdist + venv-sdist/bin/python -m pip install ../dist/etuples-*.tar.gz + - uses: actions/upload-artifact@v2 + with: + name: artifact + path: dist/* + + upload_pypi: + name: Upload to PyPI on release + needs: [build] + runs-on: ubuntu-latest + if: github.event_name == 'release' && github.event.action == 'published' + steps: + - uses: actions/download-artifact@v2 + with: + name: artifact + path: dist + - uses: pypa/gh-action-pypi-publish@master + with: + user: __token__ + password: ${{ secrets.pypi_secret }} diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..a3f1061 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,99 @@ +name: Tests + +on: + push: + branches: + - master + pull_request: + branches: + - master + +jobs: + changes: + name: "Check for changes" + runs-on: ubuntu-latest + outputs: + changes: ${{ steps.changes.outputs.src }} + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + - uses: dorny/paths-filter@v2 + id: changes + with: + filters: | + python: &python + - 'etuples/**/*.py' + - 'tests/**/*.py' + - '*.py' + src: + - *python + - '.github/**/*.yml' + - 'setup.cfg' + - 'requirements.txt' + - '.coveragerc' + - '.pre-commit-config.yaml' + + style: + name: Check code style + needs: changes + runs-on: ubuntu-latest + if: ${{ needs.changes.outputs.changes == 'true' }} + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 + with: + python-version: 3.8 + - uses: pre-commit/action@v2.0.0 + + test: + needs: + - changes + - style + runs-on: ubuntu-latest + if: ${{ needs.changes.outputs.changes == 'true' && needs.style.result == 'success' }} + strategy: + matrix: + python-version: + - 3.6 + - 3.7 + - 3.8 + - pypy3 + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + - name: Test with pytest + run: | + pytest -v tests/ --cov=etuples --cov-report=xml:./coverage.xml + - name: Coveralls + uses: AndreMiras/coveralls-python-action@develop + with: + parallel: true + flag-name: run-${{ matrix.python-version }} + + all-checks: + if: ${{ always() }} + runs-on: ubuntu-latest + name: "All tests" + needs: [changes, style, test] + steps: + - name: Check build matrix status + if: ${{ needs.changes.outputs.changes == 'true' && (needs.style.result != 'success' || needs.test.result != 'success') }} + run: exit 1 + + upload-coverage: + name: "Upload coverage" + needs: [changes, all-checks] + if: ${{ needs.changes.outputs.changes == 'true' && needs.all-checks.result == 'success' }} + runs-on: ubuntu-latest + steps: + - name: Coveralls Finished + uses: AndreMiras/coveralls-python-action@develop + with: + parallel-finished: true diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 059d95c..0000000 --- a/.travis.yml +++ /dev/null @@ -1,28 +0,0 @@ -dist: xenial -language: python - -python: - - "3.6" - - "3.7" - - "3.8" - - "pypy3" - -env: - global: - - COVERALLS_PARALLEL=true - -install: - - pip install -r requirements.txt - -script: - - pylint etuples/ tests/ - - if [[ `command -v black` ]]; then - black --check etuples tests; - fi - - pytest -v tests/ --cov=etuples/ - -after_success: - - coveralls - -notifications: - webhooks: https://coveralls.io/webhook