ci [N/A] #274
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: ci | |
| run-name: ci [${{ inputs.uuid && inputs.uuid || 'N/A' }}] | |
| on: | |
| push: | |
| workflow_dispatch: | |
| inputs: | |
| uuid: | |
| description: 'Unique ID' | |
| required: false | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Define global variables | |
| id: global_variables | |
| run: | | |
| echo "BRANCH_NAME=${{ github.head_ref || github.ref_name }}" >> "$GITHUB_OUTPUT" | |
| echo "CONTAINER_ID=${{ github.run_id }}" >> "$GITHUB_OUTPUT" | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Build Api - fedora | |
| env: | |
| CONTAINER_ID: ${{ steps.global_variables.outputs.CONTAINER_ID }} | |
| uses: docker/build-push-action@v6 | |
| with: | |
| build-args: | | |
| ADMIN_PASSWORD=dummy_password | |
| API_PORT=5005 | |
| context: . | |
| file: Containerfile-api-fedora | |
| push: false | |
| no-cache: true | |
| tags: basil-api_${{ env.CONTAINER_ID }} | |
| outputs: type=docker,dest=/tmp/basil-api_${{ env.CONTAINER_ID }}.tar | |
| - name: Build Api - debian | |
| env: | |
| CONTAINER_ID: ${{ steps.global_variables.outputs.CONTAINER_ID }} | |
| uses: docker/build-push-action@v6 | |
| with: | |
| build-args: | | |
| ADMIN_PASSWORD=dummy_password | |
| API_PORT=5005 | |
| context: . | |
| file: Containerfile-api-debian | |
| push: false | |
| no-cache: true | |
| tags: basil-api-debian_${{ env.CONTAINER_ID }} | |
| - name: Build App | |
| env: | |
| CONTAINER_ID: ${{ steps.global_variables.outputs.CONTAINER_ID }} | |
| uses: docker/build-push-action@v6 | |
| with: | |
| build-args: | | |
| API_ENDPOINT=http://localhost:5005 | |
| APP_PORT=9056 | |
| context: . | |
| file: Containerfile-app | |
| push: false | |
| no-cache: true | |
| tags: basil-app_${{ env.CONTAINER_ID }} | |
| outputs: type=docker,dest=/tmp/basil-app_${{ env.CONTAINER_ID }}.tar | |
| - name: Upload basil-api artifact | |
| env: | |
| CONTAINER_ID: ${{ steps.global_variables.outputs.CONTAINER_ID }} | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: basil-api | |
| path: /tmp/basil-api_${{ env.CONTAINER_ID }}.tar | |
| - name: Upload basil-app artifact | |
| env: | |
| CONTAINER_ID: ${{ steps.global_variables.outputs.CONTAINER_ID }} | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: basil-app | |
| path: /tmp/basil-app_${{ env.CONTAINER_ID }}.tar | |
| test: | |
| runs-on: ubuntu-latest | |
| needs: build | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Define global variables | |
| id: global_variables | |
| run: | | |
| echo "BRANCH_NAME=${{ github.head_ref || github.ref_name }}" >> "$GITHUB_OUTPUT" | |
| echo "CONTAINER_ID=${{ github.run_id }}" >> "$GITHUB_OUTPUT" | |
| TEMPDIR=$(mktemp -d) | |
| echo "TEST_RUNS_BASE_DIR=$TEMPDIR" >> $GITHUB_ENV | |
| - name: Install python3 | |
| uses: actions/setup-python@v2 | |
| with: | |
| python-version: '3.9' | |
| - name: Install python dependencies | |
| run: | | |
| python -m venv venv | |
| source venv/bin/activate | |
| pip install --upgrade pip | |
| pip install -r requirements.txt | |
| - name: API unit testing | |
| run: | | |
| source venv/bin/activate | |
| pytest -v ./api/test --cov=api --cov-branch --cov-report=term --cov-report=html | |
| - name: Create tarball of coverage report | |
| run: | | |
| tar -czf api-htmlcov.tar.gz htmlcov | |
| - name: Upload coverage report artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: api-coverage-html-report | |
| path: api-htmlcov.tar.gz | |
| - name: Download basil-api artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: basil-api | |
| path: /tmp | |
| - name: Download basil-app artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: basil-app | |
| path: /tmp | |
| - name: Load images | |
| env: | |
| CONTAINER_ID: ${{ steps.global_variables.outputs.CONTAINER_ID }} | |
| run: | | |
| docker load --input /tmp/basil-api_${{ env.CONTAINER_ID }}.tar | |
| docker load --input /tmp/basil-app_${{ env.CONTAINER_ID }}.tar | |
| docker image ls -a | |
| docker run -d --network=host basil-api_${{ env.CONTAINER_ID }} | |
| docker run -d --network=host basil-app_${{ env.CONTAINER_ID }} | |
| sleep 60 | |
| docker ps | |
| echo "Test Api is running" | |
| curl -vf http://localhost:5005/version | |
| echo "Test App is running" | |
| curl -vf http://localhost:9056 | |
| - name: Cypress E2E Testing | |
| uses: cypress-io/github-action@v6 | |
| with: | |
| browser: chrome | |
| working-directory: ./app | |
| spec: 'cypress/**/*.cy.js' | |
| env: | |
| LIBGL_ALWAYS_SOFTWARE: 1 | |
| - name: Upload Cypress screenshots | |
| uses: actions/upload-artifact@v4 | |
| if: failure() | |
| with: | |
| name: cypress-screenshots | |
| path: | | |
| app/cypress/screenshots | |
| api/user-files | |
| retention-days: 7 |