Update e2e_tests.yaml #5528
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: Diffgram Testing Workflow | |
on: | |
push: | |
branches: | |
- 'main' | |
- 'master' | |
- 'releases/**' | |
- 'fix/**' | |
pull_request_target: | |
types: [synchronize] | |
branches: | |
- '**' | |
pull_request: | |
types: [opened, synchronize, ready_for_review] | |
jobs: | |
Default-Service-Unit-Tests: | |
runs-on: ubuntu-20.04 | |
# Service containers to run with `container-job` test | |
container: | |
image: python:3.11.1-bullseye | |
options: --user root | |
env: | |
NODE_ENV: development | |
DATABASE_URL: postgresql+psycopg2://postgres:postgres@postgres/diffgram_unit_tests?sslmode=disable | |
UNIT_TESTING_DATABASE_URL: postgresql+psycopg2://postgres:postgres@postgres/diffgram_unit_tests?sslmode=disable | |
PYTHONPATH: /__w/diffgram/default | |
DIFFGRAM_SYSTEM_MODE: testing | |
GOOGLE_APPLICATION_CREDENTIALS: /gcp/gcloud-service-key.json | |
DIFFGRAM_STATIC_STORAGE_PROVIDER: gcp | |
GOOGLE_PROJECT_NAME: ${{ secrets.GOOGLE_PROJECT_NAME }} | |
DIFFGRAM_HOST_OS: ${{ secrets.DIFFGRAM_HOST_OS }} | |
DIFFGRAM_VERSION_TAG: ${{ secrets.DIFFGRAM_VERSION_TAG }} | |
DIFFGRAM_INSTALL_FINGERPRINT: ${{ secrets.DIFFGRAM_INSTALL_FINGERPRINT }} | |
CLOUD_STORAGE_BUCKET: ${{ secrets.CLOUD_STORAGE_BUCKET }} | |
ML__CLOUD_STORAGE_BUCKET: ${{ secrets.ML__CLOUD_STORAGE_BUCKET }} | |
SERVICE_ACCOUNT_FULL_PATH: /gcp/gcloud-service-key.json | |
DOCKER_CONTEXT: true | |
services: | |
# Label used to access the service container | |
postgres: | |
# Docker Hub image | |
image: postgres | |
# Provide the password for postgres | |
env: | |
POSTGRES_PASSWORD: postgres | |
# Set health checks to wait until postgres has started | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
steps: | |
- uses: actions/setup-python@v3 | |
with: | |
python-version: '3.11' | |
- run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event." | |
- run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!" | |
- run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}." | |
- uses: mdecoleman/[email protected] | |
if: "github.event.pull_request != null" | |
id: vars | |
with: | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
- run: echo ${{ steps.vars.outputs.branch }} | |
if: "github.event.pull_request != null" | |
- name: Check out repository code | |
if: "github.event.pull_request != null" | |
uses: actions/checkout@v2 | |
with: | |
ref: ${{ steps.vars.outputs.branch }} | |
- name: Check out repository code | |
if: "github.event.pull_request == null" | |
uses: actions/checkout@v2 | |
with: | |
ref: ${{ github.ref_name }} | |
- run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner." | |
- run: cp -rf . /__w/diffgram | |
- run: cd /__w/diffgram | |
- run: pip3 install --upgrade pip | |
- run: pip3 install -r default/requirements.txt | |
- run: pip3 install pytest sqlalchemy-utils | |
- run: mkdir /gcp | |
- run: echo ${{ secrets.GOOGLE_SERVICE_ACCOUNT_ENCODED }} | base64 --decode --ignore-garbage > /gcp/gcloud-service-key.json | |
- run: pytest default/tests --junitxml=test-results/junit.xml | |
- name: Publish Default Service Test Results | |
uses: EnricoMi/publish-unit-test-result-action@v1 | |
if: always() | |
with: | |
files: test-results/**/*.xml | |
Walrus-Service-Unit-Tests: | |
runs-on: ubuntu-20.04 | |
# Service containers to run with `container-job` | |
container: | |
image: ubuntu:22.04 | |
options: --user root | |
env: | |
NODE_ENV: development | |
DATABASE_URL: postgresql+psycopg2://postgres:postgres@postgres/diffgram_unit_tests?sslmode=disable | |
UNIT_TESTING_DATABASE_URL: postgresql+psycopg2://postgres:postgres@postgres/diffgram_unit_tests?sslmode=disable | |
PYTHONPATH: /__w/diffgram/walrus | |
DIFFGRAM_SYSTEM_MODE: testing | |
GOOGLE_APPLICATION_CREDENTIALS: /gcp/gcloud-service-key.json | |
DIFFGRAM_STATIC_STORAGE_PROVIDER: gcp | |
GOOGLE_PROJECT_NAME: ${{ secrets.GOOGLE_PROJECT_NAME }} | |
CLOUD_STORAGE_BUCKET: ${{ secrets.CLOUD_STORAGE_BUCKET }} | |
ML__CLOUD_STORAGE_BUCKET: ${{ secrets.ML__CLOUD_STORAGE_BUCKET }} | |
DIFFGRAM_HOST_OS: ${{ secrets.DIFFGRAM_HOST_OS }} | |
DIFFGRAM_VERSION_TAG: ${{ secrets.DIFFGRAM_VERSION_TAG }} | |
DIFFGRAM_INSTALL_FINGERPRINT: ${{ secrets.DIFFGRAM_INSTALL_FINGERPRINT }} | |
SERVICE_ACCOUNT_FULL_PATH: /gcp/gcloud-service-key.json | |
CRYPTOGRAPHY_DONT_BUILD_RUST: 1 | |
services: | |
# Label used to access the service container | |
postgres: | |
# Docker Hub image | |
image: postgres | |
# Provide the password for postgres | |
env: | |
POSTGRES_PASSWORD: postgres | |
# Set health checks to wait until postgres has started | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
steps: | |
- uses: actions/setup-python@v3 | |
with: | |
python-version: '3.11' | |
- run: apt-get update --allow-insecure-repositories && apt-get install -y git libffi-dev ffmpeg python3.11 python3-pip libpq-dev python3.11-venv python3.11-distutils python3.11-dev git python3-setuptools libgdal-dev python3-lxml libxslt-dev | |
- run: pip3 install --upgrade pip | |
- run: rm -rf /tmp | |
- run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event." | |
- run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!" | |
- run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}." | |
- uses: mdecoleman/[email protected] | |
if: "github.event.pull_request != null" | |
id: vars | |
with: | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
- run: echo ${{ steps.vars.outputs.branch }} | |
if: "github.event.pull_request != null" | |
- name: Check out repository code | |
if: "github.event.pull_request != null" | |
uses: actions/checkout@v2 | |
with: | |
ref: ${{ steps.vars.outputs.branch }} | |
- name: Check out repository code | |
if: "github.event.pull_request == null" | |
uses: actions/checkout@v2 | |
with: | |
ref: ${{ github.ref_name }} | |
- run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner." | |
- run: pwd | |
- run: cp -rf . /__w/diffgram | |
- run: cd /__w/diffgram | |
- run: cd walrus | |
- run: pip install -r walrus/requirements.txt | |
- run: pip install pytest sqlalchemy-utils | |
- run: mkdir /gcp | |
- run: echo ${{ secrets.GOOGLE_SERVICE_ACCOUNT_ENCODED }} | base64 --decode --ignore-garbage > /gcp/gcloud-service-key.json | |
- run: pytest walrus/tests --junitxml=test-results/junit.xml | |
- name: Publish Walrus Service Results | |
uses: EnricoMi/publish-unit-test-result-action@v1 | |
if: always() | |
with: | |
files: test-results/**/*.xml | |
Frontend-Unit-Tests: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: "18" | |
- run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event." | |
- run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!" | |
- run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}." | |
- uses: mdecoleman/[email protected] | |
if: "github.event.pull_request != null" | |
id: vars | |
with: | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
- run: echo ${{ steps.vars.outputs.branch }} | |
if: "github.event.pull_request != null" | |
- name: Check out repository code | |
if: "github.event.pull_request != null" | |
uses: actions/checkout@v2 | |
with: | |
ref: ${{ steps.vars.outputs.branch }} | |
- name: Check out repository code | |
if: "github.event.pull_request == null" | |
uses: actions/checkout@v2 | |
with: | |
ref: ${{ github.ref_name }} | |
- run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner." | |
- run: cd frontend | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: "18" | |
- run: yarn --cwd frontend install | |
- run: yarn --cwd frontend run test:unit |