-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
98 additions
and
25 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,67 @@ | ||
env: | ||
POSTGRES_USER: postgres | ||
POSTGRES_PASSWORD: postgres | ||
POSTGRES_PORT_5432_TCP_ADDR: localhost | ||
POSTGRES_PORT_5432_TCP_PORT: 5432 | ||
APP_URL: http://localhost:3000 | ||
RAILS_ENV: e2e | ||
SECRET_KEY_BASE: f54c9d76c42e397e17cbc0d0a024da5a762a7a0d934839b417a77dac6fda65a49a37b32bcd229ac5fd5c1fedef8ed6acf7a57ed6465d6339862cdc0dfab8886f | ||
AUTH_SECRET: secret | ||
CONTACT_EMAIL: [email protected] | ||
RESPONSIBLE_EMAIL: [email protected] | ||
CI_SERVER: true | ||
CYPRESS_API_PATH: ../otp_api | ||
|
||
name: Run tests | ||
|
||
on: push | ||
|
||
jobs: | ||
test: | ||
name: Testing build | ||
name: E2E Tests | ||
runs-on: ubuntu-latest | ||
if: false # skip for now, until we configure repository | ||
|
||
services: | ||
postgres: | ||
image: postgis/postgis:12-3.1-alpine | ||
env: | ||
POSTGRES_USER: ${{ env.POSTGRES_USER }} | ||
POSTGRES_PASSWORD: ${{ env.POSTGRES_PASSWORD }} | ||
ports: ["5432:5432"] | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/checkout@v4 | ||
with: | ||
repository: wri/fti_api | ||
ref: chore/upgrade-rails | ||
path: otp_api | ||
- name: Install API dependencies | ||
run: | | ||
sudo apt update --fix-missing | ||
sudo apt-get -yqq install libpq-dev build-essential libcurl4-openssl-dev gdal-bin | ||
npm install -g mjml | ||
- name: Setup API Ruby | ||
uses: ruby/setup-ruby@v1 | ||
with: | ||
bundler-cache: true | ||
working-directory: otp_api | ||
|
||
- name: Setup API | ||
working-directory: otp_api | ||
run: | | ||
bin/rails e2e:setup | ||
- name: Read API Access Token | ||
working-directory: otp_api | ||
run: | | ||
export OTP_API_KEY="Bearer $(bin/rails runner 'puts User.find_by(email: "[email protected]").api_key.access_token')" | ||
- name: Run API Server | ||
working-directory: otp_api | ||
run: | | ||
bin/rails s & | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Read .nvmrc | ||
id: nvm | ||
|
@@ -19,41 +71,58 @@ jobs: | |
with: | ||
node-version: "${{ steps.nvm.outputs.NVMRC }}" | ||
|
||
- run: yarn install | ||
|
||
- name: Cache Node Modules | ||
id: cache-node-modules | ||
uses: actions/cache@v2 | ||
id: cache-portal-modules | ||
uses: actions/cache@v3 | ||
with: | ||
path: node_modules | ||
key: node-modules-${{ hashFiles('yarn.lock') }} | ||
|
||
- name: Install Dependencies | ||
if: steps.cache.outputs.cache-hit != 'true' | ||
run: yarn install --frozen-lockfile | ||
- name: Install Portal Dependencies | ||
if: steps.cache-portal-modules.outputs.cache-hit != 'true' | ||
run: yarn install --immutable | ||
|
||
- name: Cache Node Modules | ||
id: cache-e2e-modules | ||
uses: actions/cache@v3 | ||
with: | ||
path: e2e/node_modules | ||
key: e2e-node-modules-${{ hashFiles('e2e/yarn.lock') }} | ||
|
||
- name: Install E2E Dependencies | ||
if: steps.cache-e2e-modules.outputs.cache-hit != 'true' | ||
working-directory: e2e | ||
run: yarn install --immutable | ||
|
||
- name: Set Sample ENV Variables | ||
run: | | ||
echo " | ||
PORT=4000 | ||
NODE_ENV=production | ||
ENV=production | ||
SECRET=some_secret | ||
OTP_API_KEY=Bearer jwttoken | ||
SECRET={{ env.AUTH_SECRET }} | ||
OTP_COUNTRIES='COG,CMR,COD,CAF,GAB' | ||
OTP_COUNTRIES_IDS='7,47,45,188,53' | ||
OTP_API=http://localhost:3000 | ||
OTP_API_KEY=${{ env.OTP_API_KEY }} | ||
TRANSIFEX_URL=https://www.transifex.com/api/2/project | ||
TRANSIFEX_PROJECT=open-timber-portal | ||
TRANSIFEX_SLUG=open-timber-portal | ||
" > .env | ||
- name: Pull translations from transifex | ||
env: | ||
TRANSIFEX_TOKEN: ${{ secrets.transifex-token }} | ||
run: | | ||
echo 'Pulling the translations…' | ||
TRANSIFEX_API_TOKEN=${{ env.TRANSIFEX_API_TOKEN }} yarn transifex:pull | ||
# - name: Pull translations from transifex | ||
# env: | ||
# TRANSIFEX_TOKEN: ${{ secrets.transifex-token }} | ||
# run: | | ||
# echo 'Pulling the translations…' | ||
# TRANSIFEX_API_TOKEN=${{ env.TRANSIFEX_API_TOKEN }} yarn transifex:pull | ||
|
||
- name: Run Build | ||
- name: Build Portal | ||
run: yarn build | ||
|
||
- name: Start Portal | ||
run: yarn start & | ||
|
||
- name: Run E2E Tests | ||
working-directory: e2e | ||
run: cypress 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
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
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
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
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