Skip to content

ci: remove unnecessary tests and glific mocks #1

ci: remove unnecessary tests and glific mocks

ci: remove unnecessary tests and glific mocks #1

Workflow file for this run

name: E2E Slow Filesearch
on:
pull_request:
branches: [main]
types: [labeled]
jobs:
glific-filesearch-slow:
if: ${{ github.event.label.name == 'e2e-slow' }}
runs-on: ubuntu-latest
services:
postgres:
image: postgres:14
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: glific_dev
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- name: Setup cypress-testing
uses: actions/checkout@v6
- name: Use latest Node.js
uses: actions/setup-node@v6
- name: Setup elixir
uses: erlef/setup-beam@v1
with:
elixir-version: 1.18.3-otp-27
otp-version: 27.3.3
- name: Download ngrok
run: |
wget -q -O ngrok.zip https://bin.equinox.io/c/bNyj1mQVY4c/ngrok-v3-stable-linux-amd64.zip
unzip -o ngrok.zip
chmod +x ngrok
sudo mv ngrok /usr/local/bin/
- name: Start ngrok tunnel
run: |
ngrok config add-authtoken "${{ secrets.NGROK_AUTHTOKEN }}"
nohup ngrok http 4000 --pooling-enabled --host-header=glific.test:4000 --log=stdout > ngrok.log 2>&1 &
sleep 5
tail ngrok.log
- name: Set GLIFIC_API_HOST_OVERRIDE env
run: |
NGROK_API_URL="http://127.0.0.1:4040/api/tunnels"
count=0
until curl -s "${NGROK_API_URL}" | grep -q '"public_url"' || [ $count -eq 10 ]; do
echo "ngrok public_url not ready"
sleep 2
count=$((count+1))
done
API_URL=$(curl -s ${NGROK_API_URL} | jq -r '.tunnels[] | select(.proto=="https") | .public_url')
if [ -z "$API_URL" ]; then
API_URL=$(curl -s ${NGROK_API_URL} | jq -r '.tunnels[] | select(.proto=="http") | .public_url')
fi
echo "ngrok tunnels"
curl -s http://127.0.0.1:4040/api/tunnels
echo "api_url=$API_URL"
echo "GLIFIC_API_HOST_OVERRIDE=${API_URL}" >> $GITHUB_ENV
- name: Setup backend
env:
KAAPI_API_KEY: ${{ secrets.KAAPI_API_KEY }}
run: |
echo '127.0.0.1 glific.test' | sudo tee -a /etc/hosts
echo '127.0.0.1 postgres' | sudo tee -a /etc/hosts
echo '127.0.0.1 api.glific.test' | sudo tee -a /etc/hosts
mkdir project
cd project
echo clone glific repo
git clone --branch rvignesh/seed-dev-kaapi https://github.com/glific/glific.git
echo done. go to dir.
cd glific
echo done. start dev.secret.exs config
cd priv
mkdir cert
cd cert
echo "${{ secrets.TEST_CERTIFICATE }}" > glific.test+1.pem
echo "${{ secrets.TEST_CERTIFICATE_KEY }}" > glific.test+1-key.pem
cd ../../
cd config
cp dev.secret.exs.txt dev.secret.exs
cp .env.dev.txt .env.dev
sed -i 's/:max_rate_limit_request, 60/:max_rate_limit_request, 300/g' config.exs
echo copy done. start setup
cd ../
echo install mix dependencies if not Cached
mix local.rebar --force
mix local.hex --force
mix hex.repo add oban https://getoban.pro/repo --fetch-public-key ${{ secrets.OBAN_PUBLIC_KEY }} --auth-key ${{ secrets.OBAN_PRO_KEY }}
mix deps.get
echo done. start installing inotify-tools
sudo apt-get install inotify-tools
echo start mix setup
ENABLE_DB_SSL=false KAAPI_API_KEY=${KAAPI_API_KEY} mix setup
cd ../../
- name: Setup frontend
run: |
cd project
echo clone glific repo
git clone https://github.com/glific/glific-frontend.git
echo done. go to repo dir.
cd glific-frontend
echo copy env file.
cp .env.example .env
echo done.
cat /proc/sys/fs/inotify/max_user_watches
echo set watchers
sudo sysctl fs.inotify.max_user_watches=524288
sudo sysctl -p
cat /proc/sys/fs/inotify/max_user_watches
echo start yarn setup.
yarn setup
echo done.
cd ../
- name: run glific-frontend
run: |
cd /home/runner/work/cypress-testing/cypress-testing/project/glific-frontend
yarn dev &
- name: run glific
run: |
cd /home/runner/work/cypress-testing/cypress-testing/project/glific
ENABLE_DB_SSL=false OPEN_AI_KEY=${{secrets.OPENAI_KEY}} mix phx.server > phoenix-server.log 2>&1 &
- name: Wait for few minutes for the frontend to start
run: |
sleep 3m
- name: Cypress run (filesearch slow)
run: |
echo Create cypress.config.ts from example
cp cypress.config.ts.example cypress.config.ts
yarn install
yarn run cypress run --spec cypress/e2e/filesearch/Filesearch.spec.ts --record --key ${{ secrets.CYPRESS_DASHBOARD_KEY }}
- name: Upload Phoenix server logs
if: always()
uses: actions/upload-artifact@v4
with:
name: phoenix-server-log-filesearch-slow
path: /home/runner/work/cypress-testing/cypress-testing/project/glific/phoenix-server.log
if-no-files-found: warn
retention-days: 7