-
Notifications
You must be signed in to change notification settings - Fork 4
115 lines (101 loc) · 3.74 KB
/
test-e2e-cli.yml
File metadata and controls
115 lines (101 loc) · 3.74 KB
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
106
107
108
109
110
111
112
113
114
115
---
name: "E2E Tests: CLI"
on:
workflow_call:
inputs:
version:
type: string
required: false
without-cache:
type: boolean
required: false
default: false
env:
TEST_PARALLELISM: 16
TEST_PARALLELISM_PKG: 1
# Required for aws-actions/configure-aws-credentials using OIDC, assume role
permissions:
id-token: write
contents: read
jobs:
test:
name: ${{ matrix.name }}
strategy:
fail-fast: false
matrix:
include:
- name: linux
os: ubuntu-latest
- name: mac-os
os: macos-latest
- name: windows
os: windows-2022
runs-on: ${{ matrix.os }}
steps:
- name: Setup line endings
run: git config --global core.autocrlf false
- name: Change default TEST_COVERAGE when on main branch
if: github.ref == 'refs/heads/main'
run: echo "TEST_COVERAGE=true" >> $GITHUB_ENV
- name: Checkout
uses: actions/checkout@v6
- name: Setup Go, tools and caching
uses: ./.github/actions/go-setup
with:
build-type: e2e-tests-cli
without-cache: ${{ inputs.without-cache }}
cache-s3-bucket: ${{ vars.CACHE_S3_BUCKET }}
- name: Set TEST_KBC_PROJECTS_FILE entries
uses: ./.github/actions/export-kbc-projects
with:
secrets: ${{ toJSON(secrets) }}
- name: Run tests
shell: bash
env:
VERSION: ${{ inputs.version }}
TEST_KBC_PROJECTS_LOCK_HOST: ${{ vars.TEST_KBC_PROJECTS_LOCK_HOST }}
TEST_KBC_PROJECTS_LOCK_PASSWORD: ${{ secrets.TEST_KBC_PROJECTS_LOCK_PASSWORD }}
TEST_KBC_PROJECTS_FILE: '${{ github.workspace }}/${{ vars.TEST_KBC_PROJECTS_FILE }}'
package-exception-regex: "./internal/pkg/service/appsproxy|./internal/pkg/service/stream|./internal/pkg/service/templates"
run: |
set -eo pipefail
if [ "$RUNNER_OS" == "Windows" ]; then
export TEST_BINARY_CLI="${{ runner.temp }}\test-build-cli.exe"
else
export TEST_BINARY_CLI="${{ runner.temp }}/test-build-cli"
fi
# Prevent linker warnings on macOs (https://github.com/golang/go/issues/61229# issuecomment-1988965927)
if [ "$RUNNER_OS" == "macOS" ]; then
export GOFLAGS="-ldflags=-extldflags=-Wl,-ld_classic"
fi
# Build binary for test without external inputs
env -i \
TERM="$TERM" \
HOME="$HOME" \
PATH="$PATH" \
GOFLAGS="$GOFLAGS" \
APPDATA="$APPDATA" \
BUILD_TARGET_PATH="$TEST_BINARY_CLI" \
CLI_BUILD_DATE="-" \
CLI_BUILD_GIT_COMMIT="-" \
task build-local
touch -d '1970-01-01T00:00:01' "$TEST_BINARY_CLI"
# Calculate binary hash, it invalidates tests cache
export TEST_BINARY_CLI_HASH=`cat "$TEST_BINARY_CLI" | $MD5_COMMAND | cut -d " " -f1`
echo "Binary hash: $TEST_BINARY_CLI_HASH"
# ENVs can affect test caching, make sure to only run tests with expected ENVs
env -i \
TERM="$TERM" \
HOME="$HOME" \
PATH="$PATH" \
APPDATA="$APPDATA" \
TEST_BINARY_CLI="$TEST_BINARY_CLI" \
TEST_BINARY_CLI_HASH="$TEST_BINARY_CLI_HASH" \
TEST_PARALLELISM="$TEST_PARALLELISM" \
TEST_PARALLELISM_PKG="$TEST_PARALLELISM_PKG" \
TEST_COVERAGE="false" \
TEST_CREATE_OUT_DIR="false" \
TEST_KBC_PROJECTS_LOCK_HOST="$TEST_KBC_PROJECTS_LOCK_HOST" \
TEST_KBC_PROJECTS_LOCK_PASSWORD="$TEST_KBC_PROJECTS_LOCK_PASSWORD" \
TEST_KBC_PROJECTS_FILE="$TEST_KBC_PROJECTS_FILE" \
task tests-cli