chore: uniformly pass log.Tracef as packages.Load logger #726
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: Tests | |
on: | |
pull_request: | |
branches: ['**'] | |
merge_group: | |
branches: [main] | |
push: | |
branches: [main] | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
permissions: read-all | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 | |
- name: Setup go | |
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5 | |
with: | |
go-version: 'stable' | |
cache-dependency-path: "**/*.sum" | |
- name: golangci-lint | |
uses: golangci/golangci-lint-action@aaa42aa0628b4ae2578232a66b541047968fac86 # v6 | |
with: | |
version: v1.52.2 | |
skip-cache: true # actions/setup-go has already done this | |
- name: Verify license headers | |
run: go run tools/headercheck/header_check.go | |
- name: vet | |
run: go vet ./... | |
lint-workflows: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 | |
- name: Ensure SHA pinned actions | |
uses: zgosalvez/github-actions-ensure-sha-pinned-actions@b88cd0aad2c36a63e42c71f81cb1958fed95ac87 # v3 | |
unit-tests: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
go-version: ['1.22', '1.23'] | |
name: Unit tests (go${{ matrix.go-version }}) | |
steps: | |
- name: Checkout | |
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 | |
- name: Checkout Go | |
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5 | |
with: | |
go-version: ${{ matrix.go-version }} | |
cache-dependency-path: "**/*.sum" | |
- name: Run unit tests | |
run: |- | |
mkdir -p coverage | |
go test -shuffle=on -cover -covermode=atomic -coverpkg=./... -coverprofile=${{ github.workspace }}/coverage/unit.out -race ./... | |
go -C _integration-tests test -shuffle=on -cover -covermode=atomic -coverpkg=./...,github.com/datadog/orchestrion/... -coverprofile=${{ github.workspace }}/coverage/integration.out -race ./... | |
- name: Determine simple go version | |
if: always() && github.event_name != 'merge_group' | |
id: simple-go-version | |
run: echo "version=${COMPLETE_VERSION:0:4}" >> "${GITHUB_OUTPUT}" | |
shell: bash | |
env: | |
COMPLETE_VERSION: ${{ matrix.go-version }} | |
- name: Upload coverage report | |
# We want this even if the tests failed | |
if: always() && github.event_name != 'merge_group' | |
uses: codecov/codecov-action@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673 # v4 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
flags: go${{ steps.simple-go-version.outputs.version }},${{ runner.os }},${{ runner.arch }},unit | |
files: ./coverage/unit.out,./coverage/integration.out | |
name: Unit Tests (go${{ matrix.go-version }}) | |
integration-tests: | |
strategy: | |
fail-fast: false | |
matrix: | |
runs-on: [macos, ubuntu, windows] | |
go-version: ['1.22', '1.23'] | |
build-mode: [DRIVER] | |
include: | |
# Alternate build modes (only on ubuntu, latest go; to save CI time) | |
- runs-on: ubuntu | |
go-version: '1.22' | |
build-mode: TOOLEXEC | |
- runs-on: ubuntu | |
go-version: '1.22' | |
build-mode: GOFLAGS | |
runs-on: ${{ matrix.runs-on }}-latest | |
name: Integration tests (go${{ matrix.go-version }}, ${{ matrix.runs-on }}, ${{ matrix.build-mode }}) | |
steps: | |
- name: Checkout | |
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 | |
- name: Setup go | |
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5 | |
with: | |
go-version: ${{ matrix.go-version }} | |
cache-dependency-path: "**/*.sum" | |
- name: Setup python | |
uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f # v5 | |
with: | |
python-version: '>=3.9 <3.13' | |
cache: pip | |
cache-dependency-path: _integration-tests/utils/agent/requirements.txt | |
- name: Install python dependencies | |
run: pip install -r _integration-tests/utils/agent/requirements.txt | |
- name: Build orchestrion binary | |
run: go build -cover -covermode=atomic -coverpkg="./..." -o="bin/orchestrion.exe" . | |
- name: Run Integration Tests | |
shell: bash | |
run: |- | |
mkdir -p "${GOCOVERDIR}" | |
case "${{ matrix.build-mode }}" in | |
"DRIVER") | |
bin/orchestrion.exe go -C=_integration-tests test -shuffle=on ./... | |
;; | |
"TOOLEXEC") | |
go -C=_integration-tests test -shuffle=on -toolexec="${{ github.workspace }}/bin/orchestrion.exe toolexec" ./... | |
;; | |
"GOFLAGS") | |
export GOFLAGS="'-toolexec=${{ github.workspace }}/bin/orchestrion.exe toolexec' ${GOFLAGS}" | |
go -C=_integration-tests test -shuffle=on ./... | |
;; | |
*) | |
echo "Unknown build mode: ${{ matrix.build-mode }}" | |
exit 1 | |
;; | |
esac | |
env: | |
GOCOVERDIR: ${{ github.workspace }}/coverage/raw | |
GOFLAGS: -tags=integration,buildtag # Globally set build tags (buildtag is used by the dd-span test) | |
- name: Consolidate coverage report | |
if: github.event_name != 'merge_group' | |
# Using gotip because the fix for https://github.com/golang/go/issues/68468 is not yet released. | |
run: |- | |
go install golang.org/dl/gotip@latest | |
gotip download | |
gotip tool covdata textfmt -i ./coverage/raw -o ./coverage/integration.out | |
- name: Determine simple go version | |
if: github.event_name != 'merge_group' | |
id: simple-go-version | |
run: echo "version=${COMPLETE_VERSION:0:4}" >> "${GITHUB_OUTPUT}" | |
shell: bash | |
env: | |
COMPLETE_VERSION: ${{ matrix.go-version }} | |
- name: Upload coverage report | |
if: github.event_name != 'merge_group' | |
uses: codecov/codecov-action@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673 # v4 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
flags: go${{ steps.simple-go-version.outputs.version }},${{ runner.os }},${{ runner.arch }},integration | |
files: ./coverage/integration.out | |
name: Integration Tests (go${{ matrix.go-version }}, ${{ matrix.runs-on }}, ${{ matrix.build-mode }}) | |
# This is just a join point intended to simplify branch protection settings | |
complete: | |
runs-on: ubuntu-latest | |
needs: | |
- lint | |
- lint-workflows | |
- unit-tests | |
- integration-tests | |
if: '!cancelled()' | |
steps: | |
- name: Done | |
if: needs.lint.result == 'success' && needs.lint-workflows.result == 'success' && needs.unit-tests.result == 'success' && needs.integration-tests.result == 'success' | |
run: echo "OK" | |
- name: Done | |
if: needs.lint.result != 'success' || needs.lint-workflows.result != 'success' || needs.unit-tests.result != 'success' || needs.integration-tests.result != 'success' | |
run: |- | |
echo "Failed!" | |
exit 1 | |