|
|
@ -21,7 +21,7 @@ permissions: {} |
|
|
|
|
|
|
|
|
|
|
|
jobs: |
|
|
|
jobs: |
|
|
|
grafana: |
|
|
|
grafana: |
|
|
|
# Run this workflow only for PRs from forks; if it gets merged into `main` or `release-*`, |
|
|
|
# Run this workflow only for PRs from forks |
|
|
|
# the `pr-backend-unit-tests-enterprise` workflow will run instead |
|
|
|
# the `pr-backend-unit-tests-enterprise` workflow will run instead |
|
|
|
if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork == true |
|
|
|
if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork == true |
|
|
|
strategy: |
|
|
|
strategy: |
|
|
@ -58,6 +58,7 @@ jobs: |
|
|
|
|
|
|
|
|
|
|
|
grafana-enterprise: |
|
|
|
grafana-enterprise: |
|
|
|
# Run this workflow for non-PR events (like pushes to `main` or `release-*`) OR for internal PRs (PRs not from forks) |
|
|
|
# Run this workflow for non-PR events (like pushes to `main` or `release-*`) OR for internal PRs (PRs not from forks) |
|
|
|
|
|
|
|
# If it gets merged into `main` or `release-*`, then a junit test result is uploaded to GCS. |
|
|
|
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork == false |
|
|
|
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork == false |
|
|
|
strategy: |
|
|
|
strategy: |
|
|
|
matrix: |
|
|
|
matrix: |
|
|
@ -85,6 +86,10 @@ jobs: |
|
|
|
uses: ./.github/actions/setup-enterprise |
|
|
|
uses: ./.github/actions/setup-enterprise |
|
|
|
with: |
|
|
|
with: |
|
|
|
github-app-name: 'grafana-ci-bot' |
|
|
|
github-app-name: 'grafana-ci-bot' |
|
|
|
|
|
|
|
- run: echo "RESULTS_FILE=$(date --rfc-3339=seconds --utc | sed -s 's/ /-/g')_${SHARD/\//_}.xml" >> "$GITHUB_ENV" |
|
|
|
|
|
|
|
env: |
|
|
|
|
|
|
|
SHARD: ${{ matrix.shard }} |
|
|
|
|
|
|
|
- run: go install github.com/jstemmer/go-junit-report/v2@85bf4716ac1f025f2925510a9f5e9f5bb347c009 |
|
|
|
- name: Generate Go code |
|
|
|
- name: Generate Go code |
|
|
|
run: make gen-go |
|
|
|
run: make gen-go |
|
|
|
- name: Run unit tests |
|
|
|
- name: Run unit tests |
|
|
@ -92,4 +97,23 @@ jobs: |
|
|
|
SHARD: ${{ matrix.shard }} |
|
|
|
SHARD: ${{ matrix.shard }} |
|
|
|
run: | |
|
|
|
run: | |
|
|
|
readarray -t PACKAGES <<< "$(./scripts/ci/backend-tests/shard.sh -N"$SHARD")" |
|
|
|
readarray -t PACKAGES <<< "$(./scripts/ci/backend-tests/shard.sh -N"$SHARD")" |
|
|
|
go test -short -timeout=30m "${PACKAGES[@]}" |
|
|
|
go test -short -v -timeout=30m "${PACKAGES[@]}" | tee >(go-junit-report -set-exit-code > "$RESULTS_FILE") |
|
|
|
|
|
|
|
- name: Log in to GCS |
|
|
|
|
|
|
|
if: github.event_name == 'push' && github.repository == 'grafana/grafana' && (success() || failure()) |
|
|
|
|
|
|
|
uses: grafana/shared-workflows/actions/login-to-gcs@login-to-gcs-v0.2.0 |
|
|
|
|
|
|
|
with: |
|
|
|
|
|
|
|
service_account: github-junit-uploader@grafanalabs-workload-identity.iam.gserviceaccount.com |
|
|
|
|
|
|
|
bucket: grafana-test-results |
|
|
|
|
|
|
|
- if: github.event_name == 'push' && github.repository == 'grafana/grafana' && (success() || failure()) |
|
|
|
|
|
|
|
run: echo "BUCKET_PATH=go-unit-tests/$(echo ${REF_NAME} | sed 's/\//-/g')" >> "$GITHUB_ENV" |
|
|
|
|
|
|
|
env: |
|
|
|
|
|
|
|
REF_NAME: ${{ github.ref_name }} |
|
|
|
|
|
|
|
- name: Upload test results |
|
|
|
|
|
|
|
if: github.event_name == 'push' && github.repository == 'grafana/grafana' && (success() || failure()) |
|
|
|
|
|
|
|
uses: grafana/shared-workflows/actions/push-to-gcs@push-to-gcs-v0.2.0 |
|
|
|
|
|
|
|
with: |
|
|
|
|
|
|
|
bucket: grafana-test-results |
|
|
|
|
|
|
|
service_account: github-junit-uploader@grafanalabs-workload-identity.iam.gserviceaccount.com |
|
|
|
|
|
|
|
environment: "dev" # Can be dev/prod (defaults to dev) |
|
|
|
|
|
|
|
path: ${{ env.RESULTS_FILE }} |
|
|
|
|
|
|
|
bucket_path: ${{ env.BUCKET_PATH }} |
|
|
|