From c59ca510be9cb598ae7d87e535246af60cba2845 Mon Sep 17 00:00:00 2001 From: "Michael R. Crusoe" Date: Tue, 25 Jun 2024 17:13:12 +0200 Subject: [PATCH] switch to gh-actions --- .github/workflows/ci-tests.yml | 110 +++++++++++++++++++++++++++++++++ .travis.yml | 26 -------- Makefile | 4 +- 3 files changed, 112 insertions(+), 28 deletions(-) create mode 100644 .github/workflows/ci-tests.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/ci-tests.yml b/.github/workflows/ci-tests.yml new file mode 100644 index 0000000..544ce8b --- /dev/null +++ b/.github/workflows/ci-tests.yml @@ -0,0 +1,110 @@ +name: CI Tests + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + workflow_dispatch: + +concurrency: + group: build-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +env: + TOX_SKIP_MISSING_INTERPRETERS: False + # Rich (pip) + FORCE_COLOR: 1 + # Tox + PY_COLORS: 1 + # Mypy (see https://github.com/python/mypy/issues/7771) + TERM: xterm-color + MYPY_FORCE_COLOR: 1 + MYPY_FORCE_TERMINAL_WIDTH: 200 + # Pytest + PYTEST_ADDOPTS: --color=yes + +jobs: + + tox: + name: Tox + runs-on: ubuntu-22.04 + strategy: + matrix: + py-ver-major: [3] + py-ver-minor: [8, 9, 10, 11, 12] + step: [lint, unit, bandit, mypy] + + env: + py-semver: ${{ format('{0}.{1}', matrix.py-ver-major, matrix.py-ver-minor) }} + TOXENV: ${{ format('py{0}{1}-{2}', matrix.py-ver-major, matrix.py-ver-minor, matrix.step) }} + + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: ${{ env.py-semver }} + allow-prereleases: true + cache: pip + + - name: Upgrade setuptools and install tox + run: | + pip install -U pip setuptools wheel + pip install tox tox-gh-actions + + - name: MyPy cache + if: ${{ matrix.step == 'mypy' }} + uses: actions/cache@v4 + with: + path: .mypy_cache/${{ env.py-semver }} + key: mypy-${{ env.py-semver }} + + - name: Test with tox + run: tox + + - name: Upload coverage to Codecov + if: ${{ matrix.step == 'unit' }} + uses: codecov/codecov-action@v4 + with: + fail_ci_if_error: true + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + + tox-style: + name: Linters + runs-on: ubuntu-20.04 + + strategy: + matrix: + step: [lintreadme, shellcheck, pydocstyle] + + env: + py-semver: "3.12" + TOXENV: ${{ format('py312-{0}', matrix.step) }} + + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: ${{ env.py-semver }} + cache: pip + + - name: Upgrade setuptools and install tox + run: | + pip install -U pip setuptools wheel + pip install "tox<4" "tox-gh-actions<3" + + - if: ${{ matrix.step == 'pydocstyle' && github.event_name == 'pull_request'}} + name: Create local branch for diff-quality for PRs + run: git branch ${{github.base_ref}} origin/${{github.base_ref}} + + - name: Test with tox + run: tox diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 9340129..0000000 --- a/.travis.yml +++ /dev/null @@ -1,26 +0,0 @@ -dist: bionic -branches: - only: - - main -language: python -python: -- '3.7' -- '3.8' -- '3.9' -- '3.10' -before_install: -- pip install -U pip wheel -- pip install .[toil] -- pip install -r dev-requirements.txt -script: -- flake8 wes_service wes_client -- pytest -services: - - docker -deploy: - provider: pypi - on: - tags: true - user: david4096 - password: - secure: LlQn8ZBAb5ekujHnoDrmzrmXaM6TpyzByNHPH4FTbbdnJ8lkDPb/ZhYvdmqrOvXPQg81/IoYKlIvP7fY9kc3oGUJ2IXhcPFqiw8njsRE5Qaebp+YppQO7C3IWGlHoZtXNtC608ZSA4x0oneNeNy+Y8KYnqKbmOlbuvrYRlNYfe9/8z7yLPH8wdmp0GyvbViedr3p7PXhtQVUKAgPpgjffZnSA7P/Y6AdkvjHHv2xMAzWP/QmOFWZNxUXjg0miR0K7eGFeGBNMM/+QsVXrGOu/TCtPtJ4JXyD86nzrZUbsOluyAblxwGlrv05se5ImVhR210OC5zvSW2902y/lxCw5uek+xg4/tcSA1ckshxLeu02GfDygCktMUtqtKVIZ+qvU7H4dEQ6Jnz9yBvZW5M6V94Ew3wBFy0RB5I9k3MMQY21FdynIUEZzBgJbOChCbmlIDT1varBHvWBiwg8EwPOVuJt1CsOoptJxUsoJND4tAOPIvXMNI17qGJ+VWAVMVNn7cVUuhEeGXwQF4urrkFBA7WIYOp6O9R8Ipg6WnQdxVdnqb3NsEc19SRdFXQ82SYibKfIZxjpdmYVgKzTYsJGMhfG6fTw9D4JABhggfgShsnByrFtbbkn/9g64jXDOjwPLeRXwXYZe6ZV6M69PDWdo0o326Qq/OHBG5eU7z2plNI= diff --git a/Makefile b/Makefile index f1b94c9..d4ab3db 100644 --- a/Makefile +++ b/Makefile @@ -23,7 +23,7 @@ MODULE1=wes_client MODULE2=wes_service PACKAGE=wes-service -EXTRAS= +EXTRAS=[toil,arvados] # `SHELL=bash` doesn't work for some, so don't use BASH-isms like # `[[` conditional expressions. @@ -147,7 +147,7 @@ diff-cover.html: coverage.xml diff-cover --compare-branch=main $^ --html-report $@ ## test : run the wes-service test suite -test: $(PYSOURCES) +test: $(PYSOURCES) FORCE python -m pytest -rsx ${PYTEST_EXTRA} ## testcov : run the wes-service test suite and collect coverage