-
Notifications
You must be signed in to change notification settings - Fork 16
105 lines (104 loc) · 3.58 KB
/
integration_tests.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
name: Integration tests
on:
pull_request:
paths-ignore:
- '*.md'
- '**/*.md'
push:
paths-ignore:
- '*.md'
- '**/*.md'
branches:
- main
permissions:
contents: read
env:
GH_ANNOTATION: true
jobs:
docker_build:
runs-on: ubuntu-20.04
name: Build SMI Extension
timeout-minutes: 30
steps:
- name: Checkout code
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab
- name: Set environment variables from scripts
run: |
. bin/_tag.sh
echo "TAG=$(CI_FORCE_CLEAN=1 bin/root-tag)" >> $GITHUB_ENV
echo "DOCKER_BUILDKIT_CACHE=${{ runner.temp }}/.buildx-cache" >> $GITHUB_ENV
- name: Cache docker layers
uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84
with:
path: ${{ env.DOCKER_BUILDKIT_CACHE }}
key: ${{ runner.os }}-buildx-smi-${{ env.TAG }}
restore-keys: |
${{ runner.os }}-buildx-smi-
- name: Build SMI docker image
run: |
docker buildx create --driver docker-container --use
bin/docker-build
- name: Build SMI CLI
run: bin/build-cli-bin
- name: Create artifact with CLI and image archives
env:
ARCHIVES: /home/runner/archives
run: |
mkdir -p $ARCHIVES
docker save "cr.l5d.io/linkerd/smi-adaptor:$TAG" > $ARCHIVES/smi-adaptor.tar
cp target/cli/linkerd-smi-linux-amd64 $ARCHIVES
- name: Upload artifact
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce
with:
name: build-archives
path: /home/runner/archives
integration_tests:
needs: [docker_build]
runs-on: ubuntu-20.04
timeout-minutes: 60
name: Integration tests
strategy:
matrix:
test: [helm, cli]
steps:
- name: Checkout code
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab
- name: Set environment variables from scripts
run: |
echo "TAG=$(CI_FORCE_CLEAN=1 bin/root-tag)" >> $GITHUB_ENV
- name: Try to load cached Go modules
uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Download image archives
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a
with:
name: build-archives
path: build-archives
- name: Create k8s Kind Cluster
uses: engineerd/[email protected]
with:
version: "v0.11.1"
- name: Load the SMI extension CLI and Images
run: |
mkdir -p $HOME/.linkerd2/bin
echo "$HOME/.linkerd2/bin" >> $GITHUB_PATH
mv build-archives/linkerd-smi-linux-amd64 "$HOME/.linkerd2/bin/linkerd-smi"
chmod +x $HOME/.linkerd2/bin/linkerd-smi
# load image into the cluster
kind load image-archive build-archives/smi-adaptor.tar
- name: Install the Linkerd CLI
run : |
curl -sL https://run.linkerd.io/install-edge | sh
- name: Run Helm Integration Tests
if: ${{ matrix.test == 'helm' }}
run: |
projectdir=$(pwd)
GO111MODULE=on go test --failfast --mod=readonly "./test" --linkerd="$HOME/.linkerd2/bin/linkerd" --helm-path="$projectdir/bin/helm" --smi-helm-chart="$projectdir/charts/linkerd-smi" --smi-helm-version="$TAG" --integration-tests
- name: Run CLI Integration Tests
if: ${{ matrix.test == 'cli' }}
run: |
GO111MODULE=on go test --failfast --mod=readonly "./test" --linkerd="$HOME/.linkerd2/bin/linkerd" --integration-tests