Skip to content

cleanup

cleanup #1318

Workflow file for this run

name: Deploy Test
on:
push:
branches: [develop]
jobs:
test:
timeout-minutes: 60
runs-on: ubuntu-latest
services:
postgres:
image: postgres:11.6
env:
POSTGRES_USER: postgres
POSTGRES_DB: noharm
ports:
- 5432:5432
steps:
- name: Checkout backend
run: |
git clone --single-branch --branch develop https://github.com/noharm-ai/backend .
- uses: actions/setup-python@v5
with:
python-version: 3.9
- name: Setup Python
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Setup PostgreSQL
run: |
git clone https://github.com/noharm-ai/database
psql -h localhost -U postgres -d noharm -a -f database/noharm-public.sql -v ON_ERROR_STOP=1
psql -h localhost -U postgres -d noharm -a -f database/noharm-create.sql -v ON_ERROR_STOP=1
psql -h localhost -U postgres -d noharm -a -f database/noharm-newuser.sql -v ON_ERROR_STOP=1
psql -h localhost -U postgres -d noharm -a -f database/noharm-triggers.sql -v ON_ERROR_STOP=1
psql -h localhost -U postgres -d noharm -a -f database/noharm-insert.sql -v ON_ERROR_STOP=1
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: sa-east-1
- name: Run Backend
run: |
python mobile.py &
sleep 10
env:
MAIL_HOST: http://localhost:3000
CACHE_BUCKET_NAME: ${{ secrets.CACHE_BUCKET_NAME }}
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: lts/*
- name: Install dependencies
run: npm ci
- name: Install Playwright Browsers
run: sudo apt-get update && npx playwright install --with-deps
- name: Run Playwright tests
run: npx playwright test
env:
VITE_APP_API_URL: http://localhost:5000
VITE_APP_SITE_TITLE: ${{ secrets.REACT_APP_SITE_TITLE_TEST }}
VITE_APP_API_KEY: ${{ secrets.REACT_APP_API_KEY }}
VITE_APP_SUPPORT_EMAIL: ${{ secrets.REACT_APP_SUPPORT_EMAIL }}
VITE_APP_SUPPORT_LINK: ${{ secrets.REACT_APP_SUPPORT_LINK }}
VITE_APP_ODOO_LINK: ${{ secrets.REACT_APP_ODOO_LINK }}
VITE_APP_VERSION: ${{ steps.package-version.outputs.current-version}}
VITE_APP_URL: http://localhost:3000
TEST_USER: [email protected]
TEST_USER_PASSWORD: e2etest
- uses: actions/upload-artifact@v4
if: always()
with:
name: playwright-report
path: playwright-report/
retention-days: 30
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
- name: get-npm-version
id: package-version
uses: martinbeentjes/[email protected]
- name: npm ci
run: npm ci
- name: lint
run: npm run lint
- name: npm run build
run: npm run build
env:
VITE_APP_API_URL: ${{ secrets.REACT_APP_API_URL_TEST }}
VITE_APP_SITE_TITLE: ${{ secrets.REACT_APP_SITE_TITLE_TEST }}
VITE_APP_UPDOWN_LINK: ${{ secrets.REACT_APP_UPDOWN_LINK }}
VITE_APP_PRISMIC_API_URL: ${{ secrets.REACT_APP_PRISMIC_API_URL }}
VITE_APP_PRISMIC_TOKEN: ${{ secrets.REACT_APP_PRISMIC_TOKEN }}
VITE_APP_API_KEY: ${{ secrets.REACT_APP_API_KEY }}
VITE_APP_SUPPORT_EMAIL: ${{ secrets.REACT_APP_SUPPORT_EMAIL }}
VITE_APP_SUPPORT_LINK: ${{ secrets.REACT_APP_SUPPORT_LINK }}
VITE_APP_ODOO_LINK: ${{ secrets.REACT_APP_ODOO_LINK }}
VITE_APP_URL: ${{ secrets.REACT_APP_URL_TEST }}
VITE_APP_VERSION: ${{ steps.package-version.outputs.current-version}}
- name: Deploy Test to AWS
uses: jakejarvis/s3-sync-action@master
with:
args: --acl public-read --delete --exclude '.*' --exclude 'node_modules/*'
env:
AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET_TEST }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
SOURCE_DIR: "dist"
- name: Set cache-control on index.html
uses: prewk/s3-cp-action@v2
with:
aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
source: "s3://${{ secrets.AWS_S3_BUCKET_TEST }}/index.html"
dest: "s3://${{ secrets.AWS_S3_BUCKET_TEST }}/index.html"
flags: --metadata-directive REPLACE --cache-control max-age=0,no-cache,no-store,must-revalidate --content-type text/html --acl public-read