on: workflow_call: inputs: artifact: required: true type: string version: required: true type: string jobs: test: name: Test with coverage runs-on: ubuntu-latest steps: - name: Download image artifact uses: actions/download-artifact@v5 with: name: ${{ inputs.artifact }} - name: Load image from archive run: docker load -i ${{ inputs.artifact }}.tar # Needed for the Docker Compose file. - name: Checkout code uses: actions/checkout@v5 # Memory limit tests would fail if this isn't disabled. - name: Disable swap memory run: sudo swapoff -a # Run tests with coverage within the container. # Suffix the generated coverage datafile with the name of the runner's OS. - name: Run tests id: run_tests run: | export IMAGE_SUFFIX='-venv:${{ inputs.version }}' docker compose run \ --rm -T -e COVERAGE_DATAFILE=.coverage \ --entrypoint coverage \ snekbox \ run -m unittest # Upload it so the coverage from all matrix jobs can be combined later. - name: Upload coverage data uses: actions/upload-artifact@v4 with: name: coverage path: .coverage retention-days: 1 include-hidden-files: true report: name: Report coverage runs-on: ubuntu-latest needs: test steps: - name: Checkout code uses: actions/checkout@v5 - name: Set up Python uses: actions/setup-python@v6 with: python-version: "3.11" cache: pip cache-dependency-path: requirements/coverage.pip - name: Install dependencies run: pip install -U -r requirements/coverage.pip - name: Download coverage data uses: actions/download-artifact@v5 with: pattern: coverage merge-multiple: true - name: Display coverage report run: coverage report -m - name: Generate lcov report run: coverage lcov # Comment on the PR with the coverage results and register a GitHub check # which links to the coveralls.io job. - name: Publish coverage report to coveralls.io uses: coverallsapp/github-action@v2.3.6 with: github-token: ${{ secrets.GITHUB_TOKEN }} format: lcov dry-run-deploy: name: Dry run deployment.yaml init container runs-on: ubuntu-latest needs: test steps: - name: Download image artifact uses: actions/download-artifact@v5 with: name: ${{ inputs.artifact }} - name: Load image from archive run: docker load -i ${{ inputs.artifact }}.tar # Needed for the Docker Compose file. - name: Checkout code uses: actions/checkout@v5 # Install eval deps the same way as init container from deployment.yaml # This is to ensure that deployment won't fail at that step - name: Install eval deps run: | export IMAGE_SUFFIX='-venv:${{ inputs.version }}' docker compose run --rm -T --entrypoint /bin/bash snekbox scripts/install_eval_deps.sh