Repository navigation
193 lines (188 loc) · 8.11 KB
/
Copy pathci.yml
File metadata and controls
193 lines (188 loc) · 8.11 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
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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
# Tests only: nothing here tags, releases or publishes, and no job gets a
# secret or a write token. Pull requests from forks run after the maintainer
# approves the run (repository setting, see RELEASING.md). release.yml calls
# this workflow on the release commit before it publishes.
name: ci
on:
pull_request:
push:
branches: [master]
schedule:
- cron: "17 3 * * *" # nightly: long fuzzing only
workflow_call:
inputs:
ref:
description: "Commit to test"
required: true
type: string
permissions:
contents: read
concurrency:
# github.workflow is "release" when called from release.yml: its own group.
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
defaults:
run:
shell: bash # -eo pipefail; the Windows jobs set pwsh
env:
GO_VERSION: "1.27.3"
DOCKER_VERSION: "29.9.3"
jobs:
# Unit, old-daemon and CLI tests, fuzz smoke, then the round-trip and
# compat suites against the pinned Docker Engine.
linux:
if: github.event_name != 'schedule'
strategy:
fail-fast: false
matrix:
os: [ubuntu-24.04, ubuntu-24.04-arm]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ inputs.ref }}
fetch-depth: 0 # git describe for the version
persist-credentials: false
- uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version: ${{ env.GO_VERSION }}
- run: .github/scripts/posix-shells.sh
- run: make lint
# No DOCKER_HOST yet: the live suites skip here and run below.
- run: go test -count=1 ./...
- run: make fuzz FUZZTIME=20s
- run: make cross
- if: matrix.os == 'ubuntu-24.04'
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: dist
path: dist/
- name: Install Docker Engine ${{ env.DOCKER_VERSION }} (the runner ships another one)
run: |
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu $(. /etc/os-release && echo "$VERSION_CODENAME") stable" \
| sudo tee /etc/apt/sources.list.d/docker.list >/dev/null
sudo apt-get update -q
v="5:${DOCKER_VERSION}-1~ubuntu.$(. /etc/os-release && echo "${VERSION_ID}~${VERSION_CODENAME}")"
sudo apt-get install -y -q --allow-downgrades "docker-ce=$v" "docker-ce-cli=$v" containerd.io docker-buildx-plugin
sudo systemctl restart docker
test "$(docker version --format '{{.Server.Version}} {{.Client.Version}}')" = "$DOCKER_VERSION $DOCKER_VERSION"
- name: Round-trip suite
env:
DOCKER_HOST: unix:///var/run/docker.sock
run: go test -count=1 -timeout 30m ./test/roundtrip/
- name: Compat suite (binary and image)
env:
DOCKER_HOST: unix:///var/run/docker.sock
run: |
make build
docker build --progress=plain --build-arg VERSION="$(git describe --tags --always)" -t runlike-local:dev .
RUNLIKE_BIN="$PWD/build/runlike" RUNLIKE_IMAGE=runlike-local:dev go test -count=1 ./test/compat/
# The .debs from make cross, and a repository signed with a
# throwaway key, installed in debian:stable and ubuntu:24.04.
# Skipped on older commits without the test (a republish of v2.0.0).
- name: apt packages and repository
if: hashFiles('test/apt/test.sh') != ''
env:
DOCKER_HOST: unix:///var/run/docker.sock
run: test/apt/test.sh dist
# Windows containers on Docker Engine 29.9.3: the Windows round trip, and
# the PowerShell and cmd quoting in the real shells (fuzz and live).
windows:
if: github.event_name != 'schedule'
runs-on: windows-2022
defaults:
run:
shell: pwsh
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ inputs.ref }}
persist-credentials: false
- uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version: ${{ env.GO_VERSION }}
# The static binaries from download.docker.com, as on the test VM.
- name: Install Docker Engine ${{ env.DOCKER_VERSION }} over the runner's
run: |
$dir = Split-Path (Get-Command dockerd).Source
Invoke-WebRequest -UseBasicParsing "https://download.docker.com/win/static/stable/x86_64/docker-$env:DOCKER_VERSION.zip" -OutFile docker.zip
Expand-Archive docker.zip $env:RUNNER_TEMP
Stop-Service docker
Copy-Item "$env:RUNNER_TEMP\docker\docker.exe", "$env:RUNNER_TEMP\docker\dockerd.exe" $dir -Force
Start-Service docker
$v = docker version --format '{{.Server.Version}} {{.Client.Version}}'
if ($v -ne "$env:DOCKER_VERSION $env:DOCKER_VERSION") { throw "docker is $v" }
docker pull -q mcr.microsoft.com/windows/nanoserver:ltsc2022
# Warm up: the first container create on a fresh runner is the slowest.
docker run --rm --isolation process mcr.microsoft.com/windows/nanoserver:ltsc2022 cmd /c ver
- run: go vet ./...
- name: go test ./... (round trip, live shells, quoting fuzz)
run: |
$env:CGO_ENABLED = "0"
go build -o runlike.exe ./cmd/runlike
$env:RUNLIKE_EXE = "$PWD\runlike.exe"
$env:DOCKER_HOST = "npipe:////./pipe/docker_engine"
# -p 1: one package at a time, so the root package's Windows shell
# tests and the round trip do not create containers concurrently;
# the runner's daemon drops the connection when a create stalls.
go test -count=1 -timeout 90m -p 1 -parallel 1 ./...
windows-arm:
if: github.event_name != 'schedule'
runs-on: windows-11-arm
defaults:
run:
shell: pwsh
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ inputs.ref }}
persist-credentials: false
- uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version: ${{ env.GO_VERSION }}
- run: go build -o runlike.exe ./cmd/runlike
- run: go vet ./...
# No daemon: unit tests and the quoting fuzz in pwsh, Windows PowerShell and cmd.
- run: go test -count=1 -timeout 30m ./...
macos:
if: github.event_name != 'schedule'
runs-on: macos-15
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ inputs.ref }}
fetch-depth: 0
persist-credentials: false
- uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version: ${{ env.GO_VERSION }}
- run: make build
# Unit and CLI tests; TestLocalesExist checks bash 3.2, zsh, dash and the EUC locales.
- run: make test
- run: go test -run '^$' -fuzz '^FuzzFormatPosix$' -fuzztime 30s .
# Nightly: long fuzzing of the quoting on each shell family.
fuzz-nightly:
if: github.event_name == 'schedule'
strategy:
fail-fast: false
matrix:
os: [ubuntu-24.04, macos-15, windows-2022]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version: ${{ env.GO_VERSION }}
- if: runner.os == 'Linux'
run: .github/scripts/posix-shells.sh && make fuzz FUZZTIME=15m
- if: runner.os == 'macOS'
run: go test -run '^$' -fuzz '^FuzzFormatPosix$' -fuzztime 15m .
- if: runner.os == 'Windows'
shell: pwsh
run: |
$env:RUNLIKE_SHELL_N = "3000"
go test -count=1 -timeout 90m -run TestWindowsShellsFuzz .