Merge pull request #1 from Teamwork/update-ghactions-artifacts-version #2
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: Integration tests | |
on: | |
pull_request: {} | |
push: | |
paths-ignore: | |
- '*.md' | |
- '**/*.md' | |
branches: | |
- main | |
env: | |
GH_ANNOTATION: true | |
DOCKER_BUILDKIT: 1 | |
jobs: | |
docker_build: | |
runs-on: ubuntu-18.04 | |
strategy: | |
matrix: | |
# Keep in sync with release.yaml matrix build | |
target: [proxy, controller, web, cni-plugin, debug, cli-bin, grafana, jaeger-webhook] | |
name: Docker build (${{ matrix.target }}) | |
timeout-minutes: 30 | |
steps: | |
- name: Checkout code | |
# actions/checkout@v2 | |
uses: actions/checkout@722adc6 | |
- name: Set environment variables from scripts | |
run: | | |
. bin/_tag.sh | |
echo "TAG=$(CI_FORCE_CLEAN=1 bin/root-tag)" >> $GITHUB_ENV | |
. bin/_docker.sh | |
echo "DOCKER_REGISTRY=$DOCKER_REGISTRY" >> $GITHUB_ENV | |
echo "DOCKER_BUILDKIT_CACHE=${{ runner.temp }}/.buildx-cache" >> $GITHUB_ENV | |
- name: Cache docker layers | |
# actions/[email protected] | |
uses: actions/cache@b820478 | |
with: | |
path: ${{ env.DOCKER_BUILDKIT_CACHE }} | |
key: ${{ runner.os }}-buildx-${{ matrix.target }}-${{ env.TAG }} | |
restore-keys: | | |
${{ runner.os }}-buildx-${{ matrix.target }}- | |
- name: Build docker images | |
env: | |
DOCKER_TRACE: 1 | |
run: | | |
docker buildx create --driver docker-container --use | |
bin/docker-build-${{ matrix.target }} | |
- name: Prune docker layers cache | |
# changes generate new images while the existing ones don't get removed | |
# so we manually do that to avoid bloating the cache | |
run: bin/docker-cache-prune | |
- name: Create artifact with CLI and image archives | |
env: | |
ARCHIVES: /home/runner/archives | |
run: | | |
mkdir -p $ARCHIVES | |
docker save "$DOCKER_REGISTRY/${{ matrix.target }}:$TAG" > $ARCHIVES/${{ matrix.target }}.tar | |
# save windows cli into artifacts | |
if [ '${{ matrix.target }}' == 'cli-bin' ]; then | |
cp -r ./target/cli/windows/linkerd $ARCHIVES/linkerd-windows.exe | |
fi | |
# `with.path` values do not support environment variables yet, so an | |
# absolute path is used here. | |
# | |
# https://github.com/actions/upload-artifact/issues/8 | |
- name: Upload artifact | |
# actions/upload-artifact@v4 | |
uses: actions/upload-artifact@v4 | |
with: | |
name: image-archives | |
path: /home/runner/archives | |
# todo: Keep in sync with `release.yml` | |
windows_static_cli_tests: | |
name: Static CLI tests (windows) | |
runs-on: windows-latest | |
needs: [docker_build] | |
timeout-minutes: 30 | |
steps: | |
- name: Checkout code | |
# actions/checkout@v2 | |
uses: actions/checkout@722adc6 | |
- name: Try to load cached Go modules | |
# actions/[email protected] | |
uses: actions/cache@70655ec | |
with: | |
path: ~/go/pkg/mod | |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-go- | |
- name: Download image archives | |
# actions/download-artifact@v4 | |
uses: actions/download-artifact@v4 | |
with: | |
name: image-archives | |
- name: Run CLI Integration tests | |
run: | | |
go test --failfast --mod=readonly ".\test\cli" --linkerd=$PWD\image-archives\linkerd-windows.exe --cli-tests -v | |
integration_tests: | |
strategy: | |
matrix: | |
integration_test: | |
- cluster-domain | |
- deep | |
- external-issuer | |
- helm-deep | |
- helm-upgrade | |
- multicluster | |
- uninstall | |
- upgrade-edge | |
- upgrade-stable | |
- cni-calico-deep | |
needs: [docker_build] | |
name: Integration tests (${{ matrix.integration_test }}) | |
runs-on: ubuntu-18.04 | |
timeout-minutes: 30 | |
steps: | |
- name: Checkout code | |
# actions/checkout@v2 | |
uses: actions/checkout@722adc6 | |
- name: Try to load cached Go modules | |
# actions/[email protected] | |
uses: actions/cache@70655ec | |
with: | |
path: ~/go/pkg/mod | |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-go- | |
- name: Set environment variables from scripts | |
run: | | |
. bin/_tag.sh | |
echo "TAG=$(CI_FORCE_CLEAN=1 bin/root-tag)" >> $GITHUB_ENV | |
. bin/_docker.sh | |
echo "DOCKER_REGISTRY=$DOCKER_REGISTRY" >> $GITHUB_ENV | |
- name: Download image archives | |
# actions/download-artifact@v4 | |
uses: actions/download-artifact@v4 | |
with: | |
name: image-archives | |
- name: Load cli-bin image into local docker images | |
run: docker load < image-archives/cli-bin.tar | |
- name: Install CLI | |
run: | | |
# Copy the CLI out of the local cli-bin container. | |
container_id=$(docker create "$DOCKER_REGISTRY/cli-bin:$TAG") | |
docker cp $container_id:/out/linkerd-linux-amd64 "$HOME/.linkerd" | |
# Validate the CLI version matches the current build tag. | |
[[ "$TAG" == "$($HOME/.linkerd version --short --client)" ]] | |
- name: Run integration tests | |
run: | | |
bin/tests --images archive --name ${{ matrix.integration_test }} "$HOME/.linkerd" |