Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitcbec0b3

Browse files
committed
using a go script to test update
1 parentf97fdf1 commitcbec0b3

File tree

5 files changed

+331
-90
lines changed

5 files changed

+331
-90
lines changed

‎.github/workflows/test-update.yml‎

Lines changed: 5 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,11 @@ on:
1010
permissions:
1111
contents:read
1212

13+
1314
jobs:
1415
build-and-update:
1516
runs-on:ubuntu-22.04
1617

17-
env:
18-
TAG_VERSION:"v0.6.7"
19-
ARCH:amd64
20-
APPCLI_REPO:arduino/arduino-app-cli
21-
ROUTER_REPO:arduino/arduino-router
22-
23-
APPCLI_TAG:""
24-
APPCLI_REGEX:"amd64\\.deb$"
25-
26-
ROUTER_TAG:""
27-
ROUTER_REGEX:"amd64\\.deb$"
28-
2918
steps:
3019
-name:Checkout
3120
uses:actions/checkout@v4
@@ -35,81 +24,9 @@ jobs:
3524
with:
3625
go-version-file:go.mod
3726

38-
-name:Build deb
39-
run:|
40-
go tool task build-deb VERSION=${TAG_VERSION} ARCH=${ARCH}
41-
42-
-name:Fetch .debs dynamically into build/stable
27+
-name:Run dep package update test
4328
env:
44-
GH_TOKEN:${{ secrets.GITHUB_TOKEN }}
45-
run:|
46-
set -euo pipefail
47-
mkdir -p build/stable
48-
49-
fetch_deb () {
50-
local repo="$1" tag="${2:-}" regex="$3"
51-
52-
echo "==> Resolving release for ${repo} (tag='${tag:-<latest>}')"
53-
if [ -n "${tag}" ]; then
54-
url="https://api.github.com/repos/${repo}/releases/tags/${tag}"
55-
else
56-
url="https://api.github.com/repos/${repo}/releases/latest"
57-
fi
58-
59-
rel="$(curl -sfL -H "Authorization: token ${GH_TOKEN}" -H "Accept: application/vnd.github+json" "${url}")"
60-
61-
name="$(echo "$rel" | jq -r --arg re "${regex}" '.assets[] | select(.name | test($re)) | .name' | head -n1)"
62-
dl="$(echo "$rel" | jq -r --arg re "${regex}" '.assets[] | select(.name | test($re)) | .browser_download_url' | head -n1)"
63-
64-
if [ -z "${name}" ] || [ "${name}" = "null" ] || [ -z "${dl}" ] || [ "${dl}" = "null" ]; then
65-
echo "!! No asset found in ${repo} matching regex: ${regex}"
66-
echo " Available assets:"
67-
echo "$rel" | jq -r '.assets[].name'
68-
exit 1
69-
fi
70-
71-
echo "Found: ${name}"
72-
echo "Downloading: ${dl}"
73-
74-
curl -sfL -H "Authorization: token ${GH_TOKEN}" \
75-
-o "build/stable/${name}" \
76-
"${dl}"
77-
78-
ls -lh "build/stable/${name}"
79-
}
80-
81-
fetch_deb "${APPCLI_REPO}" "${APPCLI_TAG}" "${APPCLI_REGEX}"
82-
fetch_deb "${ROUTER_REPO}" "${ROUTER_TAG}" "${ROUTER_REGEX}"
83-
84-
echo "✅ Downloaded files:"
85-
ls -lh build/stable/
86-
ls -lh build/
87-
88-
-name:Build Docker image (no cache)
89-
run:|
90-
docker build -t mock-apt-repo -f test.Dockerfile .
91-
92-
-name:Run mock-apt-repo container
93-
run:|
94-
docker run --rm -d \
95-
--privileged \
96-
--cgroupns=host \
97-
-v /sys/fs/cgroup:/sys/fs/cgroup:rw \
98-
-v /var/run/docker.sock:/var/run/docker.sock \
99-
-e DOCKER_HOST=unix:///var/run/docker.sock \
100-
--name apt-test-update \
101-
mock-apt-repo
102-
103-
-name:Run arduino-app-cli current version
104-
run:|
105-
docker exec --user arduino apt-test-update arduino-app-cli version
106-
107-
-name:Run arduino-app-cli with auto-yes (as arduino)
108-
run:|
109-
mkdir -p artifacts
110-
docker exec apt-test-update sh -lc 'su - arduino -c "yes | arduino-app-cli system update"' \
111-
| tee artifacts/arduino-system-update.log
112-
113-
-name:Run arduino-app-cli version updated
29+
GH_TOKEN:${{ secrets.ARDUINOBOT_TOKEN }}
11430
run:|
115-
docker exec --user arduino apt-test-update arduino-app-cli version<
31+
cd internal/testtools
32+
go test -v ./deb_test.go --arch amd64

‎Taskfile.yml‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,10 @@ tasks:
105105
deps:
106106
-build-deb:clone-examples
107107
cmds:
108-
-docker build --build-arg BINARY_NAME=arduino-app-cli --build-arg DEB_NAME=arduino-app-cli --build-arg VERSION={{ .VERSION }} --build-arg ARCH={{ .ARCH }} --build-arg RELEASE={{ .RELEASE }} --output=./build -f debian/Dockerfile .
108+
-docker build --build-arg BINARY_NAME=arduino-app-cli --build-arg DEB_NAME=arduino-app-cli --build-arg VERSION={{ .VERSION }} --build-arg ARCH={{ .ARCH }} --build-arg RELEASE={{ .RELEASE }} --output={{ .OUTPUT }} -f debian/Dockerfile .
109109
vars:
110110
ARCH:'{{.ARCH | default "arm64"}}'
111+
OUTPUT:'{{.OUTPUT | default "./build"}}'
111112

112113
build-deb:clone-examples:
113114
desc:"Clones the examples repo directly into the debian structure"

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp