From f9328d41af45b9d2401723121298f9520239ea2f Mon Sep 17 00:00:00 2001 From: Wichert Akkerman Date: Tue, 7 Jul 2020 10:52:19 +0200 Subject: [PATCH] Add GitHub action --- .github/workflows/main.yaml | 70 +++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 .github/workflows/main.yaml diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml new file mode 100644 index 0000000..ae2a03f --- /dev/null +++ b/.github/workflows/main.yaml @@ -0,0 +1,70 @@ +on: [push, pull_request] + +jobs: + test: + runs-on: ubuntu-latest + + strategy: + matrix: + python: ["2.7", "3.6", "3.7", "3.8"] + + name: Test Python ${{ matrix.python }} + + steps: + - uses: actions/checkout@v2 + + - name: Set up Python ${{ matrix.python }} + uses: actions/setup-python@v1 + with: + python-version: ${{ matrix.python }} + + - name: Install dependencies + run: | + python -m pip install pytest -e . + + - name: Run tests + run: py.test -v translationstring + + release: + if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags') + runs-on: ubuntu-latest + name: Release + needs: [ test ] + + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Set up Python + uses: actions/setup-python@v1 + with: + python-version: 3.7 + + - name: Install wheel + run: python -m pip install wheel --user + + - name: Insert version number + run: | + version=$(echo $GITHUB_REF | cut -d/ -f3) + sed -ie "/^version/s/=.*/= $version/" setup.cfg + + - name: Build a binary wheel and a source tarball + run: python setup.py sdist bdist_wheel + + - name: Publish package + uses: pypa/gh-action-pypi-publish@master + with: + user: __token__ + password: ${{ secrets.pypi_password }} + + - name: Create GitHub Release + id: create_release + uses: actions/create-release@latest + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.ref }} + release_name: Release ${{ github.ref }} + draft: false + prerelease: false