Expose JUnit files in CI as an artifact #4
Workflow file for this run
This file contains 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: Run Tests | ||
on: | ||
workflow_call: | ||
inputs: | ||
run_integration: | ||
required: false | ||
type: boolean | ||
default: true | ||
repo: | ||
type: string | ||
required: true | ||
env: | ||
AR_REPO: ${{ inputs.repo }} | ||
jobs: | ||
test: | ||
name: Test | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- name: Cache App | ||
id: cache-app | ||
uses: actions/cache@v4 | ||
env: | ||
cache-name: cache-app | ||
with: | ||
path: | | ||
app.tar | ||
key: ${{ runner.os }}-${{ env.cache-name }}-${{ github.run_id }} | ||
- name: Load built image | ||
run: | | ||
docker load --input app.tar | ||
- name: Install docker compose | ||
run: | | ||
sudo curl -SL https://github.com/docker/compose/releases/download/v2.20.0/docker-compose-linux-x86_64 -o /usr/local/bin/docker-compose | ||
sudo chmod +x /usr/local/bin/docker-compose | ||
- name: Bring test env up | ||
run: | | ||
make test_env.up | ||
- name: Prepare for tests | ||
run: | | ||
make test_env.prepare | ||
make test_env.check_db | ||
- name: Run unit tests | ||
run: | | ||
make test_env.run_unit | ||
- name: Run integration tests | ||
if: ${{ !cancelled() && inputs.run_integration == true }} | ||
run: | | ||
make test_env.run_integration | ||
- uses: actions/upload-artifact@v4 | ||
if: ${{ !cancelled() }} | ||
with: | ||
name: junitfiles | ||
path: *junit* | ||
## Don't upload on forks for now. | ||
- name: upload using codecovcli | ||
if: ${{ !cancelled() && !github.event.pull_request.head.repo.fork && github.repository_owner == 'codecov' }} | ||
run: | | ||
make test_env.upload CODECOV_UPLOAD_TOKEN=${{ secrets.CODECOV_ORG_TOKEN }} CODECOV_URL=${{ secrets.CODECOV_URL }} | ||
- name: upload using codecovcli staging | ||
if: ${{ !cancelled() && !github.event.pull_request.head.repo.fork && github.repository_owner == 'codecov' }} | ||
run: | | ||
make test_env.upload CODECOV_UPLOAD_TOKEN=${{ secrets.CODECOV_ORG_TOKEN_STAGING }} CODECOV_URL=${{ secrets.CODECOV_STAGING_URL }} | ||
- name: upload using codecovcli qa | ||
if: ${{ !cancelled() && !github.event.pull_request.head.repo.fork && github.repository_owner == 'codecov' }} | ||
run: | | ||
make test_env.upload CODECOV_UPLOAD_TOKEN=${{ secrets.CODECOV_QA_TOKEN }} CODECOV_URL=${{ secrets.CODECOV_QA_URL }} | ||
- name: upload using codecovcli public qa | ||
if: ${{ !cancelled() && !github.event.pull_request.head.repo.fork && github.repository_owner == 'codecov' }} | ||
run: | | ||
make test_env.upload CODECOV_UPLOAD_TOKEN=${{ secrets.CODECOV_PUBLIC_QA_TOKEN }} CODECOV_URL=${{ secrets.CODECOV_PUBLIC_QA_URL }} | ||
- name: run basic-test-results | ||
if: ${{ !cancelled() && github.ref && contains(github.ref, 'pull') && !github.event.pull_request.head.repo.fork && github.repository_owner == 'codecov' }} | ||
uses: codecov/basic-test-results@v1 | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} |