diff --git a/.env.example b/.env.example index 6957df0..d1cfe3a 100644 --- a/.env.example +++ b/.env.example @@ -17,4 +17,6 @@ REDIS_PORT=6379 REDIS_PASSWORD= SMTP_HOST= SMTP_PORT= -RESEND_API_KEY= \ No newline at end of file +RESEND_API_KEY= +OPENSEARCH_HOST=http://localhost +OPENSEARCH_CORE=tethys-records \ No newline at end of file diff --git a/.gitea/workflows/checkReferenceType.yaml b/.gitea/workflows/checkReferenceType.yaml index 2e0d1c1..ab88380 100644 --- a/.gitea/workflows/checkReferenceType.yaml +++ b/.gitea/workflows/checkReferenceType.yaml @@ -1,24 +1,78 @@ +# This is a Gitea Actions workflow configuration file for running CI tests on the `feat/checkReferenceType` branch. +# The workflow is named "CI" and runs on the latest Ubuntu environment using a Node.js 20 Docker container. +# It sets up a PostgreSQL service with specified environment variables and health checks. +# The workflow includes the following steps: +# 1. Checkout the repository using the actions/checkout@v3 action. +# 2. Install Node.js dependencies using `npm ci`. +# 3. Create a `.env.test` file by copying from `.env.example`. +# 4. Set up environment variables in the `.env.test` file, including database connection details and other app-specific settings. +# 5. Run functional tests using the `node ace test functional --groups "ReferenceValidation"` command. name: CI -run-name: ${{ github.actor }} is testing out Gitea Actions +run-name: Running tests for checkReferenceType branch on: - push: - branches: - - feat/checkReferenceType + push: + branches: + - feat/checkReferenceType jobs: - test: - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v2 + container-job: + runs-on: ubuntu-latest + # Docker Hub image that `container-job` executes in + container: node:20-bullseye - - name: Set up Node.js - uses: actions/setup-node@v2 - with: - node-version: '20' + services: + # Label used to access the service container + postgres: + image: postgres:latest + env: + POSTGRES_USER: alice + POSTGRES_PASSWORD: ${{ secrets.POSTGRES_PASSWORD }} + POSTGRES_DB: tethys_dev + # ports: + # - 5432:5432 + options: | + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 - - name: Install dependencies - run: npm install + steps: + - name: Checkout repository + uses: actions/checkout@v3 - - name: Run tests - run: node ace test functional --groups "ReferenceValidation" \ No newline at end of file + # - name: Set up Node.js + # uses: actions/setup-node@v2 + # with: + # node-version: '20' + + - name: Install dependencies + run: npm ci + + - name: Create .env.test file + run: cp .env.example .env.test + + - name: Set up environment variables + run: | + echo "DB_CONNECTION=pg" >> .env.test + echo "PG_HOST=postgres" >> .env.test + echo "PG_PORT=5432" >> .env.test + echo "PG_USER=alice" >> .env.test + echo "PG_PASSWORD=${{ secrets.POSTGRES_PASSWORD }}" >> .env.test + echo "PG_DB_NAME=tethys_dev" >> .env.test + echo "NODE_ENV=test" >> .env.test + echo "ASSETS_DRIVER=fake" >> .env.test + echo "SESSION_DRIVER=memory" >> .env.test + echo "HASH_DRIVER=bcrypt" >> .env.test + echo "HOST=127.0.0.1" >> .env.test + echo "PORT=3333" >> .env.test + echo "APP_NAME=TethysCloud" >> .env.test + echo "APP_URL=http://${HOST}:${PORT}" >> .env.test + echo "CACHE_VIEWS=false" >> .env.test + echo "APP_KEY=pfi5N2ACN4tMJ5d8d8BPHfh3FEuvleej" >> .env.test + echo "DRIVE_DISK=local" >> .env.test + echo "OAI_LIST_SIZE=200" >> .env.test + echo "OPENSEARCH_HOST=${{ secrets.OPENSEARCH_HOST }}" >> .env.test + echo "OPENSEARCH_CORE=tethys-records" >> .env.test + + - name: Run tests + run: node ace test functional --groups "ReferenceValidation"