Skip to content

More fixes

More fixes #135

Workflow file for this run

name: Docker Image CI
on:
push:
branches: [ "master", "main", "newlance"]
pull_request:
permissions:
contents: read
jobs:
run_tests:
runs-on: ubuntu-latest
name: Run tests
env:
ETHLANCE_ENV: qa
services:
ipfs-daemon:
image: district0x/ipfs-daemon:latest
postgres:
image: postgres:latest
ports:
- 5432:5432
env:
POSTGRES_PASSWORD: pass
POSTGRES_USER: ethlanceuser
POSTGRES_DB: ethlance-test
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Checkout ethlance code
uses: actions/checkout@v4
- name: Checkout ethlance-configs repo
uses: actions/checkout@v4
with:
repository: district0x/ethlance-config
path: ethlance-config
token: ${{ secrets.ETHLANCE_CONFIG_PAT }}
ref: master
- name: Run ganache service
run: |
docker run --rm -d --name ganache -p 8550:8550 trufflesuite/ganache:v7.9.1 -v -m "easy leave proof verb wait patient fringe laptop intact opera slab shine" -p 8550 -b 0.5 --chain.allowUnlimitedContractSize=true
- name: Restore Top level cache directory for Ethlance
uses: actions/cache@v3
id: yarn-cache-top-level
with:
path: ./node_modules
key: ${{ runner.os }}-ethlance-top-level-yarn-${{ hashFiles('yarn.lock') }}
restore-keys: |
${{ runner.os }}-ethlance-top-level-yarn-
- name: Install ethlance top-level node modules
run: |
yarn install
- name: Restore Server cache directory for Ethlance
uses: actions/cache@v3
id: yarn-cache-server
with:
path: ./server/node_modules
key: ${{ runner.os }}-ethlance-server-yarn-${{ hashFiles('server/yarn.lock') }}
restore-keys: |
${{ runner.os }}-ethlance-server-yarn-
- name: Install ethlance server node modules
run: |
cd server
yarn install
cd ..
- name: Deploy contracts to ganache-test
run: |
npx truffle migrate --network ganache-test --reset
- name: Setup Babashka
uses: turtlequeue/[email protected]
with:
babashka-version: 1.3.186
- name: Check bb version
run: bb --version
- name: Run server tests
run: bb run-server-tests
- name: Stop Ganache service
run: docker rm -f ganache
docker_build:
name: Build images and deploy contracts
needs: run_tests
strategy:
matrix:
env: ["qa"]
permissions:
contents: read
runs-on: ubuntu-latest
steps:
- name: Checkout ethlance code
uses: actions/checkout@v4
- name: Restore Top level cache directory for Ethlance
uses: actions/cache@v3
id: yarn-cache-top-level
with:
path: ./node_modules
key: ${{ runner.os }}-ethlance-top-level-yarn-${{ hashFiles('yarn.lock') }}
restore-keys: |
${{ runner.os }}-ethlance-top-level-yarn-
- name: Install ethlance top-level node modules
run: |
yarn install
- name: Set up QEMU
id: setup-qemu
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
id: setup-buildx
uses: docker/setup-buildx-action@v2
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_DEFAULT_REGION }}
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v2
- name: Checkout ethlance-configs repo
uses: actions/checkout@v4
with:
repository: district0x/ethlance-config
path: ethlance-config
token: ${{ secrets.ETHLANCE_CONFIG_PAT }}
ref: master
- name: Copy configs
run: |
cp -r ethlance-config/config .
ls -lah config/
- name: Build and push UI
uses: docker/build-push-action@v4
with:
context: .
platforms: linux/amd64
builder: ${{ steps.setup-buildx.outputs.name }}
file: docker-builds/ui/Dockerfile
build-args: BUILD_ENV=${{ matrix.env }}
push: true
tags: ${{ secrets.ECR_REGISTRY }}/ethlance-ui:latest-${{ matrix.env }}
- name: Build and push Server
uses: docker/build-push-action@v4
with:
context: .
builder: ${{ steps.setup-buildx.outputs.name }}
platforms: linux/amd64
file: docker-builds/server/Dockerfile
build-args: BUILD_ENV=${{ matrix.env }}
push: true
tags: ${{ secrets.ECR_REGISTRY }}/ethlance-server:latest-${{ matrix.env }}