Skip to content

Commit

Permalink
ci(actions): run amd64 E2E on GitHub actions and arm64 on CircleCI
Browse files Browse the repository at this point in the history
Signed-off-by: Jay Chen <[email protected]>
  • Loading branch information
jijiechen committed Nov 28, 2023
1 parent 7f2bf5e commit e1fdd97
Show file tree
Hide file tree
Showing 2 changed files with 111 additions and 9 deletions.
21 changes: 13 additions & 8 deletions .github/workflows/build-test-distribute.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,14 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
# GitHub actions does not share cache across multiple jobs,
# so we have to operate cache in each job and action file
- 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 'ENABLED_GOARCHES=arm64 amd64' >> $GITHUB_ENV
echo 'ENABLED_GOOSES=linux darwin' >> $GITHUB_ENV
- uses: actions/setup-go@v4
with:
go-version-file: go.mod
# GitHub actions does not share cache across multiple jobs,
# so we have to operate cache in each job and action file
- uses: actions/cache@v3
with:
path: |
Expand All @@ -56,6 +51,11 @@ jobs:
${{ runner.os }}-devtools
- run: |
make dev/tools
- 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 'ENABLED_GOARCHES=arm64 amd64' >> $GITHUB_ENV
echo 'ENABLED_GOOSES=linux darwin' >> $GITHUB_ENV
- run: |
make build
- run: |
Expand Down Expand Up @@ -120,9 +120,14 @@ jobs:
retention-days: 7
distributions:
needs: ["check", "test", "test_e2e", "test_e2e_env"]
if: ${{ always() && !failure() && !cancelled() }}
if: ${{ always() }}
runs-on: ubuntu-latest
steps:
# see https://stackoverflow.com/a/67532120/4907315
- name: "Halt due to previous failures"
run: |
exit 1
if: ${{ contains(needs.*.result, 'failure')|| contains(needs.*.result, 'cancelled') }}
- 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: |
Expand Down
99 changes: 98 additions & 1 deletion .github/workflows/e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,104 @@ on:
circleCIToken:
required: true
jobs:
e2e:
e2e_gh_actions:
if: ${{ inputs.arch == 'amd64' }}
runs-on: ubuntu-latest
steps:
- name: "Print parameters"
run: |
echo "All inputs:"
echo "Running with: \
k8s: ${{ inputs.k8sVersion }} \
target: ${{ inputs.target }} \
parallelism: ${{ inputs.parallelism }} \
arch: ${{ inputs.arch }} \
cniNetworkPlugin: ${{ inputs.cniNetworkPlugin }} \
"
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-go@v4
with:
go-version-file: go.mod
- uses: actions/cache@v3
with:
path: |
~/.kuma-dev
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: Install build tools
run: |
command: |
if ! command -v sudo 2>&1 >/dev/null; then
apt update
apt install -y sudo
fi
sudo apt update
sudo env DEBIAN_FRONTEND=noninteractive apt install -y curl git make unzip gcc xz-utils
- name: "Setup Helm"
run: |
make dev/set-kuma-helm-repo
- name: "Extract artifacts"
run: |
echo "Extracting artifacts..."
ARCH='${{ inputs.arch }}'
ARTIFACT=$(find build/distributions/out/kuma-*-linux-$ARCH.tar.gz)
if [[ "$ARTIFACT" == "" ]]; then
echo "Could not find built artifact for linux($ARCH)."
exit 1
fi
cat $ARTIFACT.sha256 | sha256sum --check
mkdir build/distributions/artifacts
tar -xzf $ARTIFACT -C build/distributions/artifacts
SRC_DIR=$(find build/distributions/artifacts/*/bin -type d)
DEST_DIR=build/artifacts-linux-$ARCH
for BIN in $(ls $SRC_DIR); do
mkdir -p $DEST_DIR/$BIN
cp $SRC_DIR/$BIN $DEST_DIR/$BIN/
done
- name: "Run E2E tests"
run: |
if [[ "${{ inputs.k8sVersion }}" == "kindIpv6" ]]; then
export IPV6=true
export K8S_CLUSTER_TOOL=kind
export KUMA_DEFAULT_RETRIES=60
export KUMA_DEFAULT_TIMEOUT="6s"
fi
if [[ "${{ inputs.k8sVersion }}" != "kind"* ]]; then
export CI_K3S_VERSION=${{ inputs.k8sVersion }}
export K3D_NETWORK_CNI=${{ inputs.cniNetworkPlugin }}
fi
if [[ "${{ inputs.arch }}" == "arm64" ]]; then
export MAKE_PARAMETERS="-j1"
else
export MAKE_PARAMETERS="-j2"
fi
if [[ "${{ inputs.legacyKDS }}" == true ]]; then
export KUMA_LEGACY_KDS=true
fi
if [[ "${{ inputs.target }}" == "" ]]; then
export GINKGO_E2E_LABEL_FILTERS="job-$CIRCLE_NODE_INDEX"
fi
env
if [[ "${{ inputs.target }}" != "" ]]; then
target="test/e2e-${{ inputs.target }}"
else
target="test/e2e"
fi
make ${MAKE_PARAMETERS} CI=true "${target}"
e2e_circleci:
if: ${{ inputs.arch != 'amd64' }}
runs-on: ubuntu-latest
steps:
- name: "Print parameters"
Expand Down

0 comments on commit e1fdd97

Please sign in to comment.