Simplify homepage message by removing redundant text #280
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: Deploy Rays Dashboard Staging | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- dev | |
jobs: | |
changes: | |
name: Check for rays dashboard changes | |
runs-on: ubuntu-latest | |
if: ${{ github.event_name == 'push' }} | |
permissions: | |
pull-requests: read | |
outputs: | |
build-rays-dashboard: ${{ steps.filter.outputs.build-rays-dashboard }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dorny/paths-filter@v3 | |
id: filter | |
with: | |
filters: | | |
build-rays-dashboard: | |
- 'apps/rays-dashboard/**' | |
- 'packages/app-db/**' | |
- 'packages/app-types/**' | |
- 'packages/app-ui/**' | |
- 'packages/app-icons/**' | |
build: | |
name: Build and deploy Rays Dashboard | |
runs-on: ubuntu-latest | |
environment: staging | |
needs: changes | |
if: ${{ needs.changes.outputs.build-rays-dashboard == 'true' }} | |
env: | |
AWS_REGION: eu-central-1 | |
ENVIRONMENT_TAG: staging | |
SERVICE_NAME: summer-fi-rays-staging | |
CLUSTER_NAME: summer-fi-rays-staging | |
CONFIG_URL: ${{ secrets.CONFIG_URL }} | |
CONFIG_URL_RAYS: ${{ secrets.CONFIG_URL_RAYS }} | |
FUNCTIONS_API_URL: ${{ secrets.FUNCTIONS_API_URL }} | |
BORROW_DB_READ_CONNECTION_STRING: ${{ secrets.BORROW_DB_READ_CONNECTION_STRING }} | |
CONTENTFUL_ACCESS_TOKEN: ${{ secrets.CONTENTFUL_ACCESS_TOKEN }} | |
CONTENTFUL_PREVIEW_ACCESS_TOKEN: ${{ secrets.CONTENTFUL_PREVIEW_ACCESS_TOKEN }} | |
CONTENTFUL_SPACE_ID: ${{ secrets.CONTENTFUL_SPACE_ID }} | |
MIXPANEL_KEY: ${{ secrets.MIXPANEL_KEY }} | |
NEXT_PUBLIC_MIXPANEL_KEY: ${{ secrets.NEXT_PUBLIC_MIXPANEL_KEY }} | |
SUBGRAPH_BASE: ${{ secrets.SUBGRAPH_BASE }} | |
SDK_API_URL: ${{ secrets.SDK_API_URL }} | |
NEXT_TELEMETRY_DISABLED: ${{ secrets.NEXT_TELEMETRY_DISABLED }} | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 2 | |
- name: Set up turbo cache | |
uses: rharkor/caching-for-turbo@v1.5 | |
- uses: pnpm/action-setup@v2.0.1 | |
with: | |
version: 8.14.1 | |
- name: Setup Node.js environment | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 20 | |
cache: 'pnpm' | |
- name: Setup Rays Dashboard App Next.js Cache | |
uses: actions/cache@v4 | |
with: | |
path: ${{ github.workspace }}/apps/rays-dashboard/.next/cache | |
key: | |
${{ runner.os }}-rays-dashboard-app-${{ hashFiles('pnpm-lock.yaml') }}-${{ | |
hashFiles('apps/rays-dashboard/**/*.ts', 'apps/rays-dashboard/**/*.tsx') }} | |
restore-keys: ${{ runner.os }}-rays-dashboard-app-${{ hashFiles('pnpm-lock.yaml') }}- | |
- name: Establish VPN connection | |
run: | | |
sudo apt update | |
sudo apt install -y openvpn openvpn-systemd-resolved | |
echo 'Configuring the VPN...' | |
echo "${{ secrets.VPN_CONFIG }}" > vpn-config.ovpn | |
echo "${{ secrets.VPN_USERNAME }}" > vpn-credentials.txt | |
echo "${{ secrets.VPN_PASSWORD }}" >> vpn-credentials.txt | |
echo 'Connecting to the VPN...' | |
sudo openvpn --config vpn-config.ovpn --auth-user-pass vpn-credentials.txt --daemon | |
sleep 5 | |
- name: Check VPN connection | |
env: | |
BORROW_DB_READ_DB: ${{ secrets.BORROW_DB_READ_DB }} | |
BORROW_DB_READ_HOST: ${{ secrets.BORROW_DB_READ_HOST }} | |
BORROW_DB_READ_USER: ${{ secrets.BORROW_DB_READ_USER }} | |
BORROW_DB_READ_PASSWORD: ${{ secrets.BORROW_DB_READ_PASSWORD }} | |
PGCONNECT_TIMEOUT: 5 | |
run: | | |
echo 'Checking the VPN connection...' | |
sudo systemctl start postgresql.service | |
PGPASSWORD=$BORROW_DB_READ_PASSWORD /usr/bin/psql -d $BORROW_DB_READ_DB -U $BORROW_DB_READ_USER -h $BORROW_DB_READ_HOST -c 'SELECT 1;' > /dev/null | |
STATUS_CODE=$? | |
if ! [[ "$STATUS_CODE" = 0 ]]; then | |
echo 'VPN connection failed' | |
exit 1 | |
fi | |
echo 'VPN connected!' | |
- name: Extract commit hash | |
id: vars | |
shell: bash | |
run: | | |
echo "::set-output name=sha_short::$(git rev-parse --short HEAD)" | |
- name: Install dependencies | |
run: pnpm install | |
- name: Prebuild | |
run: pnpm prebuild | |
- name: Build | |
run: pnpm build-rays-frontend | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v2 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_STAGING }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_STAGING }} | |
aws-region: ${{ env.AWS_REGION }} | |
- name: Login to Amazon ECR | |
id: login-ecr | |
uses: aws-actions/amazon-ecr-login@v1 | |
- name: Build docker image, copy build output and push to ECR | |
id: build-image | |
env: | |
LATEST_TAG: latest | |
ECR_REPO_NAME: summer-fi-rays-staging | |
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} | |
SHA_TAG: ${{ steps.vars.outputs.sha_short }} | |
run: | | |
# Build a docker container and | |
# push it to ECR so that it can | |
# be deployed to ECS. | |
docker build -f apps/rays-dashboard/docker/Dockerfile \ | |
--build-arg BORROW_DB_READ_CONNECTION_STRING=${{ secrets.BORROW_DB_READ_CONNECTION_STRING }} \ | |
--build-arg CONTENTFUL_SPACE_ID=${{ secrets.CONTENTFUL_SPACE_ID }} \ | |
--build-arg CONTENTFUL_ACCESS_TOKEN=${{ secrets.CONTENTFUL_ACCESS_TOKEN }} \ | |
--build-arg CONTENTFUL_PREVIEW_ACCESS_TOKEN=${{ secrets.CONTENTFUL_PREVIEW_ACCESS_TOKEN }} \ | |
--build-arg CONFIG_URL=${{ secrets.CONFIG_URL }} \ | |
--build-arg CONFIG_URL_RAYS=${{ secrets.CONFIG_URL_RAYS }} \ | |
--build-arg FUNCTIONS_API_URL=${{ secrets.FUNCTIONS_API_URL }} \ | |
--build-arg MIXPANEL_KEY=${{ secrets.MIXPANEL_KEY }} \ | |
--build-arg NEXT_PUBLIC_MIXPANEL_KEY=${{ secrets.NEXT_PUBLIC_MIXPANEL_KEY }} \ | |
--build-arg NEXT_TELEMETRY_DISABLED=${{ secrets.NEXT_TELEMETRY_DISABLED }} \ | |
--cache-from=$ECR_REGISTRY/$ECR_REPO_NAME:$LATEST_TAG \ | |
-t $ECR_REGISTRY/$ECR_REPO_NAME:$SHA_TAG \ | |
-t $ECR_REGISTRY/$ECR_REPO_NAME:$LATEST_TAG \ | |
-t $ECR_REGISTRY/$ECR_REPO_NAME:$ENVIRONMENT_TAG \ | |
./apps/rays-dashboard | |
docker push $ECR_REGISTRY/$ECR_REPO_NAME --all-tags | |
- name: Update ECS service with latest Docker image | |
id: service-update | |
run: | | |
aws ecs update-service --cluster $CLUSTER_NAME --service ${{ env.SERVICE_NAME }} --force-new-deployment --region $AWS_REGION | |
- name: Wait for all services to become stable | |
uses: oryanmoshe/ecs-wait-action@v1.3 | |
with: | |
ecs-cluster: ${{ env.CLUSTER_NAME }} | |
ecs-services: '["${{ env.SERVICE_NAME }}"]' | |
- name: Invalidate CloudFront | |
env: | |
CF_DIST_ID: ${{ secrets.CF_DIST_ID }} | |
run: | | |
AWS_MAX_ATTEMPTS=10 aws cloudfront create-invalidation --distribution-id ${{ env.CF_DIST_ID }} --paths "/*" | |
- name: Trigger e2e tests in e2e-tests repository | |
env: | |
E2E_TESTS_PAT: ${{ secrets.E2E_TESTS_PAT }} | |
run: | | |
curl -L \ | |
-X POST \ | |
-H "Accept: application/vnd.github+json" \ | |
-H "Authorization: Bearer ${{ env.E2E_TESTS_PAT }}" \ | |
-H "X-GitHub-Api-Version: 2022-11-28" \ | |
https://api.github.com/repos/OasisDEX/e2e-tests/actions/workflows/ci_e2e_tests.yml/dispatches \ | |
-d "{\"ref\":\"main\", \"inputs\":{\"run_id\":\"${{ github.run_id }}\", \"repository\":\"${{ github.repository }}\"}}" | |
echo 'See test results in https://github.com/OasisDEX/e2e-tests/actions/workflows/ci_e2e_tests.yml --> Job with RUN_ID ${{ github.run_id }} in the logs.' |