Skip to content

Add support for reorg events #634

Add support for reorg events

Add support for reorg events #634

Workflow file for this run

name: CI
on:
push:
branches:
- main
pull_request:
release:
types: [released]
jobs:
format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20.x'
cache: 'npm'
- run: npm i
- run: npm run format
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20.x'
cache: 'npm'
- run: npm i
- run: npm run lint
db-migrations:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:14
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: migrations
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5433:5432
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20.x'
cache: 'npm'
- run: npm i
- run: cp .env.sample .env
- run: npm run build
- run: bash ./scripts/db_run_migrations.sh
- run: bash ./scripts/db_check_migrations.sh
tests:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:14
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: test
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
rabbitmq:
image: rabbitmq:alpine
ports:
- 5672:5672
options: >-
--health-cmd "rabbitmqctl await_startup"
--health-interval 10s
--health-timeout 5s
--health-retries 5
strategy:
fail-fast: false
matrix:
task: ['test:cov', 'test:e2e:cov']
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20.x'
cache: 'npm'
- run: npm i
- run: cp .env.sample .env
- run: npm run build
- run: npm run ${{matrix.task}}
- name: Coveralls Parallel
uses: coverallsapp/github-action@v2.3.1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
flag-name: run-${{ matrix.task }}
parallel: true
tests-finish:
needs: tests
runs-on: ubuntu-latest
steps:
- name: Coveralls Finished
uses: coverallsapp/github-action@v2.3.1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
parallel-finished: true
docker-publish:
if: github.ref == 'refs/heads/main' || (github.event_name == 'release' && github.event.action == 'released')
needs:
- format
- lint
- tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: docker/setup-qemu-action@v3.2.0
with:
platforms: arm64
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Deploy main
if: github.ref == 'refs/heads/main'
uses: docker/build-push-action@v6
with:
platforms: linux/amd64,linux/arm64
push: true
tags: safeglobal/safe-events-service:staging
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Deploy Tag
if: (github.event_name == 'release' && github.event.action == 'released')
uses: docker/build-push-action@v6
with:
platforms: linux/amd64,linux/arm64
push: true
tags: |
safeglobal/safe-events-service:${{ github.event.release.tag_name }}
safeglobal/safe-events-service:latest
cache-from: type=gha
cache-to: type=gha,mode=max
autodeploy:
runs-on: ubuntu-latest
needs: [docker-publish]
if: github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v4
- name: Deploy Staging
if: github.ref == 'refs/heads/main'
run: bash scripts/autodeploy.sh
env:
AUTODEPLOY_URL: ${{ secrets.AUTODEPLOY_URL }}
AUTODEPLOY_TOKEN: ${{ secrets.AUTODEPLOY_TOKEN }}
TARGET_ENV: "staging"