feat: Remove unnecessary env vars #13
Workflow file for this run
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: Checks | |
on: | |
pull_request: | |
types: [opened, reopened, synchronize] | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
services: | |
postgres: | |
image: postgres:latest | |
env: | |
POSTGRES_USER: test | |
POSTGRES_PASSWORD: test | |
POSTGRES_DB: db | |
POSTGRESQL_FSYNC: "off" | |
ports: | |
- 5432:5432 | |
# needed because the postgres container does not provide a healthcheck | |
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
- name: Detect package manager | |
id: detect-package-manager | |
run: | | |
if [ -f "${{ github.workspace }}/yarn.lock" ]; then | |
echo "manager=yarn" >> $GITHUB_OUTPUT | |
echo "command=install" >> $GITHUB_OUTPUT | |
echo "runner=yarn" >> $GITHUB_OUTPUT | |
exit 0 | |
elif [ -f "${{ github.workspace }}/package.json" ]; then | |
echo "manager=npm" >> $GITHUB_OUTPUT | |
echo "command=ci" >> $GITHUB_OUTPUT | |
echo "runner=npx --no-install" >> $GITHUB_OUTPUT | |
exit 0 | |
else | |
echo "Unable to determine package manager" >&2 | |
exit 1 | |
fi | |
- name: Setup Node | |
uses: actions/setup-node@v3 | |
with: | |
# NVM Codename for Node 20 LTS | |
node-version: "lts/iron" | |
cache: ${{ steps.detect-package-manager.outputs.manager }} | |
- name: Restore cache | |
uses: actions/cache@v3 | |
with: | |
path: | | |
.next/cache | |
# Generate a new cache whenever packages or source files change. | |
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json', '**/yarn.lock') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }} | |
# If source files changed but packages didn't, rebuild from a prior cache. | |
restore-keys: | | |
${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json', '**/yarn.lock') }}- | |
- name: Install dependencies | |
run: ${{ steps.detect-package-manager.outputs.manager }} ${{ steps.detect-package-manager.outputs.command }} | |
- name: Lint | |
run: ${{ steps.detect-package-manager.outputs.manager }} run lint | |
env: | |
SKIP_ENV_VALIDATION: true | |
DATABASE_URL: postgres://test:test@localhost:5432/db | |
- name: Lint Prisma | |
run: ${{ steps.detect-package-manager.outputs.manager }} run lint:prisma | |
env: | |
DATABASE_URL: postgres://test:test@localhost:5432/db | |
- name: Can run Migrations | |
run: ${{ steps.detect-package-manager.outputs.manager }} run db:push | |
env: | |
DATABASE_URL: postgres://test:test@localhost:5432/db | |
- name: Build | |
run: ${{ steps.detect-package-manager.outputs.manager }} run build -d | |
env: | |
DATABASE_URL: postgres://test:test@localhost:5432/db | |
NEXTAUTH_SECRET: secret | |
NEXTAUTH_URL: http://localhost:3000 |