improve design #13
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: Test Build Process | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
workflow_dispatch: | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
name: Run Tests | |
services: | |
db: | |
image: postgres:14 | |
env: | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: postgres | |
POSTGRES_DB: fileonchain | |
ports: ['5432:5432'] | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: erlef/setup-beam@v1 | |
with: | |
otp-version: '26' | |
elixir-version: 'v1.14-otp-26' | |
- name: Cache dependencies | |
uses: actions/cache@v2 | |
with: | |
path: deps | |
key: ${{ runner.os }}-mix-${{ hashFiles('**/mix.lock') }} | |
restore-keys: | | |
${{ runner.os }}-mix- | |
- name: Install Dependencies | |
run: mix deps.get | |
- name: Start Hasura GraphQL Engine | |
env: | |
HASURA_GRAPHQL_METADATA_DATABASE_URL: postgres://postgres:postgres@localhost:5432/fileonchain | |
HASURA_GRAPHQL_ENABLE_CONSOLE: "false" | |
HASURA_GRAPHQL_DEV_MODE: "true" | |
HASURA_GRAPHQL_ADMIN_SECRET: helloworld | |
HASURA_GRAPHQL_UNAUTHORIZED_ROLE: visitor | |
HASURA_GRAPHQL_STRINGIFY_NUMERIC_TYPES: "true" | |
run: | | |
docker run -d --name graphql-engine --network host \ | |
-e HASURA_GRAPHQL_METADATA_DATABASE_URL=${{ env.HASURA_GRAPHQL_METADATA_DATABASE_URL }} \ | |
-e HASURA_GRAPHQL_ENABLE_CONSOLE=${{ env.HASURA_GRAPHQL_ENABLE_CONSOLE }} \ | |
-e HASURA_GRAPHQL_DEV_MODE=${{ env.HASURA_GRAPHQL_DEV_MODE }} \ | |
-e HASURA_GRAPHQL_ADMIN_SECRET=${{ env.HASURA_GRAPHQL_ADMIN_SECRET }} \ | |
-e HASURA_GRAPHQL_UNAUTHORIZED_ROLE=${{ env.HASURA_GRAPHQL_UNAUTHORIZED_ROLE }} \ | |
-e HASURA_GRAPHQL_STRINGIFY_NUMERIC_TYPES=${{ env.HASURA_GRAPHQL_STRINGIFY_NUMERIC_TYPES }} \ | |
hasura/graphql-engine:v2.40.0 | |
- name: Run Tests | |
run: mix test | |
build: | |
runs-on: ubuntu-latest | |
needs: test | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Log in to GitHub Container Registry | |
uses: docker/login-action@v1 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build Docker Image | |
uses: docker/build-push-action@v2 | |
with: | |
context: . | |
push: false | |
tags: ghcr.io/${{ github.repository_owner }}/my_phoenix_app:test-${{ github.sha }} |