From 141363286a065960e5d99f99599b7a438aecee72 Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Tue, 15 Jun 2021 20:34:15 +0300 Subject: workflows/test -> workflows/ci --- .github/workflows/ci.yml | 86 ++++++++++++++++++++++++++++++++++++++++++++++ .github/workflows/test.yml | 86 ---------------------------------------------- 2 files changed, 86 insertions(+), 86 deletions(-) create mode 100644 .github/workflows/ci.yml delete mode 100644 .github/workflows/test.yml (limited to '.github') diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..4a848aa --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,86 @@ +name: Test + +on: + push: + pull_request: + workflow_dispatch: + +jobs: + test_local: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: [3.6, 3.7, 3.8, 3.9, 3.x] + name: 'Test: ${{ matrix.python-version }}' + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: '${{ matrix.python-version }}' + - name: Initialize Git + run: | + git config --global user.name 'John Doe' + git config --global user.email 'John.Doe@example.com' + - name: Test + run: ./.ci/local/test.sh + + test_docker: + runs-on: ubuntu-latest + name: 'Test: Docker' + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Test + run: ./.ci/docker/test.sh + + publish_docker: + needs: [test_local, test_docker] + runs-on: ubuntu-latest + name: 'Publish: Docker Hub' + if: github.event_name == 'push' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags')) + steps: + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + - name: Login to Docker Hub + uses: docker/login-action@v1 + with: + username: '${{ secrets.DOCKERHUB_USERNAME }}' + password: '${{ secrets.DOCKERHUB_TOKEN }}' + - name: Build and publish + uses: docker/build-push-action@v2 + with: + platforms: linux/amd64,linux/armhf + push: true + tags: '${{ secrets.DOCKERHUB_USERNAME }}/cgitize:latest' + + publish_pypi: + needs: [test_local, test_docker] + runs-on: ubuntu-latest + name: 'Publish: PyPI' + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Set up Python + uses: actions/setup-python@v2 + - name: Verify package can be installed + run: python3 -m pip install . + - name: Install package builder + run: python3 -m pip install --upgrade build + - name: Build package + run: python3 -m build + - name: Publish as artifact + uses: actions/upload-artifact@v2 + with: + name: dist + path: dist + if-no-files-found: error + - name: Publish to PyPI + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') + uses: pypa/gh-action-pypi-publish@release/v1 + with: + user: __token__ + password: '${{ secrets.PYPI_API_TOKEN }}' diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml deleted file mode 100644 index 4a848aa..0000000 --- a/.github/workflows/test.yml +++ /dev/null @@ -1,86 +0,0 @@ -name: Test - -on: - push: - pull_request: - workflow_dispatch: - -jobs: - test_local: - runs-on: ubuntu-latest - strategy: - matrix: - python-version: [3.6, 3.7, 3.8, 3.9, 3.x] - name: 'Test: ${{ matrix.python-version }}' - steps: - - name: Checkout - uses: actions/checkout@v2 - - name: Set up Python - uses: actions/setup-python@v2 - with: - python-version: '${{ matrix.python-version }}' - - name: Initialize Git - run: | - git config --global user.name 'John Doe' - git config --global user.email 'John.Doe@example.com' - - name: Test - run: ./.ci/local/test.sh - - test_docker: - runs-on: ubuntu-latest - name: 'Test: Docker' - steps: - - name: Checkout - uses: actions/checkout@v2 - - name: Test - run: ./.ci/docker/test.sh - - publish_docker: - needs: [test_local, test_docker] - runs-on: ubuntu-latest - name: 'Publish: Docker Hub' - if: github.event_name == 'push' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags')) - steps: - - name: Set up QEMU - uses: docker/setup-qemu-action@v1 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v1 - - name: Login to Docker Hub - uses: docker/login-action@v1 - with: - username: '${{ secrets.DOCKERHUB_USERNAME }}' - password: '${{ secrets.DOCKERHUB_TOKEN }}' - - name: Build and publish - uses: docker/build-push-action@v2 - with: - platforms: linux/amd64,linux/armhf - push: true - tags: '${{ secrets.DOCKERHUB_USERNAME }}/cgitize:latest' - - publish_pypi: - needs: [test_local, test_docker] - runs-on: ubuntu-latest - name: 'Publish: PyPI' - steps: - - name: Checkout - uses: actions/checkout@v2 - - name: Set up Python - uses: actions/setup-python@v2 - - name: Verify package can be installed - run: python3 -m pip install . - - name: Install package builder - run: python3 -m pip install --upgrade build - - name: Build package - run: python3 -m build - - name: Publish as artifact - uses: actions/upload-artifact@v2 - with: - name: dist - path: dist - if-no-files-found: error - - name: Publish to PyPI - if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') - uses: pypa/gh-action-pypi-publish@release/v1 - with: - user: __token__ - password: '${{ secrets.PYPI_API_TOKEN }}' -- cgit v1.2.3