|
| 1 | +name: Build & Update with Arduino CLI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + - test_package_update |
| 8 | + workflow_dispatch: |
| 9 | + |
| 10 | +permissions: |
| 11 | + contents: read |
| 12 | + |
| 13 | +jobs: |
| 14 | + build-and-update: |
| 15 | + runs-on: ubuntu-22.04 |
| 16 | + # services: |
| 17 | + # docker: |
| 18 | + # image: docker:dind |
| 19 | + # options: --privileged --shm-size=2g |
| 20 | + # volumes: |
| 21 | + # - /var/run/docker.sock:/var/run/docker.sock:ro |
| 22 | + # container: |
| 23 | + # image: ubuntu:latest |
| 24 | + |
| 25 | + env: |
| 26 | + ARCH: amd64 |
| 27 | + APPCLI_REPO: arduino/arduino-app-cli |
| 28 | + ROUTER_REPO: arduino/arduino-router |
| 29 | + STABLE_DIR: build/stable |
| 30 | + |
| 31 | + steps: |
| 32 | + - name: Checkout |
| 33 | + uses: actions/checkout@v4 |
| 34 | + |
| 35 | + - name: Set up Go |
| 36 | + uses: actions/setup-go@v5 |
| 37 | + with: |
| 38 | + go-version-file: go.mod |
| 39 | + |
| 40 | + # - name: Set up Docker |
| 41 | + # uses: docker/setup-docker-action@v2 |
| 42 | + |
| 43 | + # - name: Set up Docker Buildx |
| 44 | + # uses: docker/setup-buildx-action@v3 |
| 45 | + |
| 46 | + - name: Install Task (go-task) |
| 47 | + run: | |
| 48 | + go tool task --version |
| 49 | +
|
| 50 | + - name: Prepare folder |
| 51 | + run: | |
| 52 | + mkdir -p "${STABLE_DIR}" |
| 53 | +
|
| 54 | + - name: Checkout |
| 55 | + uses: actions/checkout@v4 |
| 56 | + |
| 57 | + |
| 58 | + - name: Configure Git for private repo cloning |
| 59 | + run: | |
| 60 | + git config --global url."https://${{ env.GITHUB_USERNAME }}:${{ env.GITHUB_TOKEN }}@github.com".insteadOf "https://github.com" |
| 61 | +
|
| 62 | + - name: List assets for Arduino App CLI v0.6.6 |
| 63 | + env: |
| 64 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 65 | + run: | |
| 66 | + curl -H "Authorization: token ${GITHUB_TOKEN}" \ |
| 67 | + -H "Accept: application/vnd.github+json" \ |
| 68 | + "https://api.github.com/repos/arduino/arduino-app-cli/releases/tags/v0.6.6" \ |
| 69 | + | jq -r '.assets[] | "\(.name) -> \(.browser_download_url)"' |
| 70 | +
|
| 71 | + - name: Download Arduino App CLI .deb |
| 72 | + run: | |
| 73 | + mkdir -p build/stable |
| 74 | + wget -O build/stable/arduino-app-cli_0.6.6_amd64.deb \ |
| 75 | + https://github.com/arduino/arduino-app-cli/releases/download/0.6.6/arduino-app-cli_0.6.6_amd64.deb |
| 76 | + |
| 77 | + - name: Download Arduino Router .deb |
| 78 | + run: | |
| 79 | + mkdir -p build/stable |
| 80 | + wget -O build/stable/arduino-router_0.5.3_amd64.deb \ |
| 81 | + https://github.com/arduino/arduino-router/releases/download/v0.5.3/arduino-router_0.5.3_amd64.deb |
| 82 | +
|
| 83 | + - name: Build Docker image (no cache) |
| 84 | + run: | |
| 85 | + docker build --no-cache -t mock-apt-repo -f test.Dockerfile . |
| 86 | + |
| 87 | + - name: Run mock-apt-repo container |
| 88 | + run: | |
| 89 | + docker run --rm -d \ |
| 90 | + --privileged \ |
| 91 | + --cgroupns=host \ |
| 92 | + -v /sys/fs/cgroup:/sys/fs/cgroup:rw \ |
| 93 | + -v /var/run/docker.sock:/var/run/docker.sock \ |
| 94 | + -e DOCKER_HOST=unix:///var/run/docker.sock \ |
| 95 | + --name apt-test-update \ |
| 96 | + mock-apt-repo |
| 97 | +
|
| 98 | + - name: Verify container is running |
| 99 | + run: docker ps |
0 commit comments