Set version 4.3.1 #1040
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: | |
linting: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ["3.10"] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: pip install pre-commit | |
- name: Run pre-commit | |
run: pre-commit run --all-files | |
test-app: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ["3.10"] | |
services: | |
redis: | |
image: redis | |
options: >- | |
--health-cmd "redis-cli ping" | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
- 6379:6379 | |
postgres: | |
image: postgres:13 | |
env: | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: postgres | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
- 5432:5432 | |
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@v3 | |
- 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 | |
env: | |
PIP_USE_MIRRORS: true | |
- name: Run tests and coverage | |
run: | | |
python manage.py check | |
python manage.py makemigrations --check --dry-run | |
coverage run --source=$SOURCE_FOLDER -m pytest -rxXs | |
env: | |
SOURCE_FOLDER: safe_relay_service | |
CELERY_BROKER_URL: redis://localhost:6379/0 | |
DJANGO_SETTINGS_MODULE: config.settings.test | |
DATABASE_URL: psql://postgres:postgres@localhost/postgres | |
ETHEREUM_NODE_URL: http://localhost:8545 | |
ETHEREUM_TRACING_NODE_URL: http://localhost:8545 | |
ETH_HASH_BACKEND: pysha3 | |
REDIS_URL: redis://localhost:6379/0 | |
- name: Coveralls | |
uses: coverallsapp/github-action@v2 | |
docker-deploy: | |
runs-on: ubuntu-latest | |
needs: | |
- linting | |
- test-app | |
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop' || startsWith(github.ref, 'refs/tags/') | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Dockerhub login | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKER_USER }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Deploy Master | |
if: github.ref == 'refs/heads/master' | |
run: bash scripts/deploy_docker.sh staging | |
env: | |
DOCKERHUB_PROJECT: safe-relay-service | |
- name: Deploy Develop | |
if: github.ref == 'refs/heads/develop' | |
run: bash scripts/deploy_docker.sh develop | |
env: | |
DOCKERHUB_PROJECT: safe-relay-service | |
- name: Deploy Tag | |
if: startsWith(github.ref, 'refs/tags/') | |
run: bash scripts/deploy_docker.sh ${GITHUB_REF##*/} | |
env: | |
DOCKERHUB_PROJECT: safe-relay-service |