Skip to content

Conversation

@giulio93
Copy link
Contributor

@giulio93 giulio93 commented Nov 12, 2025

Motivation

This PR implement point 3 and 4 of this issue https://github.com/arduino/private-tooling-team/issues/349

Here we implement a Github CI to test the update package in two way:

  • using the arduino-app-cli system update command
  • running the daemon and using the PUT endpoint to apply the update

@giulio93 giulio93 force-pushed the test_package_update_rebase branch 4 times, most recently from 87a69c0 to 8f3cdf2 Compare November 13, 2025 08:43
@giulio93 giulio93 mentioned this pull request Nov 13, 2025
5 tasks
@giulio93 giulio93 changed the title Test package update rebase Test CI package update Nov 13, 2025
@giulio93 giulio93 force-pushed the test_package_update_rebase branch from 8f3cdf2 to 4acce61 Compare November 13, 2025 09:09
@giulio93 giulio93 force-pushed the test_package_update_rebase branch 2 times, most recently from 726ecbb to d80dab8 Compare November 13, 2025 09:29
@giulio93 giulio93 marked this pull request as ready for review November 13, 2025 09:29
@giulio93 giulio93 force-pushed the test_package_update_rebase branch from d80dab8 to 7442c09 Compare November 13, 2025 10:52
Comment on lines +130 to +166
build-image:
desc: "Builds the mock-repo Docker image (requires GITHUB_TOKEN_FILE)"
deps: [build-deb]
vars:
PKG_PATH: "{{.NEW_PACKAGE}}"
cmds:
# --- MODIFIED ---
# Check for both the package and the token file
- |
if [ ! -f "{{.GITHUB_TOKEN_FILE}}" ]; then
echo "Error: GitHub token file not found at {{.GITHUB_TOKEN_FILE}}"
echo "Please create this file and add your GitHub PAT to it."
exit 1
fi
- |
echo "Using package: {{.PKG_PATH}}"
echo "Using GitHub token from: {{.GITHUB_TOKEN_FILE}}"
# Enable BuildKit and pass the secret
DOCKER_BUILDKIT=1 docker build \
--secret id=github_token,src={{.GITHUB_TOKEN_FILE}} \
--build-arg NEW_PACKAGE_PATH={{.PKG_PATH}} \
-t newdeb \
-f test.Dockerfile .
status:
- '[[ -f "{{.PKG_PATH}}" ]]'
- '[[ -f "{{.DOCKERFILE_NAME}}" ]]'
# Re-build if token file changes
- '[[ -f "{{.GITHUB_TOKEN_FILE}}" ]]'

test-deb:
desc: Test the debian package locally
deps:
- build-deb
cmds:
- docker build --no-cache -t mock-apt-repo -f test.Dockerfile .
- docker run --rm -it --privileged -v /sys/fs/cgroup:/sys/fs/cgroup:ro --name apt-test-update mock-apt-repo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we remove this?

Comment on lines +15 to +17
NEW_PACKAGE:
sh: ls -1 ./build/arduino-app-cli_*.deb 2>/dev/null | head -n 1
GITHUB_TOKEN_FILE: ./github_token.txt
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are you using those?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no right

- go build ./cmd/arduino-app-cli # needed for e2e tests
- task: generate
- go test ./internal/... ./cmd/... -v -race {{ .CLI_ARGS }}
- go test $(go list ./internal/... ./cmd/... | grep -v internal/e2e/updatetest) -v -race {{ .CLI_ARGS }} # exclude deb package update tests
Copy link
Contributor

@lucarin91 lucarin91 Nov 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would propose this instead

  test:internal:
    cmds:
      - go build ./cmd/arduino-app-cli
      - task: generate
      - go test $(go list ./internal/... ./cmd/... | grep -v internal/e2e/updatetest) -v -race {{ .CLI_ARGS }} 

  test:update:
    cmds:
      - go test --timeout 30m -v ./internal/e2e/updatetest

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can remove this file

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you rename the file to update_test.go

@@ -0,0 +1,31 @@
name: Build & Update with Arduino CLI
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
name: Build & Update with Arduino CLI
name: test the system update flow

env:
GH_TOKEN: ${{ secrets.ARDUINOBOT_TOKEN }}
run: |
go test -count=1 --timeout 30m -v ./internal/e2e/updatetest -- --arch amd64
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
go test -count=1 --timeout 30m -v ./internal/e2e/updatetest -- --arch amd64
go tool task test:update

"github.com/stretchr/testify/require"
)

var arch = flag.String("arch", "amd64", "target architecture")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this just

Suggested change
var arch = flag.String("arch", "amd64", "target architecture")
var arch = runtime.GOARCH

I would expect that you want to install/build the artifact with the same architecture of the current machine

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants