diff --git a/.github/workflows/reusable-test.yml b/.github/workflows/reusable-test.yml new file mode 100644 index 00000000000..3adf9ce4b15 --- /dev/null +++ b/.github/workflows/reusable-test.yml @@ -0,0 +1,233 @@ +on: + workflow_call: + inputs: + run_very_expensive_tests: + description: 'Run very expensive tests' + required: false + default: false + type: boolean + +defaults: + run: + shell: bash + +permissions: + contents: read + +jobs: + discover: + name: Discover Test Groups + runs-on: ubuntu-latest + outputs: + test_group_execution_contexts: ${{ steps.list_test_group_execution_contexts.outputs.test_group_execution_contexts }} + steps: + - uses: actions/checkout@v4 + with: + submodules: 'recursive' + fetch-depth: 0 + - id: list_test_group_execution_contexts + env: + VERY_EXPENSIVE_TESTS_RUN: ${{ inputs.run_very_expensive_tests }} + run: | + echo "test_group_execution_contexts<> $GITHUB_OUTPUT + go run ./cmd/ci/main.go --json list-test-group-execution-contexts --very-expensive-tests-run=$VERY_EXPENSIVE_TESTS_RUN | jq -r '.msg' | tee -a $GITHUB_OUTPUT + echo "EOF" >> $GITHUB_OUTPUT + cache: + name: Cache Dependencies + runs-on: ${{ matrix.runner }} + strategy: + matrix: + # We need to cache for each architecture we support: x86_64 and arm64 + runner: [ubuntu-latest, ubuntu-24.04-arm] + steps: + - uses: actions/checkout@v4 + with: + submodules: 'recursive' + fetch-depth: 0 + - id: fetch_params + env: + CACHE_KEY: fetch-params-${{ hashFiles('./extern/filecoin-ffi/parameters.json') }} + CACHE_PATH: | + /var/tmp/filecoin-proof-parameters/ + run: | + echo -e "key=$CACHE_KEY" | tee -a $GITHUB_OUTPUT + echo -e "path<> $GITHUB_OUTPUT + go run ./cmd/ci/main.go --json get-test-group-metadata --name "${{ matrix.name }}" | jq -r '.msg' | tee -a $GITHUB_OUTPUT + echo "EOF" >> $GITHUB_OUTPUT + - name: Install gotestsum + run: go install gotest.tools/gotestsum@latest + - id: artifact + uses: actions/download-artifact@v4 + with: + name: jobs.cache.${{ runner.os }}.${{ runner.arch }}.outputs + - id: cache + env: + file: jobs.cache.${{ runner.os }}.${{ runner.arch }}.outputs.json + run: | + echo "make_deps_key=$(jq -r .make_deps_key "$file")" | tee -a $GITHUB_OUTPUT + echo "make_deps_path<