Bump docker/build-push-action from 4 to 5 #50
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Python CI | |
on: | |
push: | |
branches: | |
- master | |
- develop | |
pull_request: | |
release: | |
types: [ released ] | |
jobs: | |
test-app: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: [3.8, 3.9, "3.10"] | |
steps: | |
- name: Setup and run ganache | |
run: docker run --detach --publish 8545:8545 --network-alias ganache -e DOCKER=true trufflesuite/ganache:latest --defaultBalanceEther 10000 --gasLimit 10000000 -a 30 --chain.chainId 1337 --chain.networkId 1337 -d | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
cache: 'pip' | |
cache-dependency-path: 'requirements*.txt' | |
- name: Install dependencies | |
run: | | |
pip install wheel | |
pip install -r requirements-test.txt coveralls pre-commit | |
env: | |
PIP_USE_MIRRORS: true | |
- name: Run pre-commit | |
run: pre-commit run --all-files | |
- name: Run tests and coverage | |
run: | | |
pytest -rxXs | |
coverage run --source=$SOURCE_FOLDER -m pytest -rxXs | |
env: | |
SOURCE_FOLDER: safe_cli | |
- name: Coveralls Parallel | |
uses: coverallsapp/github-action@v2 | |
with: | |
flag-name: run-${{ matrix.python-version }} | |
parallel: true | |
finish: | |
needs: test-app | |
if: ${{ always() }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Coveralls Finished | |
uses: coverallsapp/github-action@v2 | |
with: | |
parallel-finished: true | |
publish: | |
runs-on: ubuntu-latest | |
needs: test-app | |
if: github.event_name == 'release' && github.event.action == 'released' | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.10" | |
cache: 'pip' | |
cache-dependency-path: 'requirements*.txt' | |
- name: Deploy Package | |
run: | | |
python -m pip install --upgrade setuptools wheel twine | |
python setup.py sdist bdist_wheel | |
twine upload dist/* | |
env: | |
TWINE_USERNAME: __token__ | |
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} | |
docker-deploy: | |
runs-on: ubuntu-latest | |
needs: test-app | |
if: github.event_name == 'release' && github.event.action == 'released' | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: docker/setup-qemu-action@v2 | |
with: | |
platforms: arm64 | |
- uses: docker/setup-buildx-action@v3 | |
- name: Dockerhub login | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_USER }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Deploy Tag | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: Dockerfile | |
push: true | |
tags: | | |
safeglobal/safe-cli:${{ github.event.release.tag_name }} | |
safeglobal/safe-cli:latest | |
platforms: | | |
linux/amd64 | |
linux/arm64 | |
cache-from: type=gha | |
cache-to: type=gha,mode=max |