Local dev fixes (#1044) #483
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: Aqualink API CI | |
on: | |
# Run on all pull requests and on pushes to main. | |
pull_request: | |
paths: | |
- 'packages/api/**' | |
push: | |
branches: | |
- master | |
jobs: | |
api_test_and_build: | |
runs-on: ubuntu-22.04 | |
env: | |
DATABASE_URL: postgres://postgres:postgres@localhost:5432/postgres | |
TEST_DATABASE_URL: postgres://postgres:postgres@localhost:5432/postgres | |
BACKEND_BASE_URL: ${{ vars.BACKEND_BASE_URL }} | |
STORAGE_MAX_FILE_SIZE_MB: ${{ vars.STORAGE_MAX_FILE_SIZE_MB }} | |
GCS_BUCKET: ${{ secrets.GCS_BUCKET }} | |
GCS_KEYFILE: ${{ secrets.GCS_KEYFILE }} | |
GC_PROJECT: ${{ secrets.GC_PROJECT }} | |
SOFAR_API_TOKEN: ${{ secrets.SOFAR_API_TOKEN }} | |
STORAGE_FOLDER: ${{ secrets.STORAGE_FOLDER }} | |
services: | |
postgres: | |
image: kartoza/postgis:12.1 | |
env: | |
POSTGRES_USER: postgres | |
POSTGRES_DB: postgres | |
POSTGRES_PASSWORD: postgres | |
ports: | |
- 5432:5432 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Use Node.js 18.x | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- uses: actions/cache@v2 | |
id: yarn-cache | |
with: | |
path: | | |
**/node_modules | |
key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-yarn- | |
- name: Install dependencies if needed. | |
id: install | |
if: steps.yarn-cache.outputs.cache-hit != 'true' | |
run: | | |
yarn install --ignore-engines --frozen-lockfile | |
- name: Run API lint | |
if: success() || steps.install.conclusion == 'skipped' | |
working-directory: packages/api | |
run: yarn lint | |
- name: Build API | |
if: success() || steps.install.conclusion == 'skipped' || steps.install.conclusion == 'success' | |
working-directory: packages/api | |
run: yarn build | |
- name: Build Cloud functions | |
if: success() || steps.install.conclusion == 'skipped' || steps.install.conclusion == 'success' | |
working-directory: packages/api | |
run: yarn build:cloud-functions | |
- name: Run database migrations | |
id: migrations | |
if: success() || steps.install.conclusion == 'skipped' || steps.install.conclusion == 'success' | |
working-directory: packages/api | |
run: yarn migration:run | |
- name: Run API tests | |
if: success() || steps.migrations.outcome == 'success' | |
working-directory: packages/api | |
run: yarn test |