forked from rancher-sandbox/rancher-desktop
-
Notifications
You must be signed in to change notification settings - Fork 0
150 lines (142 loc) · 4.91 KB
/
smoke-test.yaml
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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
# This workflow downloads artifacts from a (by default, draft) release and runs
# a short smoke test where the application is installed and run and immediately
# shut down.
# Since we need contents-write permissions to look at draft releases, we
# actually download the artifacts in a smaller job, then upload them into the
# run and download it _again_ in the second (per-platform) job where no
# permissions are required.
name: Release smoke test
permissions: {}
on:
workflow_dispatch:
inputs:
tag:
description: >
Download artifacts from release with this tag, rather than picking the
first draft release.
type: string
jobs:
download-artifacts:
name: Find release
runs-on: ubuntu-latest
permissions:
contents: write # Needed to list draft releases
env:
RELEASE_TAG: ${{ inputs.tag }}
steps:
- name: Find release
if: inputs.tag == ''
run: >-
set -o xtrace;
printf "RELEASE_TAG=%s\n" >>"$GITHUB_ENV"
"$(gh api repos/${{ github.repository }}/releases
--jq 'map(select(.draft))[0].tag_name')"
env:
GH_TOKEN: ${{ github.token }}
- name: Download artifacts
run: |
if [[ -z "$RELEASE_TAG" ]]; then
echo "Failed to find release tag" >&2
exit 1
fi
gh release download "$RELEASE_TAG" \
--repo ${{ github.repository }} \
--pattern '*.dmg' \
--pattern '*.dmg.sha512sum' \
--pattern '*.msi' \
--pattern '*.msi.sha512sum' \
--pattern 'rancher-desktop-linux-*.zip' \
--pattern 'rancher-desktop-linux-*.zip.sha512sum'
env:
GH_TOKEN: ${{ github.token }}
- name: Upload macOS aarch-64 artifacts
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
with:
name: application-macos-aarch64.zip
if-no-files-found: error
path: |
*.aarch64.dmg
*.aarch64.dmg.sha512sum
- name: Upload macOS x86_64 artifacts
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
with:
name: application-macos-x86_64.zip
if-no-files-found: error
path: |
*.x86_64.dmg
*.x86_64.dmg.sha512sum
- name: Upload Windows artifacts
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
with:
name: application-win32.zip
if-no-files-found: error
path: |
*.msi
*.msi.sha512sum
- name: Upload Linux artifacts
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
with:
name: application-linux.zip
if-no-files-found: error
path: |
rancher-desktop-linux-*.zip
rancher-desktop-linux-*.zip.sha512sum
smoke-test:
name: Smoke test
needs: download-artifacts
strategy:
fail-fast: false
matrix:
include:
- { platform: macos-aarch64, runs-on: macos-14 }
- { platform: macos-x86_64, runs-on: macos-13 }
- { platform: win32, runs-on: windows-latest }
- { platform: linux, runs-on: ubuntu-latest }
runs-on: ${{ matrix.runs-on }}
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false
- name: Set up environment
uses: ./.github/actions/setup-environment
- name: "Linux: Set startup command"
if: runner.os == 'Linux'
run: echo "EXEC_COMMAND=$EXEC_COMMAND" >> "$GITHUB_ENV"
env:
EXEC_COMMAND: >-
exec xvfb-run --auto-servernum
--server-args='-screen 0 1280x960x24'
- name: "Windows: Install yq"
if: runner.os == 'Windows'
run: |
set -o xtrace
bindir="$HOME/bin"
if [[ ! "$PATH" =~ "$bindir" ]]; then
bindir=/usr/bin
fi
if ! command -v yq; then
mkdir -p "$bindir"
curl --location --output "$bindir/yq.exe" \
https://github.com/mikefarah/yq/releases/download/v4.43.1/yq_windows_amd64.exe
chmod a+x "$bindir/yq.exe"
fi
shell: bash
- name: Set log directory
shell: bash
# Use node here to do path manipulation to get correct Windows paths.
run: >-
node --eval='console.log("RD_LOGS_DIR=" + require("path").join(process.cwd(), "logs"));'
>> "$GITHUB_ENV"
- name: Download artifacts
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: application-${{ matrix.platform }}.zip
- run: ${{ env.EXEC_COMMAND }} .github/workflows/smoke-test/smoke-test.sh
shell: bash
- name: Upload logs
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
if: always()
with:
name: logs-${{ matrix.platform }}.zip
path: ${{ github.workspace }}/logs
if-no-files-found: warn