deleted #249
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: Server Workflow | |
on: | |
pull_request: | |
branches: | |
- main | |
paths: | |
- "server/**" | |
push: | |
branches: | |
- main | |
paths: | |
- "server/**" | |
workflow_dispatch: | |
defaults: | |
run: | |
working-directory: ./server | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
environment: development | |
env: | |
NODE_ENV: ${{ vars.NODE_ENV }} | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
- name: Cache Dependencies | |
id: cache | |
uses: actions/cache@v3 | |
with: | |
path: ~/.npm | |
key: server-node-modules-${{ hashFiles('./server/package-lock.json') }} | |
- name: Install Dependencies | |
run: npm ci | |
- name: Format Code | |
run: npm run prettier | |
- name: Lint Code | |
run: npm run lint:fix | |
test: | |
needs: lint | |
runs-on: ubuntu-latest | |
environment: test | |
env: | |
NODE_ENV: ${{ vars.NODE_ENV }} | |
SERVER_PORT: ${{ vars.SERVER_PORT }} | |
DATABASE_HOST: ${{ secrets.DATABASE_HOST }} | |
DATABASE_PORT: ${{ vars.DATABASE_PORT }} | |
DATABASE_USER: ${{ secrets.DATABASE_USER }} | |
DATABASE_PASSWORD: ${{ secrets.DATABASE_PASSWORD }} | |
DATABASE_NAME: ${{ vars.DATABASE_NAME }} | |
GOOGLE_CLIENT_ID: ${{ vars.GOOGLE_CLIENT_ID }} | |
GOOGLE_CLIENT_SECRET: ${{ secrets.GOOGLE_CLIENT_SECRET }} | |
JWT_SECRET: ${{ secrets.JWT_SECRET }} | |
services: | |
postgres: | |
image: postgres:latest | |
env: | |
POSTGRES_USER: ${{ env.DATABASE_USER }} | |
POSTGRES_PASSWORD: ${{ env.DATABASE_PASSWORD }} | |
POSTGRES_DB: ${{ env.DATABASE_NAME }} | |
ports: | |
- 5432:5432 | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
- name: Cache Dependencies | |
id: cache | |
uses: actions/cache@v3 | |
with: | |
path: ~/.npm | |
key: server-node-modules-${{ hashFiles('./server/package-lock.json') }} | |
- name: Create .env | |
run: | | |
touch .env | |
echo DATABASE_HOST=${{ secrets.DATABASE_HOST }} >> .env.test | |
echo DATABASE_PORT=${{ vars.DATABASE_PORT }} >> .env.test | |
echo DATABASE_USER=${{ secrets.DATABASE_USER }} >> .env.test | |
echo DATABASE_PASSWORD=${{ secrets.DATABASE_PASSWORD }} >> .env.test | |
echo DATABASE_NAME=${{ secrets.DATABASE_NAME }} >> .env.test | |
- name: Install Dependencies | |
run: npm ci | |
- name: Format Code | |
run: npm run prettier | |
- name: Lint Code | |
run: npm run lint:fix | |
- name: Database Migration | |
run: NODE_ENV=TEST npm run database:migration | |
- name: Test Code | |
run: npm run test | |
# build: | |
# needs: test | |
# runs-on: ubuntu-latest | |
# environment: production | |
# env: | |
# NODE_ENV: ${{ vars.NODE_ENV }} | |
# steps: | |
# - name: Checkout Code | |
# uses: actions/checkout@v4 | |
# - name: Cache Dependencies | |
# id: cache | |
# uses: actions/cache@v3 | |
# with: | |
# path: ~/.npm | |
# key: server-node-modules-${{ hashFiles('./server/package-lock.json') }} | |
# - name: Install Dependencies | |
# run: npm ci | |
# - name: Format Code | |
# run: npm run prettier | |
# - name: Lint Code | |
# run: npm run lint:fix | |
# - name: Build Server | |
# id: build-server | |
# run: npm run build | |
# - name: Upload Artifact | |
# uses: actions/upload-artifact@v3 | |
# with: | |
# name: server-build-folder | |
# path: ./server/build | |
# deploy: | |
# if: ${{ github.event_name != 'pull_request' }} | |
# needs: build | |
# runs-on: ubuntu-latest | |
# steps: | |
# - name: Download Artifact | |
# uses: actions/download-artifact@v3 | |
# with: | |
# name: server-build-folder | |
# path: ./server/build | |
# - name: Show Folder Contents | |
# run: ls -R build | |
# - name: Deploy | |
# run: echo "Deploying..." |