add brotli compression #995
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
env: | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: postgres | |
POSTGRES_HOST: localhost | |
POSTGRES_PORT: 5432 | |
RAILS_ENV: e2e | |
SECRET_KEY_BASE: f54c9d76c42e397e17cbc0d0a024da5a762a7a0d934839b417a77dac6fda65a49a37b32bcd229ac5fd5c1fedef8ed6acf7a57ed6465d6339862cdc0dfab8886f | |
AUTH_SECRET: secret | |
CONTACT_EMAIL: [email protected] | |
RESPONSIBLE_EMAIL: [email protected] | |
FRONTEND_URL: http://localhost:4000 | |
OBSERVATIONS_TOOL_URL: http://localhost:4200 | |
CYPRESS_API_PATH: ../otp_api | |
name: Run tests | |
on: push | |
jobs: | |
test: | |
name: E2E Tests | |
runs-on: ubuntu-latest | |
services: | |
redis: | |
image: redis | |
ports: ["6379:6379"] | |
postgres: | |
image: postgis/postgis:12-3.1-alpine | |
env: | |
POSTGRES_USER: ${{ env.POSTGRES_USER }} | |
POSTGRES_PASSWORD: ${{ env.POSTGRES_PASSWORD }} | |
ports: ["5432:5432"] | |
steps: | |
- name: Checkout Portal | |
uses: actions/checkout@v4 | |
- name: Checkout OTP API | |
uses: actions/checkout@v4 | |
with: | |
repository: wri/fti_api | |
ref: develop | |
path: otp_api | |
- name: Save OTP API Commit SHA | |
id: otp_api_commit_sha | |
working-directory: otp_api | |
run: echo "VALUE=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT | |
- name: Install API dependencies | |
run: | | |
sudo apt update --fix-missing | |
sudo apt-get -yqq install libpq-dev build-essential libcurl4-openssl-dev libgdal-dev | |
npm install -g mjml | |
- name: Setup API Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
bundler-cache: true | |
working-directory: otp_api | |
- name: Restore API Precompiled Assets Cache | |
id: cache-api-precompiled-assets | |
uses: actions/cache/restore@v3 | |
with: | |
path: otp_api/public/assets | |
key: api-precompiled-assets-${{ steps.otp_api_commit_sha.outputs.VALUE }} | |
- name: Setup API | |
working-directory: otp_api | |
env: | |
APP_URL: http://localhost:3000 | |
run: | | |
bin/rails e2e:setup ${{ steps.cache-api-precompiled-assets.outputs.cache-hit == 'true' && 'SKIP_ASSETS_RESET=true' || '' }} | |
- name: Save API Precompiled Assets Cache | |
uses: actions/cache/save@v3 | |
with: | |
path: otp_api/public/assets | |
key: api-precompiled-assets-${{ steps.otp_api_commit_sha.outputs.VALUE }} | |
- name: Read API Access Token | |
id: api_key | |
working-directory: otp_api | |
run: | | |
bin/rails runner 'puts "VALUE=#{User.find_by(email: "[email protected]").api_key.access_token}"' > $GITHUB_OUTPUT | |
- name: Run API Server | |
working-directory: otp_api | |
env: | |
APP_URL: http://localhost:3000 | |
run: | | |
bin/rails s & | |
- name: Read .nvmrc | |
id: nvm | |
run: echo "NVMRC=$(cat .nvmrc)" >> $GITHUB_OUTPUT | |
- uses: actions/setup-node@v2 | |
with: | |
node-version: "${{ steps.nvm.outputs.NVMRC }}" | |
- name: Restore Portal Node Modules Cache | |
id: cache-portal-modules | |
uses: actions/cache/restore@v3 | |
with: | |
path: node_modules | |
key: node-modules-${{ hashFiles('yarn.lock') }} | |
- name: Install Portal Dependencies | |
run: yarn install --immutable | |
- name: Save Portal Node Modules Cache | |
uses: actions/cache/save@v3 | |
with: | |
path: node_modules | |
key: node-modules-${{ hashFiles('yarn.lock') }} | |
- name: Install E2E Dependencies | |
working-directory: e2e | |
run: yarn install --immutable | |
- name: Set Portal ENV Variables | |
run: | | |
echo " | |
PORT=4000 | |
ENV=production | |
NODE_ENV=production | |
SECRET=946bd4887fa5eea44256377ca06fc798f431359e1b1885e0d9ac570c1f24d8fe3e5863855d02d61e375729a330f5c7d84606ca1bf735b0676eb368321a119637 | |
OTP_COUNTRIES='COG,CMR,COD,CAF,GAB' | |
OTP_COUNTRIES_IDS='7,47,45,188,53' | |
APP_URL=http://localhost:4000 | |
OTP_API=http://localhost:3000 | |
OTP_API_KEY=Bearer ${{ steps.api_key.outputs.VALUE }} | |
DISABLE_HOTJAR=true | |
" > .env | |
- name: Restore Next.js Build Cache | |
id: cache-nextjs | |
uses: actions/cache/restore@v3 | |
with: | |
path: .next/cache | |
key: nextjs-${{ hashFiles('yarn.lock') }} | |
- name: Build Portal | |
run: yarn build | |
- name: Save Next.js Build Cache | |
uses: actions/cache/save@v3 | |
with: | |
path: .next/cache | |
key: nextjs-${{ hashFiles('yarn.lock') }} | |
- name: Start Portal | |
run: yarn start > otp-portal.log & | |
- name: Run E2E Tests | |
working-directory: e2e | |
run: yarn cypress run | |
- name: Uploading Test Artifacts | |
uses: actions/upload-artifact@v4 | |
if: failure() | |
with: | |
name: e2e-tests-artifacts | |
path: | | |
otp-portal.log | |
e2e/cypress/screenshots | |
e2e/cypress/videos | |
e2e/cypress/e2e/__image_snapshots__ | |
otp_api/log | |