Merge branch 'main' of https://github.com/prettyirrelevant/bridgebloc #105
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: BridgeBloc CI | |
on: | |
pull_request: | |
branches: | |
- main | |
push: | |
branches: | |
- main | |
env: | |
SECRET_KEY: ${{ secrets.SECRET_KEY }} | |
DATABASE_URL: ${{ secrets.DATABASE_URL }} | |
HUEY_IMMEDIATE: ${{ secrets.HUEY_IMMEDIATE }} | |
HUEY_REDIS_URL: ${{ secrets.HUEY_REDIS_URL }} | |
DJANGO_SETTINGS_MODULE: ${{ secrets.DJANGO_SETTINGS_MODULE }} | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
CIRCLE_SANDBOX_API_KEY: ${{ secrets.CIRCLE_SANDBOX_API_KEY }} | |
CIRCLE_SANDBOX_BASE_URL: ${{ secrets.CIRCLE_SANDBOX_BASE_URL }} | |
CIRCLE_LIVE_API_KEY: ${{ secrets.CIRCLE_LIVE_API_KEY }} | |
CIRCLE_LIVE_BASE_URL: ${{ secrets.CIRCLE_LIVE_BASE_URL }} | |
CIRCLE_MASTER_WALLET_ID: ${{ secrets.CIRCLE_MASTER_WALLET_ID }} | |
INFURA_API_KEY: ${{ secrets.INFURA_API_KEY }} | |
PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
#---------------------------------------------- | |
# Backend linting job | |
#---------------------------------------------- | |
lint-backend: | |
name: Backend Lint | |
runs-on: ubuntu-latest | |
services: | |
postgres: | |
image: postgres:15.3-alpine | |
env: | |
POSTGRES_PASSWORD: postgres | |
POSTGRES_USER: postgres | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
- 5432:5432 | |
redis: | |
image: redis:6-alpine | |
options: >- | |
--health-cmd "redis-cli ping" | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
- 6379:6379 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.11" | |
- name: Load cached poetry installation | |
id: cached-poetry | |
uses: actions/cache@v3 | |
with: | |
path: ~/.local | |
key: poetry-0 | |
- name: Install Poetry | |
if: steps.cached-poetry.outputs.cache-hit != 'true' | |
uses: snok/[email protected] | |
with: | |
virtualenvs-create: true | |
virtualenvs-in-project: true | |
- name: Load cached venv | |
id: cached-poetry-dependencies | |
uses: actions/cache@v3 | |
with: | |
path: .venv | |
key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }} | |
- name: Install dependencies | |
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' | |
working-directory: ./backend | |
run: poetry install --no-interaction | |
- name: Run linters | |
working-directory: ./backend | |
run: poetry run make lint | |
#---------------------------------------------- | |
# Backend testing job | |
#---------------------------------------------- | |
test-backend: | |
name: Backend Tests | |
runs-on: ubuntu-latest | |
needs: ["lint-backend"] | |
services: | |
postgres: | |
image: postgres:15.3-alpine | |
env: | |
POSTGRES_PASSWORD: postgres | |
POSTGRES_USER: postgres | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
- 5432:5432 | |
redis: | |
image: redis:6-alpine | |
options: >- | |
--health-cmd "redis-cli ping" | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
- 6379:6379 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.11" | |
- name: Load cached poetry installation | |
id: cached-poetry | |
uses: actions/cache@v3 | |
with: | |
path: ~/.local | |
key: poetry-0 | |
- name: Install Poetry | |
if: steps.cached-poetry.outputs.cache-hit != 'true' | |
uses: snok/[email protected] | |
with: | |
virtualenvs-create: true | |
virtualenvs-in-project: true | |
- name: Load cached venv | |
id: cached-poetry-dependencies | |
uses: actions/cache@v3 | |
with: | |
path: .venv | |
key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }} | |
- name: Install dependencies | |
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' | |
working-directory: ./backend | |
run: poetry install --no-interaction | |
- name: Run DB migrations | |
working-directory: ./backend | |
run: poetry run python manage.py migrate | |
- name: Install pytest annotation plugin | |
working-directory: ./backend | |
run: poetry add pytest-github-actions-annotate-failures | |
- name: Run tests | |
working-directory: ./backend | |
run: poetry run make test | |
- name: Upload coverage reports to Codecov | |
uses: codecov/codecov-action@v3 | |
with: | |
flags: backend | |
directory: backend | |
files: .coverage.xml | |
#---------------------------------------------- | |
# Smart contract testing job | |
#---------------------------------------------- | |
test-contracts: | |
name: Smart Contract Tests | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup Nodejs | |
uses: actions/setup-node@v3 | |
with: | |
node-version: "16.0.0" | |
- name: Install dependencies | |
working-directory: ./contracts | |
run: yarn --ignore-scripts | |
- name: Run Eth Mainnet Fork tests | |
working-directory: ./contracts | |
run: yarn hardhat --config hardhat-eth-fork.config.ts test ./test/cctp-bridge-eth.spec.ts | |