Skip to content

use ./ in local path to composite action #2809

use ./ in local path to composite action

use ./ in local path to composite action #2809

# This workflow
# 1) runs all non-skipped (regular) tests and generates a summary.
# 2) generates a report of all skipped tests (e.g. due to flakiness).
name: Test Monitor - Regular and Skipped
on:
schedule:
- cron: '0 */2 * * *' # every 2 hours
push:
paths:
# temp: for testing
# - 'tools/test_monitor/**'
env:
BIGQUERY_DATASET: production_src_flow_test_metrics
BIGQUERY_TABLE: skipped_tests
BIGQUERY_TABLE2: test_results
GO_VERSION: "1.20"
SKIPPED_TESTS_FILE: skipped-tests
RESULTS_FILE: test-results
COMMIT_SHA: ${{ github.sha }}
RUN_ID: ${{ github.run_id }}
JSON_OUTPUT: true
VERBOSE: true
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}
cancel-in-progress: true
jobs:
create-dynamic-test-matrix:
name: Create Dynamic Test Matrix
runs-on: ubuntu-latest
outputs:
dynamic-matrix: ${{ steps.set-test-matrix.outputs.dynamicMatrix }}
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: ${{ env.GO_VERSION }}
cache: true
- name: Set Test Matrix
id: set-test-matrix
# run: go run utils/test_matrix/test_matrix.go admin cmd consensus engine fvm ledger module network utils
run: go run utils/test_matrix/test_matrix.go admin
unit-test:
name: Unit Tests (${{ matrix.targets.name }})
env:
TEST_CATEGORY: unit
needs: create-dynamic-test-matrix
strategy:
fail-fast: false
matrix:
targets: ${{ fromJSON(needs.create-dynamic-test-matrix.outputs.dynamic-matrix)}}
# need to set image explicitly due to GitHub logging issue as described in https://github.com/onflow/flow-go/pull/3087#issuecomment-1234383202
runs-on: ubuntu-20.04
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: ${{ env.GO_VERSION }}
cache: true
- name: Setup tests (${{ matrix.targets.name }})
run: VERBOSE=1 make -e GO_TEST_PACKAGES="${{ matrix.targets.packages }}" install-tools
- name: Run tests (${{ matrix.targets.name }})
run: make -es GO_TEST_PACKAGES="${{ matrix.targets.packages }}" unittest-main > test-output
timeout-minutes: 25
# command line from GitHub runner that works:
# make VERBOSE=1 JSON_OUTPUT=true GO_TEST_PACKAGES=github.com/onflow/flow-go/admin/commands/common -es unittest-main > test-output
# test run should continue even if there are failed tests
continue-on-error: true
- name: Process test results (${{ matrix.targets.name }})
uses: ./.github/workflows/actions/test-monitor-process-tests
- name: Setup tmate session
uses: mxschmitt/action-tmate@v3
if: success() || failure()
# - name: Get commit date
# id: commit_date
# run: echo "::set-output name=date::$(git show --no-patch --no-notes --pretty='%cI' $COMMIT_SHA)"
# - name: Get job run date
# id: job_run_date
# run: echo "::set-output name=date::$(TZ=":America/Los_Angeles" date -Iseconds)"
# - name: Process test results
# run: cat test-output | go run tools/test_monitor/level1/process_summary1_results.go
# env:
# JOB_STARTED: ${{ steps.job_run_date.outputs.date }}
# COMMIT_DATE: ${{ steps.commit_date.outputs.date }}
## - name: Setup tmate session
## uses: mxschmitt/action-tmate@v3
## if: success() || failure()
# - name: Set up Cloud SDK
# uses: google-github-actions/setup-gcloud@v0
# with:
# service_account_key: ${{ secrets.GCP_SA_KEY }}
# - name: Upload results to BigQuery (skipped tests)
# uses: nick-fields/retry@v2
# with:
# timeout_minutes: 1
# max_attempts: 3
# command: bq load --source_format=NEWLINE_DELIMITED_JSON $BIGQUERY_DATASET.$BIGQUERY_TABLE $SKIPPED_TESTS_FILE tools/test_monitor/schemas/skipped_tests_schema.json
# - name: Upload results to BigQuery (test run)
# uses: nick-fields/retry@v2
# with:
# timeout_minutes: 2
# max_attempts: 3
# command: bq load --source_format=NEWLINE_DELIMITED_JSON $BIGQUERY_DATASET.$BIGQUERY_TABLE2 $RESULTS_FILE tools/test_monitor/schemas/test_results_schema.json
# regular-skipped-test-run:
# name: Test Monitor - Regular, Skipped Tests Run
# strategy:
# fail-fast: false
# matrix:
# test-category:
# - unit
# - unit-crypto
# - unit-insecure
# - unit-integration
# - integration-bft
# - integration-mvp
# - integration-ghost
# - integration-network
# - integration-epochs
# - integration-access
# - integration-collection
# - integration-consensus
# - integration-execution
# - integration-verification
# env:
# TEST_CATEGORY: ${{ matrix.test-category }}
# COMMIT_SHA: ${{ github.sha }}
# RUN_ID: ${{ github.run_id }}
# SKIPPED_TESTS_FILE: skipped-tests
# RESULTS_FILE: test-results
# runs-on: ubuntu-latest
# steps:
# - name: Get job run date
# id: job_run_date
# run: echo "::set-output name=date::$(TZ=":America/Los_Angeles" date -Iseconds)"
# - name: Set up Cloud SDK
# uses: google-github-actions/setup-gcloud@v0
# with:
# service_account_key: ${{ secrets.GCP_SA_KEY }}
# - name: Setup Go
# uses: actions/setup-go@v2
# with:
# go-version: ${{ env.GO_VERSION }}
# - name: Checkout repo
# uses: actions/checkout@v2
# with:
# ref: ${{ env.COMMIT_SHA }}
# - name: Get commit date
# id: commit_date
# run: echo "::set-output name=date::$(git show --no-patch --no-notes --pretty='%cI' $COMMIT_SHA)"
# - name: Run tests
# uses: nick-fields/retry@v2
# with:
# timeout_minutes: 60
# max_attempts: 5
# command: ./tools/test_monitor/run-tests.sh
# env:
# JSON_OUTPUT: true
# - name: Print test results
# run: cat test-output
# - name: Process test results
# run: cat test-output | go run tools/test_monitor/level1/process_summary1_results.go
# env:
# JOB_STARTED: ${{ steps.job_run_date.outputs.date }}
# COMMIT_DATE: ${{ steps.commit_date.outputs.date }}
# - name: Upload results to BigQuery (skipped tests)
# uses: nick-fields/retry@v2
# with:
# timeout_minutes: 1
# max_attempts: 3
# command: bq load --source_format=NEWLINE_DELIMITED_JSON $BIGQUERY_DATASET.$BIGQUERY_TABLE $SKIPPED_TESTS_FILE tools/test_monitor/schemas/skipped_tests_schema.json
# - name: Upload results to BigQuery (test run)
# uses: nick-fields/retry@v2
# with:
# timeout_minutes: 2
# max_attempts: 3
# command: bq load --source_format=NEWLINE_DELIMITED_JSON $BIGQUERY_DATASET.$BIGQUERY_TABLE2 $RESULTS_FILE tools/test_monitor/schemas/test_results_schema.json