New UI for Forms Validation #597
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: ⛷ PR tests | |
env: | |
CI: true | |
NODE_VERSION: 18 | |
defaults: | |
run: | |
shell: bash | |
on: | |
pull_request: | |
types: [opened, synchronize, reopened] | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
services: | |
# Postgres image for backend integration tests | |
postgres: | |
image: postgres:14-alpine | |
env: | |
POSTGRES_DB: seed | |
POSTGRES_USER: seed | |
POSTGRES_PASSWORD: Ge0rgesMoustaki | |
ports: | |
# Maps tcp port 5432 on service container to the host | |
- 5434:5432 | |
# 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 | |
uses: actions/checkout@v3 | |
- name: Install pnpm | |
uses: pnpm/action-setup@v4 | |
with: | |
version: 9.4.0 | |
- name: Setup Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
cache: 'pnpm' | |
- name: Install dependencies | |
run: pnpm install | |
- name: linters | |
run: pnpm lint | |
- name: build | |
run: pnpm build | |
- name: Tests | |
run: pnpm test | |
- name: Dependency Cruiser | |
run: pnpm test:circular | |
security-check: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Install pnpm | |
uses: pnpm/action-setup@v4 | |
with: | |
version: 9.4.0 | |
- name: Setup Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
cache: 'pnpm' | |
- name: Install dependencies | |
run: pnpm install | |
- name: Check for vulnerable dependencies | |
run: pnpm run security | |
frontend_build_and_deploy: | |
needs: test | |
if: github.event_name == 'pull_request' | |
runs-on: ubuntu-latest | |
env: | |
surge_url: wfp-dmp-${{ github.event.pull_request.number }}.surge.sh | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: pnpm/[email protected] | |
- name: Setup Node.js | |
id: setup-node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
cache: 'pnpm' | |
- name: Log pnpm version | |
run: pnpm --version | |
- name: Check lockfile version | |
run: | | |
if grep -q '"lockfileVersion":' ../../pnpm-lock.yaml; then | |
echo "Lockfile version: $(grep '"lockfileVersion":' ../../pnpm-lock.yaml)"; | |
else | |
echo "Lockfile version not found"; | |
fi | |
- name: Install frontend dependencies | |
run: pnpm install --frozen-lockfile | |
- name: Clean build folder | |
run: rm -rf apps/frontend/out | |
- name: Build Interfaces & Frontend | |
run: pnpm turbo build | |
env: | |
NEXT_PUBLIC_API_BASE_URL: https://api-dmp.ovio.org | |
- name: Export to static HTML | |
run: | | |
cd apps/frontend | |
./gen_env.sh staging | |
cd out | |
cp index.html 200.html | |
- name: Deploy on surge | |
uses: dswistowski/surge-sh-action@v1 | |
with: | |
domain: ${{ env.surge_url }} | |
project: "apps/frontend/out/." | |
login: ${{ secrets.surge_login }} | |
token: ${{ secrets.surge_token }} | |
- name: Get current date | |
id: date | |
run: echo "::set-output name=date::$(date +'%Y-%m-%dT%H:%M:%S')" | |
- name: Comment PR | |
uses: marocchino/sticky-pull-request-comment@v1 | |
continue-on-error: true | |
with: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
message: | | |
Build succeeded and deployed at https://${{ env.surge_url }} | |
(hash ${{ github.event.pull_request.head.sha }} deployed at ${{ steps.date.outputs.date }}) |