|
12 | 12 | RUNNER_VERSION: "0.5.0" |
13 | 13 | VERSION: # if version is not passed we hack the semver by encoding the commit as pre-release |
14 | 14 | sh: echo "${VERSION:-0.0.0-$(git rev-parse --short HEAD)}" |
15 | | - NEW_PACKAGE: |
16 | | - sh: ls -1 ./build/arduino-app-cli_*.deb 2>/dev/null | head -n 1 |
17 | | - GITHUB_TOKEN_FILE: ./github_token.txt |
18 | 15 |
|
19 | 16 | tasks: |
20 | 17 | init: |
@@ -53,9 +50,13 @@ tasks: |
53 | 50 |
|
54 | 51 | test:internal: |
55 | 52 | cmds: |
56 | | - - go build ./cmd/arduino-app-cli # needed for e2e tests |
| 53 | + - go build ./cmd/arduino-app-cli |
57 | 54 | - task: generate |
58 | | - - go test $(go list ./internal/... ./cmd/... | grep -v internal/e2e/updatetest) -v -race {{ .CLI_ARGS }} # exclude deb package update tests |
| 55 | + - go test $(go list ./internal/... ./cmd/... | grep -v internal/e2e/updatetest) -v -race {{ .CLI_ARGS }} |
| 56 | + |
| 57 | + test:update: |
| 58 | + cmds: |
| 59 | + - go test --timeout 30m -v ./internal/e2e/updatetest |
59 | 60 |
|
60 | 61 | test:pkg: |
61 | 62 | desc: Run only tests in the pkg directory |
@@ -127,44 +128,6 @@ tasks: |
127 | 128 | echo "Examples successfully cloned." |
128 | 129 | silent: false |
129 | 130 |
|
130 | | - build-image: |
131 | | - desc: "Builds the mock-repo Docker image (requires GITHUB_TOKEN_FILE)" |
132 | | - deps: [build-deb] |
133 | | - vars: |
134 | | - PKG_PATH: "{{.NEW_PACKAGE}}" |
135 | | - cmds: |
136 | | - # --- MODIFIED --- |
137 | | - # Check for both the package and the token file |
138 | | - - | |
139 | | - if [ ! -f "{{.GITHUB_TOKEN_FILE}}" ]; then |
140 | | - echo "Error: GitHub token file not found at {{.GITHUB_TOKEN_FILE}}" |
141 | | - echo "Please create this file and add your GitHub PAT to it." |
142 | | - exit 1 |
143 | | - fi |
144 | | - - | |
145 | | - echo "Using package: {{.PKG_PATH}}" |
146 | | - echo "Using GitHub token from: {{.GITHUB_TOKEN_FILE}}" |
147 | | -
|
148 | | - # Enable BuildKit and pass the secret |
149 | | - DOCKER_BUILDKIT=1 docker build \ |
150 | | - --secret id=github_token,src={{.GITHUB_TOKEN_FILE}} \ |
151 | | - --build-arg NEW_PACKAGE_PATH={{.PKG_PATH}} \ |
152 | | - -t newdeb \ |
153 | | - -f test.Dockerfile . |
154 | | - status: |
155 | | - - '[[ -f "{{.PKG_PATH}}" ]]' |
156 | | - - '[[ -f "{{.DOCKERFILE_NAME}}" ]]' |
157 | | - # Re-build if token file changes |
158 | | - - '[[ -f "{{.GITHUB_TOKEN_FILE}}" ]]' |
159 | | - |
160 | | - test-deb: |
161 | | - desc: Test the debian package locally |
162 | | - deps: |
163 | | - - build-deb |
164 | | - cmds: |
165 | | - - docker build --no-cache -t mock-apt-repo -f test.Dockerfile . |
166 | | - - docker run --rm -it --privileged -v /sys/fs/cgroup:/sys/fs/cgroup:ro --name apt-test-update mock-apt-repo |
167 | | - |
168 | 131 | arduino-app-cli:build:local: |
169 | 132 | desc: "Build the arduino-app-cli locally" |
170 | 133 | cmds: |
|
0 commit comments