-
Notifications
You must be signed in to change notification settings - Fork 4
Test CI package update #72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
87a69c0 to
8f3cdf2
Compare
8f3cdf2 to
4acce61
Compare
726ecbb to
d80dab8
Compare
d80dab8 to
7442c09
Compare
| 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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we remove this?
| NEW_PACKAGE: | ||
| sh: ls -1 ./build/arduino-app-cli_*.deb 2>/dev/null | head -n 1 | ||
| GITHUB_TOKEN_FILE: ./github_token.txt |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are you using those?
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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 | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| 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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| 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") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't this just
| 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
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: