Secrets verification #30
This file contains hidden or 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: API Tests | |
| on: | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - 'api/**' | |
| pull_request: | |
| branches: | |
| - '**' | |
| paths: | |
| - 'api/**' | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| unit-tests: | |
| runs-on: ubuntu-latest | |
| steps: | |
| # Checkout the code | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| # Create .env file with defaults | |
| - name: Set default ENV values | |
| run: | | |
| cp .env.example .env | |
| # Set up Python | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ vars.PYTHON_VERSION }} | |
| cache: 'pip' | |
| cache-dependency-path: | | |
| api/requirements.txt | |
| api/dev-requirements.txt | |
| # Install dependencies | |
| - name: Install dependencies | |
| run: | | |
| cd api | |
| pip install --upgrade pip | |
| pip install -r requirements.txt | |
| pip install -r dev-requirements.txt | |
| # Run Tests | |
| - name: Run Unit Tests | |
| run: | | |
| cd api | |
| pytest -m unit --cov-report=lcov | |
| - name: Upload coverage to Coveralls | |
| uses: coverallsapp/github-action@v2 | |
| with: | |
| file: api/coverage.lcov | |
| flag-name: api-unittests | |
| base-path: ./api | |
| - name: Upload test logs on failure | |
| if: failure() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: api-unit-test-logs | |
| path: api/testing-out/ | |
| integration-tests: | |
| runs-on: ubuntu-latest | |
| env: | |
| TESTCONTAINERS_RYUK_DISABLED: "true" | |
| steps: | |
| # Install docker | |
| - name: Set up Docker | |
| uses: docker/setup-docker-action@v4 | |
| # Checkout the code | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| # Set up Python | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ vars.PYTHON_VERSION }} | |
| cache: 'pip' | |
| cache-dependency-path: | | |
| api/requirements.txt | |
| api/dev-requirements.txt | |
| # Install dependencies | |
| - name: Install dependencies | |
| run: | | |
| cd api | |
| pip install --upgrade pip | |
| pip install -r requirements.txt | |
| pip install -r dev-requirements.txt | |
| # Run Tests | |
| - name: Run Integration Tests | |
| run: | | |
| cd api | |
| pytest -m "integration and not deploy" --no-cov | |
| - name: Upload test logs on failure | |
| if: failure() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: api-integration-test-logs | |
| path: api/testing-out/ | |
| aws-tests: | |
| needs: [unit-tests, integration-tests] # Prevent wasteful test deployments | |
| uses: ./.github/workflows/reusable_provider_test.yml | |
| with: | |
| provider: aws | |
| secrets: | |
| AWS_ACCESS_KEY: ${{ secrets.INTEGRATION_TEST_AWS_ACCESS_KEY }} | |
| AWS_SECRET_KEY: ${{ secrets.INTEGRATION_TEST_AWS_SECRET_KEY }} |