From c9f60b1c7ea213cea56092f3496978205bf9ae6a Mon Sep 17 00:00:00 2001 From: Marius Gedminas Date: Mon, 30 Nov 2020 21:14:06 +0200 Subject: [PATCH] Set up GitHub Actions --- .github/workflows/build.yml | 114 ++++++++++++++++++++++++++++++++++++ README.rst | 4 +- 2 files changed, 116 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..92f4207 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,114 @@ +# NB: this name is used in the status badge +name: build + +on: + push: + branches: + - master + pull_request: + branches: + - master + workflow_dispatch: + schedule: + - cron: "0 5 * * 6" # 5:00 UTC every Saturday + +jobs: + build: + name: Python ${{ matrix.python-version }} + runs-on: ubuntu-latest + + strategy: + matrix: + python-version: + - "3.6" + - "3.7" + - "3.8" + - "3.9" + - "pypy3" + + steps: + - name: Git clone + uses: actions/checkout@v2 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: "${{ matrix.python-version }}" + + - name: Pip cache + uses: actions/cache@v2 + with: + path: ~/.cache/pip + key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('setup.py') }} + restore-keys: | + ${{ runner.os }}-pip-${{ matrix.python-version }}- + ${{ runner.os }}-pip- + + - name: Install dependencies + run: | + python -m pip install -U pip + python -m pip install -U setuptools wheel + python -m pip install -U pytest coverage coveralls + python -m pip install -e . + + - name: Run tests + run: coverage run -m pytest + + - name: Check test coverage + run: coverage report -m --fail-under=100 + + - name: Report to coveralls + run: coveralls + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + COVERALLS_PARALLEL: true + + finish: + name: Tell Coveralls that we're finished running all parallel jobs + needs: build + runs-on: ubuntu-latest + container: python:3-slim + steps: + - run: pip3 install -U coveralls + - run: coveralls --finish + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + lint: + name: ${{ matrix.toxenv }} + runs-on: ubuntu-latest + + strategy: + matrix: + toxenv: + - flake8 + - mypy + - check-manifest + - check-python-versions + + steps: + - name: Git clone + uses: actions/checkout@v2 + + - name: Set up Python ${{ env.default_python || '3.9' }} + uses: actions/setup-python@v2 + with: + python-version: "${{ env.default_python || '3.9' }}" + + - name: Pip cache + uses: actions/cache@v2 + with: + path: ~/.cache/pip + key: ${{ runner.os }}-pip-${{ matrix.toxenv }}-${{ hashFiles('tox.ini') }} + restore-keys: | + ${{ runner.os }}-pip-${{ matrix.toxenv }}- + ${{ runner.os }}-pip- + + - name: Install dependencies + run: | + python -m pip install -U pip + python -m pip install -U setuptools wheel + python -m pip install -U tox + + - name: Run ${{ matrix.toxenv }} + run: python -m tox -e ${{ matrix.toxenv }} diff --git a/README.rst b/README.rst index 595443a..b2a6d14 100644 --- a/README.rst +++ b/README.rst @@ -1,8 +1,8 @@ Look at GitLab CI job status from the command line ================================================== -.. image:: https://travis-ci.com/mgedmin/gitlab-trace.svg?branch=master - :target: https://travis-ci.com/mgedmin/gitlab-trace +.. image:: https://github.com/mgedmin/gitlab-trace/workflows/build/badge.svg?branch=master + :target: https://github.com/mgedmin/gitlab-trace/actions .. image:: https://coveralls.io/repos/mgedmin/gitlab-trace/badge.svg?branch=master :target: https://coveralls.io/r/mgedmin/gitlab-trace