-
Notifications
You must be signed in to change notification settings - Fork 38
[NOJIRA] Migrate circle-ci to github action #1036
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
de82ded
de424f0
b1e6e28
58c1737
0a6e9ce
dedf774
610fdf1
3667db9
7c71768
0b73e2f
e63470a
52a8481
c4001b3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,207 @@ | ||||||
| name: CI | ||||||
|
|
||||||
| on: | ||||||
| pull_request: | ||||||
| push: | ||||||
| branches: [main] | ||||||
|
|
||||||
| concurrency: | ||||||
| group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | ||||||
| cancel-in-progress: true | ||||||
|
|
||||||
| env: | ||||||
| GOPATH: /home/runner/go | ||||||
|
|
||||||
| jobs: | ||||||
| lint-and-format: | ||||||
| runs-on: ubuntu-latest | ||||||
| steps: | ||||||
| - uses: actions/checkout@v2 | ||||||
| - uses: actions/setup-go@v5 | ||||||
edznux-dd marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
| with: | ||||||
| go-version-file: go.mod | ||||||
| cache: true | ||||||
| - name: Install lint tools | ||||||
| run: make install-golangci-lint install-controller-gen | ||||||
| - name: Format | ||||||
| run: | | ||||||
| make fmt | ||||||
| git diff --exit-code | ||||||
| - name: Vet | ||||||
| run: make vet | ||||||
| - name: Lint | ||||||
| run: make lint | ||||||
|
|
||||||
| test: | ||||||
| runs-on: ubuntu-latest | ||||||
| permissions: | ||||||
| id-token: write | ||||||
| contents: read | ||||||
| steps: | ||||||
| - uses: actions/checkout@v2 | ||||||
| - uses: actions/setup-go@v5 | ||||||
| with: | ||||||
| go-version-file: go.mod | ||||||
| cache: true | ||||||
| - name: Get Datadog credentials | ||||||
| id: dd-sts | ||||||
| uses: DataDog/dd-sts-action@main | ||||||
| with: | ||||||
| policy: chaos-controller | ||||||
| - name: Install tools | ||||||
| run: make -j4 install-controller-gen install-yamlfmt install-kubebuilder install-datadog-ci | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think I want to fix this error this way: it install a tool that isn't used in the job (the unit tests and e2e test don't run golangci-lint), so this takes times for no real reasons. I think the correct fix would be in the makefile instead |
||||||
| - name: Run unit tests | ||||||
| run: make test GINKGO_PROCS=2 | ||||||
| env: | ||||||
| DATADOG_API_KEY: ${{ steps.dd-sts.outputs.api_key }} | ||||||
| - name: Upload code coverage | ||||||
| if: success() | ||||||
| run: datadog-ci coverage upload --format go-coverprofile --flags "type:unit-tests" cover.profile | ||||||
| env: | ||||||
| DATADOG_API_KEY: ${{ steps.dd-sts.outputs.api_key }} | ||||||
| - name: Upload test report | ||||||
| if: always() | ||||||
| uses: actions/upload-artifact@v4 | ||||||
| with: | ||||||
| name: report-test.xml | ||||||
| path: report-test.xml | ||||||
|
|
||||||
| docker-build: | ||||||
| runs-on: ubuntu-latest | ||||||
| strategy: | ||||||
| fail-fast: false | ||||||
| matrix: | ||||||
| target: [injector, manager, handler] | ||||||
| steps: | ||||||
| - uses: actions/checkout@v2 | ||||||
| - name: Build ${{ matrix.target }} | ||||||
| run: make docker-build-${{ matrix.target }} SKIP_GENERATE=true | ||||||
| - name: Upload tarball | ||||||
| uses: actions/upload-artifact@v4 | ||||||
| with: | ||||||
| name: docker-${{ matrix.target }} | ||||||
| path: bin/${{ matrix.target }}/${{ matrix.target }}.tar.gz | ||||||
| retention-days: 1 | ||||||
|
|
||||||
| e2e-test: | ||||||
| runs-on: ubuntu-latest | ||||||
| needs: docker-build | ||||||
| timeout-minutes: 45 | ||||||
| permissions: | ||||||
| id-token: write | ||||||
| contents: read | ||||||
| steps: | ||||||
| - uses: actions/checkout@v2 | ||||||
| - uses: actions/setup-go@v5 | ||||||
| with: | ||||||
| go-version-file: go.mod | ||||||
| cache: true | ||||||
| - name: Get Datadog credentials | ||||||
| id: dd-sts | ||||||
| uses: DataDog/dd-sts-action@main | ||||||
| with: | ||||||
| policy: chaos-controller | ||||||
| - name: Install tools | ||||||
| run: make -j6 install-controller-gen install-yamlfmt install-helm install-kubebuilder install-datadog-ci | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
same here as https://github.com/DataDog/chaos-controller/pull/1036/changes#r2804963114
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same as above:
|
||||||
| - name: Download docker tarballs | ||||||
| uses: actions/download-artifact@v4 | ||||||
| with: | ||||||
| pattern: docker-* | ||||||
| merge-multiple: false | ||||||
| - name: Move tarballs into place | ||||||
| run: | | ||||||
| for target in injector manager handler; do | ||||||
| mkdir -p bin/${target} | ||||||
| mv docker-${target}/${target}.tar.gz bin/${target}/ | ||||||
| done | ||||||
| - name: Install Minikube | ||||||
| run: make ci-install-minikube MINIKUBE_CPUS=max MINIKUBE_MEMORY=max | ||||||
| - name: Install cert-manager | ||||||
| run: make lima-install-cert-manager KUBECTL="minikube kubectl --" | ||||||
| - name: Load images into Minikube | ||||||
| run: make minikube-load-all | ||||||
| - name: Run e2e tests | ||||||
| env: | ||||||
| DATADOG_API_KEY: ${{ steps.dd-sts.outputs.api_key }} | ||||||
| run: | | ||||||
| for attempt in 1 2 3; do | ||||||
| echo "=== Attempt ${attempt}/3 ===" | ||||||
| if make e2e-test KUBECTL="minikube kubectl --" E2E_TEST_CLUSTER_NAME="minikube" E2E_TEST_KUBECTL_CONTEXT="minikube"; then | ||||||
| exit 0 | ||||||
| fi | ||||||
| echo "Attempt ${attempt} failed" | ||||||
| done | ||||||
| echo "All 3 attempts failed" | ||||||
| exit 1 | ||||||
| - name: Save controller logs | ||||||
| if: failure() | ||||||
| run: | | ||||||
| mkdir -p /tmp/logs | ||||||
| minikube kubectl -- -n chaos-engineering logs -lapp=chaos-controller -c manager --tail=-1 > /tmp/logs/e2e.txt 2>&1 || true | ||||||
| - name: Upload controller logs | ||||||
| if: failure() | ||||||
| uses: actions/upload-artifact@v4 | ||||||
| with: | ||||||
| name: e2e-controller-logs | ||||||
| path: /tmp/logs | ||||||
| - name: Upload e2e test report | ||||||
| if: always() | ||||||
| uses: actions/upload-artifact@v4 | ||||||
| with: | ||||||
| name: report-e2e-test.xml | ||||||
| path: report-e2e-test.xml | ||||||
|
|
||||||
| validate-codegen: | ||||||
| runs-on: ubuntu-latest | ||||||
| steps: | ||||||
| - uses: actions/checkout@v2 | ||||||
| - uses: actions/setup-go@v5 | ||||||
| with: | ||||||
| go-version-file: go.mod | ||||||
| cache: true | ||||||
| - name: Install tools | ||||||
| run: make -j6 install-controller-gen install-yamlfmt install-mockery install-protobuf PROTOC_OS=linux | ||||||
| - name: Validate go dependencies | ||||||
| run: | | ||||||
| make godeps | ||||||
| git diff --exit-code | ||||||
| - name: Validate manifests | ||||||
| run: | | ||||||
| make manifests | ||||||
| git diff --exit-code | ||||||
| - name: Validate mocks | ||||||
| run: | | ||||||
| make generate-mocks | ||||||
| git diff --exit-code | ||||||
| - name: Validate disruptionlistener protobuf | ||||||
| run: | | ||||||
| make generate-disruptionlistener-protobuf | ||||||
| git diff --exit-code ':!go.*' | ||||||
| - name: Validate chaosdogfood protobuf | ||||||
| run: | | ||||||
| make generate-chaosdogfood-protobuf | ||||||
| git diff --exit-code ':!go.*' | ||||||
|
|
||||||
| python-checks: | ||||||
| runs-on: ubuntu-latest | ||||||
| steps: | ||||||
| - uses: actions/checkout@v2 | ||||||
| - name: Install Python dependencies | ||||||
| run: pip install -r tasks/requirements.txt | ||||||
| - name: Check third-party licenses | ||||||
| run: | | ||||||
| inv license-check | ||||||
| git diff --exit-code | ||||||
| - name: Check license headers | ||||||
| run: | | ||||||
| inv header-check | ||||||
| git diff --exit-code | ||||||
|
|
||||||
| doc-spellcheck: | ||||||
| runs-on: ubuntu-latest | ||||||
| steps: | ||||||
| - uses: actions/checkout@v2 | ||||||
| - name: Install markdown-spellcheck | ||||||
| run: npm install -g markdown-spellcheck | ||||||
| - name: Spellcheck | ||||||
| run: mdspell --report --en-us --ignore-numbers --ignore-acronyms $(find . -name vendor -prune -o -name '*.md' -print) || echo "please run 'make spellcheck' for local testing" | ||||||

Uh oh!
There was an error while loading. Please reload this page.