-
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
Open
giulio93
wants to merge
20
commits into
main
Choose a base branch
from
test_package_update_rebase
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+525
−3
Open
Changes from 17 commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
6a5ca62
test .deb update
292418c
task test
4b11bbc
dind
b3abcc5
taskfile udpate
ede3f90
using a go script to test update
giulio93 56c4338
no parameters
giulio93 8d5678b
define arch
giulio93 24bce6a
unstable test
giulio93 b2ed968
delete major
giulio93 a6de7b3
Client test
giulio93 7719bf3
Client test
giulio93 c504ca6
using a helper file
giulio93 37b71dc
using run
giulio93 380c48c
path in the building
giulio93 fb890be
test rebase
giulio93 d359c2f
this is sedia refactor
giulio93 7442c09
exclude updatetest folder
giulio93 fc04741
remove unused task
giulio93 b26d393
runtime arch
giulio93 8931a71
format
giulio93 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,31 @@ | ||||||
| name: Build & Update with Arduino CLI | ||||||
|
|
||||||
| on: | ||||||
| push: | ||||||
| branches: | ||||||
| - main | ||||||
| - test_package_update | ||||||
| - test_package_update_rebase | ||||||
|
Comment on lines
+7
to
+8
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remember to remove those
Suggested change
|
||||||
| workflow_dispatch: | ||||||
|
|
||||||
| permissions: | ||||||
| contents: read | ||||||
|
|
||||||
| jobs: | ||||||
| build-and-update: | ||||||
| runs-on: ubuntu-22.04 | ||||||
|
|
||||||
| steps: | ||||||
| - name: Checkout | ||||||
| uses: actions/checkout@v4 | ||||||
|
|
||||||
| - name: Set up Go | ||||||
| uses: actions/setup-go@v5 | ||||||
| with: | ||||||
| go-version-file: go.mod | ||||||
|
|
||||||
| - name: Run dep package update test | ||||||
| env: | ||||||
| GH_TOKEN: ${{ secrets.ARDUINOBOT_TOKEN }} | ||||||
|
Comment on lines
+28
to
+29
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think you are using this
Suggested change
|
||||||
| run: | | ||||||
| go test -count=1 --timeout 30m -v ./internal/e2e/updatetest -- --arch amd64 | ||||||
giulio93 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,122 @@ | ||
| package updatetest | ||
|
|
||
| import ( | ||
| "flag" | ||
| "fmt" | ||
| "os" | ||
| "testing" | ||
| "time" | ||
|
|
||
| "github.com/stretchr/testify/require" | ||
| ) | ||
|
|
||
| var arch = flag.String("arch", "amd64", "target architecture") | ||
|
|
||
| const dockerFile = "test.Dockerfile" | ||
| const daemonHost = "127.0.0.1:8800" | ||
|
|
||
| func TestUpdatePackage(t *testing.T) { | ||
| fmt.Printf("***** ARCH %s ***** \n", *arch) | ||
|
|
||
| t.Run("Stable To Current", func(t *testing.T) { | ||
| t.Cleanup(func() { os.RemoveAll("build") }) | ||
|
|
||
| tagAppCli := fetchDebPackageLatest(t, "build/stable", "arduino-app-cli") | ||
| fetchDebPackageLatest(t, "build/stable", "arduino-router") | ||
| majorTag := genMajorTag(t, tagAppCli) | ||
|
|
||
| fmt.Printf("Updating from stable version %s to unstable version %s \n", tagAppCli, majorTag) | ||
| fmt.Printf("Building local deb version %s \n", majorTag) | ||
| buildDebVersion(t, "build", majorTag, *arch) | ||
|
|
||
| const dockerImageName = "apt-test-update-image" | ||
| fmt.Println("**** BUILD docker image *****") | ||
| buildDockerImage(t, dockerFile, dockerImageName, *arch) | ||
| //TODO: t cleanup remove docker image | ||
|
|
||
| t.Run("CLI Command", func(t *testing.T) { | ||
| const containerName = "apt-test-update" | ||
| t.Cleanup(func() { stopDockerContainer(t, containerName) }) | ||
|
|
||
| fmt.Println("**** RUN docker image *****") | ||
| startDockerContainer(t, containerName, dockerImageName) | ||
| waitForPort(t, daemonHost, 5*time.Second) | ||
|
|
||
| preUpdateVersion := getAppCliVersion(t, containerName) | ||
| require.Equal(t, "v"+preUpdateVersion, tagAppCli) | ||
| runSystemUpdate(t, containerName) | ||
| postUpdateVersion := getAppCliVersion(t, containerName) | ||
| require.Equal(t, "v"+postUpdateVersion, majorTag) | ||
| }) | ||
|
|
||
| t.Run("HTTP Request", func(t *testing.T) { | ||
| const containerName = "apt-test-update-http" | ||
| t.Cleanup(func() { stopDockerContainer(t, containerName) }) | ||
|
|
||
| startDockerContainer(t, containerName, dockerImageName) | ||
| waitForPort(t, daemonHost, 5*time.Second) | ||
|
|
||
| preUpdateVersion := getAppCliVersion(t, containerName) | ||
| require.Equal(t, "v"+preUpdateVersion, tagAppCli) | ||
|
|
||
| putUpdateRequest(t, daemonHost) | ||
| waitForUpgrade(t, daemonHost) | ||
|
|
||
| postUpdateVersion := getAppCliVersion(t, containerName) | ||
| require.Equal(t, "v"+postUpdateVersion, majorTag) | ||
| }) | ||
|
|
||
| }) | ||
|
|
||
| t.Run("CurrentToStable", func(t *testing.T) { | ||
| t.Cleanup(func() { os.RemoveAll("build") }) | ||
|
|
||
| tagAppCli := fetchDebPackageLatest(t, "build", "arduino-app-cli") | ||
| fetchDebPackageLatest(t, "build/stable", "arduino-router") | ||
| minorTag := genMinorTag(t, tagAppCli) | ||
|
|
||
| fmt.Printf("Updating from unstable version %s to stable version %s \n", minorTag, tagAppCli) | ||
| fmt.Printf("Building local deb version %s \n", minorTag) | ||
| buildDebVersion(t, "build/stable", minorTag, *arch) | ||
|
|
||
| fmt.Println("**** BUILD docker image *****") | ||
| const dockerImageName = "test-apt-update-unstable-image" | ||
|
|
||
| buildDockerImage(t, dockerFile, dockerImageName, *arch) | ||
| //TODO: t cleanup remove docker image | ||
|
|
||
| t.Run("CLI Command", func(t *testing.T) { | ||
| const containerName = "apt-test-update-unstable" | ||
| t.Cleanup(func() { stopDockerContainer(t, containerName) }) | ||
|
|
||
| fmt.Println("**** RUN docker image *****") | ||
| startDockerContainer(t, containerName, dockerImageName) | ||
| waitForPort(t, daemonHost, 5*time.Second) | ||
|
|
||
| preUpdateVersion := getAppCliVersion(t, containerName) | ||
| require.Equal(t, "v"+preUpdateVersion, minorTag) | ||
| runSystemUpdate(t, containerName) | ||
| postUpdateVersion := getAppCliVersion(t, containerName) | ||
| require.Equal(t, "v"+postUpdateVersion, tagAppCli) | ||
| }) | ||
|
|
||
| t.Run("HTTP Request", func(t *testing.T) { | ||
| const containerName = "apt-test-update--unstable-http" | ||
| t.Cleanup(func() { stopDockerContainer(t, containerName) }) | ||
|
|
||
| startDockerContainer(t, containerName, dockerImageName) | ||
| waitForPort(t, daemonHost, 5*time.Second) | ||
|
|
||
| preUpdateVersion := getAppCliVersion(t, containerName) | ||
| require.Equal(t, "v"+preUpdateVersion, minorTag) | ||
|
|
||
| putUpdateRequest(t, daemonHost) | ||
| waitForUpgrade(t, daemonHost) | ||
|
|
||
| postUpdateVersion := getAppCliVersion(t, containerName) | ||
| require.Equal(t, "v"+postUpdateVersion, tagAppCli) | ||
| }) | ||
|
|
||
| }) | ||
|
|
||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.