feat: support namespaced Datadog credentials #6
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: Testing | |
on: | |
push: | |
branches: | |
- 'master' | |
- 'release-*' | |
pull_request: | |
branches: | |
- 'master' | |
- 'release-*' | |
workflow_dispatch: | |
inputs: | |
debug_enabled: | |
description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)' | |
required: false | |
default: false | |
env: | |
# Golang version to use across CI steps | |
GOLANG_VERSION: '1.22' | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
permissions: | |
contents: read | |
jobs: | |
event_file: | |
name: 'Event File' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Upload | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Event File | |
path: ${{ github.event_path }} | |
test-unit: | |
name: Run unit tests | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set up Go | |
uses: actions/[email protected] | |
with: | |
go-version: ${{ env.GOLANG_VERSION }} | |
id: go | |
- name: Check out code into the Go module directory | |
uses: actions/checkout@v4 | |
- name: Restore go build cache | |
uses: actions/cache@v4 | |
with: | |
path: ~/.cache/go-build | |
key: ${{ runner.os }}-go-build-v1-${{ github.run_id }} | |
- name: Download all Go modules | |
run: | | |
go mod download | |
- name: Test | |
run: make test-unit | |
- name: Upload Unit Test Results | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Unit Test Results | |
path: | | |
junit-unit-test.xml | |
- name: Generate code coverage artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: coverage-output-unit | |
path: coverage-output-unit | |
test-e2e: | |
strategy: | |
fail-fast: false | |
matrix: | |
kubernetes: | |
- version: 1.26 | |
latest: false | |
- version: 1.27 | |
latest: false | |
- version: 1.28 | |
latest: false | |
- version: 1.29 | |
latest: true | |
name: Run end-to-end tests | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set up Go | |
uses: actions/[email protected] | |
with: | |
go-version: '1.22' | |
- uses: actions/checkout@v4 | |
- name: Setup k3s | |
env: | |
INSTALL_K3S_CHANNEL: v${{ matrix.kubernetes.version }} | |
run: | | |
curl -sfL https://get.k3s.io | sh - | |
sudo mkdir ~/.kube | |
sudo cp /etc/rancher/k3s/k3s.yaml ~/.kube/config | |
sudo chmod 755 ~/.kube/config | |
kubectl version | |
kubectl create ns argo-rollouts | |
- uses: actions/cache@v4 | |
with: | |
path: ~/go/pkg/mod | |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-go- | |
- name: Download cache | |
run: go mod download | |
- name: Install CRDs | |
run: | | |
kubectl apply -k manifests/crds | |
kubectl apply -f test/e2e/crds | |
- name: Start controller | |
run: make start-e2e 2>&1 | sed -r "s/[[:cntrl:]]\[[0-9]{1,3}m//g" > /tmp/e2e-controller.log & | |
- name: Setup tmate session | |
uses: mxschmitt/action-tmate@v3 | |
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.debug_enabled == 'true'}} | |
- name: Run e2e tests | |
run: | | |
make test-e2e | |
if: ${{ !(github.event_name == 'workflow_dispatch' && github.event.inputs.debug_enabled == 'true') }} | |
- name: Stop e2e tests controller | |
run: | | |
pgrep -f go-build -a | |
pkill -f go-build | |
sleep 5 | |
echo "done stopping process" | |
ls -lah coverage-output-e2e/ | |
if: ${{ !(github.event_name == 'workflow_dispatch' && github.event.inputs.debug_enabled == 'true' && matrix.kubernetes.latest)}} | |
- name: Output Rerun Overview | |
run: | | |
[[ -f rerunreport.txt ]] && cat rerunreport.txt || echo "No rerun report found" | |
- name: Upload E2E Test Results | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: E2E Test Results (k8s ${{ matrix.kubernetes.version }}) | |
path: | | |
junit-e2e-test.xml | |
- name: Upload e2e-controller logs | |
uses: actions/upload-artifact@v4 | |
with: | |
name: e2e-controller-k8s-${{ matrix.kubernetes.version }}.log | |
path: /tmp/e2e-controller.log | |
if: ${{ always() }} | |
- name: Upload code coverage artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: coverage-output-e2e | |
path: coverage-output-e2e | |
if: ${{ matrix.kubernetes.latest }} | |
coverage-process: | |
name: Process Coverage Files | |
runs-on: ubuntu-latest | |
needs: | |
- test-unit | |
- test-e2e | |
steps: | |
- name: Set up Go | |
uses: actions/[email protected] | |
with: | |
go-version: ${{ env.GOLANG_VERSION }} | |
id: go | |
- uses: actions/checkout@v4 | |
- name: Get e2e code coverage | |
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 | |
with: | |
name: coverage-output-e2e | |
path: coverage-output-e2e | |
- name: Get unit test code coverage | |
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 | |
with: | |
name: coverage-output-unit | |
path: coverage-output-unit | |
- name: combine-go-coverage | |
run: | | |
go tool covdata textfmt -i=coverage-output-unit/,coverage-output-e2e/ -o full-coverage.out | |
- name: Upload code coverage information to codecov.io | |
uses: codecov/codecov-action@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673 # v4.5.0 | |
with: | |
file: full-coverage.out | |
fail_ci_if_error: false | |
codecov_yml_path: .codecov.yml | |
disable_search: true | |
verbose: true | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} |