-
Notifications
You must be signed in to change notification settings - Fork 17
105 lines (104 loc) · 3.6 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@b4ffde65f46336ab88eb53be808477a3936bae11
- 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@13aacd865c20de90d75de3b17ebe84f7a17d57d2
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@5d5d22a31266ced268874388b861e4b58bb5c2f3
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@b4ffde65f46336ab88eb53be808477a3936bae11
- 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@13aacd865c20de90d75de3b17ebe84f7a17d57d2
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@eaceaf801fd36c7dee90939fad912460b18a1ffe
with:
name: build-archives
path: build-archives
- name: Create k8s Kind Cluster
uses: helm/kind-action@dda0770415bac9fc20092cacbc54aa298604d140
with:
cluster_name: kind
- 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