docs(readme): update slack community link #634
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: "build-test-distribute" | |
on: | |
push: | |
branches: ["master", "release-*", "!*-merge-master"] | |
tags: ["*"] | |
pull_request: | |
branches: ["master", "release-*"] | |
env: | |
# This is automatically managed by CI | |
K8S_MIN_VERSION: v1.23.17-k3s1 | |
K8S_MAX_VERSION: v1.28.1-k3s1 | |
CI_TOOLS_DIR: /home/runner/work/kuma/kuma/.ci_tools | |
jobs: | |
check: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: "Check if should run on all arch/os combinations" | |
if: github.event_name == 'push' || contains(github.event.pull_request.labels.*.name, 'ci/run-full-matrix') | |
run: | | |
echo 'RUN_FULL_MATRIX=true' > .run-full-matrix | |
echo 'RUN_FULL_MATRIX=true' >> $GITHUB_ENV | |
- uses: actions/setup-go@v4 | |
with: | |
go-version-file: go.mod | |
cache-dependency-path: | | |
.run-full-matrix | |
go.sum | |
- uses: actions/cache@v3 | |
with: | |
path: | | |
${{ env.CI_TOOLS_DIR }} | |
key: ${{ runner.os }}-devtools-${{ hashFiles('mk/dependencies/deps.lock') }} | |
restore-keys: | | |
${{ runner.os }}-devtools | |
- run: | | |
make dev/tools | |
- run: | | |
make clean | |
- run: | | |
make check | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: "Check if should run on all arch/os combinations" | |
if: github.event_name == 'push' || contains(github.event.pull_request.labels.*.name, 'ci/run-full-matrix') | |
run: | | |
echo 'RUN_FULL_MATRIX=true' > .run-full-matrix | |
echo 'RUN_FULL_MATRIX=true' >> $GITHUB_ENV | |
- uses: actions/setup-go@v4 | |
with: | |
go-version-file: go.mod | |
cache-dependency-path: | | |
.run-full-matrix | |
go.sum | |
- uses: actions/cache@v3 | |
with: | |
path: | | |
${{ env.CI_TOOLS_DIR }} | |
key: ${{ runner.os }}-devtools-${{ hashFiles('mk/dependencies/deps.lock') }} | |
restore-keys: | | |
${{ runner.os }}-devtools | |
- run: | | |
make dev/tools | |
- name: Free up disk space for the Runner | |
run: | | |
echo "Disk usage before cleanup" | |
sudo df -h | |
sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc | |
docker system prune --all -f | |
echo "Disk usage after cleanup" | |
sudo df -h | |
- name: "Set switches based on if run full matrix" | |
if: ${{ env.RUN_FULL_MATRIX == 'true' }} | |
id: set-full-matrix-switches | |
run: | | |
echo 'ENABLED_GOARCHES=arm64 amd64' >> $GITHUB_ENV | |
echo 'ENABLED_GOOSES=linux darwin' >> $GITHUB_ENV | |
- run: | | |
make build | |
- run: | | |
make -j build/distributions | |
- name: Install dependencies for cross builds | |
run: | | |
sudo apt-get update; sudo apt-get install -y qemu-user-static binfmt-support | |
- run: | | |
make -j images | |
- run: | | |
make -j docker/save | |
- name: Cleanup redundant build outputs | |
run: | | |
find ./build/artifacts-* -maxdepth 0 -type d | xargs -I % rm -rf % | |
find ./build/distributions/* -maxdepth 0 -type d | grep -v '/out' | xargs -I % rm -rf % | |
find ./build/tools-* -maxdepth 0 -type d | xargs -I % rm -rf % | |
rm -rf ./build/oapitmp | |
rm -rf ./build/ebpf/ | |
- name: Upload build output | |
uses: actions/upload-artifact@v3 | |
with: | |
name: build-output | |
path: build | |
retention-days: 1 | |
- name: Run container structure test | |
if: ${{ !contains(github.event.pull_request.labels.*.name, 'ci/skip-container-structure-test') && !contains(github.event.pull_request.labels.*.name, 'ci/skip-test') }} | |
run: | | |
make test/container-structure | |
test: | |
runs-on: ubuntu-latest | |
if: ${{ ! contains(github.event.pull_request.labels.*.name, 'ci/skip-test') }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: "Check if should run on all arch/os combinations" | |
if: github.event_name == 'push' || contains(github.event.pull_request.labels.*.name, 'ci/run-full-matrix') | |
run: | | |
echo 'RUN_FULL_MATRIX=true' > .run-full-matrix | |
echo 'RUN_FULL_MATRIX=true' >> $GITHUB_ENV | |
- uses: actions/setup-go@v4 | |
with: | |
go-version-file: go.mod | |
cache-dependency-path: | | |
.run-full-matrix | |
go.sum | |
- uses: actions/cache@v3 | |
with: | |
path: | | |
${{ env.CI_TOOLS_DIR }} | |
key: ${{ runner.os }}-devtools-${{ hashFiles('mk/dependencies/deps.lock') }} | |
restore-keys: | | |
${{ runner.os }}-devtools | |
- run: | | |
make dev/tools | |
- name: Free up disk space for the Runner | |
run: | | |
echo "Disk usage before cleanup" | |
sudo df -h | |
sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc | |
docker system prune --all -f | |
echo "Disk usage after cleanup" | |
sudo df -h | |
- name: Run tests | |
run: | | |
make test TEST_REPORTS=1 | |
- name: Save test reports | |
uses: actions/upload-artifact@v3 | |
with: | |
name: test-reports | |
path: build/reports | |
retention-days: 7 | |
distributions: | |
needs: ["check", "test", "test_e2e", "test_e2e_env"] | |
if: ${{ always() }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: "Halt due to previous failures" | |
if: ${{ contains(needs.*.result, 'failure')|| contains(needs.*.result, 'cancelled') }} | |
run: | | |
exit 1 | |
# for some reason, GH Action will always trigger a downstream job even if there are errors in an dependent job | |
# so we manually check it here. An example could be found here: https://github.com/kumahq/kuma/actions/runs/7044980149 | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: "Check if should run on all arch/os combinations" | |
if: github.event_name == 'push' || contains(github.event.pull_request.labels.*.name, 'ci/run-full-matrix') | |
run: | | |
echo 'RUN_FULL_MATRIX=true' > .run-full-matrix | |
echo 'RUN_FULL_MATRIX=true' >> $GITHUB_ENV | |
- name: "Set switches based on if run full matrix" | |
if: ${{ env.RUN_FULL_MATRIX == 'true' }} | |
id: set-full-matrix-switches | |
run: | | |
echo 'ENABLED_GOARCHES=arm64 amd64' >> $GITHUB_ENV | |
echo 'ENABLED_GOOSES=linux darwin' >> $GITHUB_ENV | |
- name: "Check if force push" | |
if: github.event_name == 'push' || contains(github.event.pull_request.labels.*.name, 'ci/force-publish') | |
run: | | |
echo 'ALLOW_PUSH=true' >> $GITHUB_ENV | |
- name: Install dependencies for cross builds | |
run: | | |
sudo apt-get update; sudo apt-get install -y qemu-user-static binfmt-support | |
- uses: actions/setup-go@v4 | |
with: | |
go-version-file: go.mod | |
cache-dependency-path: | | |
.run-full-matrix | |
go.sum | |
- uses: actions/cache@v3 | |
with: | |
path: | | |
${{ env.CI_TOOLS_DIR }} | |
key: ${{ runner.os }}-devtools-${{ hashFiles('mk/dependencies/deps.lock') }} | |
restore-keys: | | |
${{ runner.os }}-devtools | |
- uses: actions/download-artifact@v3 | |
with: | |
name: build-output | |
path: build | |
- name: Inspect created tars | |
run: | | |
for i in build/distributions/out/*.tar.gz; do echo $i; tar -tvf $i; done | |
- name: Publish distributions to Pulp | |
env: | |
PULP_USERNAME: ${vars.PULP_USERNAME} | |
PULP_PASSWORD: ${secrets.PULP_PASSWORD} | |
CLOUDSMITH_API_KEY: ${secrets.CLOUDSMITH_API_KEY} | |
run: | | |
make publish/pulp | |
- name: Load images | |
run: | | |
make docker/load | |
- name: Publish images | |
env: | |
DOCKER_API_KEY: ${secrets.DOCKER_API_KEY} | |
DOCKER_USERNAME: ${vars.DOCKER_USERNAME} | |
run: |- | |
make docker/login | |
# ensure we always logout | |
function on_exit() { | |
make docker/logout | |
} | |
trap on_exit EXIT | |
make docker/push | |
make docker/manifest | |
gen_e2e_matrix: | |
runs-on: ubuntu-latest | |
if: ${{ !contains(github.event.pull_request.labels.*.name, 'ci/skip-test') && !contains(github.event.pull_request.labels.*.name, 'ci/skip-e2e-test') }} | |
outputs: | |
matrix: ${{ steps.generate-matrix.outputs.matrix }} | |
steps: | |
- name: "Check if should run on all arch/os combinations" | |
if: github.event_name == 'push' || contains(github.event.pull_request.labels.*.name, 'ci/run-full-matrix') | |
run: | | |
echo 'RUN_FULL_MATRIX=true' > .run-full-matrix | |
echo 'RUN_FULL_MATRIX=true' >> $GITHUB_ENV | |
- id: generate-matrix | |
name: Generate matrix | |
env: | |
BASE_MATRIX: |- | |
{ | |
"test_e2e": { | |
"target": [""], | |
"k8sVersion": ["kind", "kindIpv6", "${{ env.K8S_MIN_VERSION }}", "${{ env.K8S_MAX_VERSION }}"], | |
"arch": ["amd64", "arm64"], | |
"parallelism": [3], | |
"cniNetworkPlugin": ["flannel"], | |
"legacyKDS": [false] | |
}, | |
"test_e2e_env": { | |
"target": ["kubernetes", "universal", "multizone"], | |
"k8sVersion": ["kind", "kindIpv6", "${{ env.K8S_MIN_VERSION }}", "${{ env.K8S_MAX_VERSION }}"], | |
"arch": ["amd64", "arm64"], | |
"parallelism": [1], | |
"cniNetworkPlugin": ["flannel"], | |
"legacyKDS": [false], | |
"exclude":[ | |
{"target": "kubernetes", "k8sVersion":"kind"}, | |
{"target": "multizone", "k8sVersion":"kind"}, | |
{"target":"universal", "k8sVersion":"${{ env.K8S_MIN_VERSION }}"}, | |
{"target":"universal", "k8sVersion":"${{ env.K8S_MAX_VERSION }}"} | |
], | |
"include":[ | |
{"legacyKDS": true, "k8sVersion": "${{ env.K8S_MAX_VERSION }}", "target": "multizone", "arch": "amd64"}, | |
{"cniNetworkPlugin": "calico", "k8sVersion": "${{ env.K8S_MAX_VERSION }}", "target": "multizone", "arch": "amd64"} | |
] | |
} | |
} | |
OVERRIDE_MATRIX: |- | |
{ | |
"test_e2e": false, | |
"test_e2e_env": { | |
"include": [], | |
"exclude": [{"arch": "arm64"}, {"k8sVersion": "kindIpv6"}, {"k8sVersion": "${{ env.K8S_MIN_VERSION}}"}] | |
} | |
} | |
run: |- | |
BASE_MATRIX_ALL='${{ env.BASE_MATRIX }}' | |
if [[ "${RUN_FULL_MATRIX}" != "true" ]]; then | |
BASE_MATRIX_ALL=$(echo $BASE_MATRIX_ALL | jq -r '. * ${{ env.OVERRIDE_MATRIX }}') | |
fi | |
echo "final matrix: $BASE_MATRIX_ALL" | |
echo "matrix<<EOF" >> $GITHUB_OUTPUT | |
echo "$BASE_MATRIX_ALL" >> $GITHUB_OUTPUT | |
echo "EOF" >> $GITHUB_OUTPUT | |
test_e2e: | |
name: "${{ matrix.arch }}-${{ matrix.k8sVersion }}" | |
needs: ["gen_e2e_matrix", "build"] | |
if: fromJSON(needs.gen_e2e_matrix.outputs.matrix).test_e2e | |
strategy: | |
matrix: ${{ fromJSON(needs.gen_e2e_matrix.outputs.matrix).test_e2e }} | |
fail-fast: false | |
uses: ./.github/workflows/e2e.yaml | |
with: | |
matrix: ${{ toJSON(matrix) }} | |
secrets: | |
circleCIToken: ${{ secrets.CIRCLECI_TOKEN }} | |
test_e2e_env: | |
name: "${{ matrix.target }}${{ matrix.cniNetworkPlugin == 'calico' && '-calico' || '' }}:${{ matrix.arch }}-${{ matrix.k8sVersion }}${{ matrix.legacyKDS && '(legacy-kds)' || '' }}" | |
needs: ["gen_e2e_matrix", "build"] | |
if: fromJSON(needs.gen_e2e_matrix.outputs.matrix).test_e2e_env | |
strategy: | |
matrix: ${{ fromJSON(needs.gen_e2e_matrix.outputs.matrix).test_e2e_env }} | |
fail-fast: false | |
uses: ./.github/workflows/e2e.yaml | |
with: | |
matrix: ${{ toJSON(matrix) }} | |
secrets: | |
circleCIToken: ${{ secrets.CIRCLECI_TOKEN }} |