From 239c65c58dc0a1740aec7dcb001917865027f6d5 Mon Sep 17 00:00:00 2001 From: Harris Tzovanakis Date: Fri, 26 Jul 2024 10:45:51 +0200 Subject: [PATCH] gh-actions: simplify actions --- .../backoffice-integration-tests.yml | 69 ------------------- .github/workflows/test-backoffice.yml | 55 +++++++++++++-- .github/workflows/test-workflows.yml | 4 +- 3 files changed, 51 insertions(+), 77 deletions(-) delete mode 100644 .github/workflows/backoffice-integration-tests.yml diff --git a/.github/workflows/backoffice-integration-tests.yml b/.github/workflows/backoffice-integration-tests.yml deleted file mode 100644 index a5970d10..00000000 --- a/.github/workflows/backoffice-integration-tests.yml +++ /dev/null @@ -1,69 +0,0 @@ -name: Integration tests - -on: - workflow_call: - inputs: - ref: - description: The reference to test - type: string - required: true - image: - description: The name of the image to test - type: string - required: true - -defaults: - run: - shell: bash - -jobs: - test: - runs-on: ubuntu-latest - services: - opensearch: - image: registry.cern.ch/cern-sis/inspirehep/opensearch - env: - bootstrap.memory_lock: true - ES_JAVA_OPTS: -Xms1024m -Xmx1024m - discovery.type: single-node - DISABLE_SECURITY_PLUGIN: true - ports: - - 9200:9200 - rabbitmq: - image: rabbitmq:3-management - ports: - - 5672:5672 - redis: - image: redis:6 - ports: - - 6379:6379 - db: - image: postgres:14.1 - env: - POSTGRES_DB: inspire - POSTGRES_USER: inspire - POSTGRES_PASSWORD: inspire - ports: - - 5432:5432 - - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - ref: ${{ inputs.ref }} - - name: Test - working-directory: ./backoffice - run: > - docker run - --pull always - --network=host - --entrypoint poetry - --env DJANGO_SETTINGS_MODULE=config.settings.test - --env DISABLE_SECURITY_PLUGIN=true - --env POSTGRES_DB=inspire - --env POSTGRES_USER=inspire - --env POSTGRES_PASSWORD=inspire - --env POSTGRES_HOST=127.0.0.1 - --env OPENSEARCH_HOST=127.0.0.1:9200 - ${{ inputs.image }} - run pytest diff --git a/.github/workflows/test-backoffice.yml b/.github/workflows/test-backoffice.yml index 2a113d2a..716ba1ed 100644 --- a/.github/workflows/test-backoffice.yml +++ b/.github/workflows/test-backoffice.yml @@ -24,9 +24,52 @@ jobs: test: needs: build - strategy: - fail-fast: false - uses: ./.github/workflows/backoffice-integration-tests.yml - with: - ref: ${{ inputs.ref }} - image: "registry.cern.ch/cern-sis/inspire/backoffice@${{ needs.build.outputs.image-id }}" + runs-on: ubuntu-latest + services: + opensearch: + image: registry.cern.ch/cern-sis/inspirehep/opensearch + env: + bootstrap.memory_lock: true + ES_JAVA_OPTS: -Xms1024m -Xmx1024m + discovery.type: single-node + DISABLE_SECURITY_PLUGIN: true + ports: + - 9200:9200 + rabbitmq: + image: rabbitmq:3-management + ports: + - 5672:5672 + redis: + image: redis:6 + ports: + - 6379:6379 + db: + image: postgres:14.1 + env: + POSTGRES_DB: inspire + POSTGRES_USER: inspire + POSTGRES_PASSWORD: inspire + ports: + - 5432:5432 + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + ref: ${{ inputs.ref }} + + - name: Test + working-directory: ./backoffice + run: > + docker run + --pull always + --network=host + --entrypoint poetry + --env DJANGO_SETTINGS_MODULE=config.settings.test + --env DISABLE_SECURITY_PLUGIN=true + --env POSTGRES_DB=inspire + --env POSTGRES_USER=inspire + --env POSTGRES_PASSWORD=inspire + --env POSTGRES_HOST=127.0.0.1 + --env OPENSEARCH_HOST=127.0.0.1:9200 + registry.cern.ch/cern-sis/inspire/backoffice@${{ needs.build.outputs.image-id }} + run pytest diff --git a/.github/workflows/test-workflows.yml b/.github/workflows/test-workflows.yml index fb4efa6b..c0133cd6 100644 --- a/.github/workflows/test-workflows.yml +++ b/.github/workflows/test-workflows.yml @@ -55,8 +55,8 @@ jobs: -v "$(pwd)"/requirements-test.txt:/opt/airflow/requirements-test.txt -v "$(pwd)"/data:/opt/airflow/data -e AIRFLOW__CORE__EXECUTOR=CeleryExecutor - -e AIRFLOW__DATABASE__SQL_ALCHEMY_CONN=postgresql+psycopg2://airflow:airflow@postgres-airflow/airflow - -e AIRFLOW__CELERY__RESULT_BACKEND=db+postgresql://airflow:airflow@postgres-airflow/airflow + -e AIRFLOW__DATABASE__SQL_ALCHEMY_CONN=postgresql+psycopg2://airflow:airflow@postgres/airflow + -e AIRFLOW__CELERY__RESULT_BACKEND=db+postgresql://airflow:airflow@postgres/airflow -e AIRFLOW__CELERY__BROKER_URL=redis://:@redis:6379/0 -e AIRFLOW__CORE__FERNET_KEY="" -e AIRFLOW__CORE__DAGS_ARE_PAUSED_AT_CREATION="true"