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
| name: Build & Update with Arduino CLI | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - test_package_update | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| jobs: | |
| build-and-update: | |
| runs-on: ubuntu-22.04 | |
| # services: | |
| # docker: | |
| # image: docker:dind | |
| # options: --privileged --shm-size=2g | |
| # volumes: | |
| # - /var/run/docker.sock:/var/run/docker.sock:ro | |
| # container: | |
| # image: ubuntu:latest | |
| env: | |
| ARCH: amd64 | |
| APPCLI_REPO: arduino/arduino-app-cli | |
| ROUTER_REPO: arduino/arduino-router | |
| STABLE_DIR: build/stable | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| # - name: Set up Docker | |
| # uses: docker/setup-docker-action@v2 | |
| # - name: Set up Docker Buildx | |
| # uses: docker/setup-buildx-action@v3 | |
| - name: Install Task (go-task) | |
| run: | | |
| curl -sL https://taskfile.dev/install.sh | sh -s -- -d -b ./bin | |
| echo "$PWD/bin" >> $GITHUB_PATH | |
| task --version | |
| - name: Prepare folder | |
| run: | | |
| mkdir -p "${STABLE_DIR}" | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Ensure curl & mkdir | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y curl | |
| mkdir -p "$STABLE_DIR" | |
| # --- Arduino App CLI (.deb) --- | |
| - name: Download arduino-app-cli .deb (from hard-coded tag page) | |
| run: | | |
| set -euo pipefail | |
| BASE="https://github.com/arduino/arduino-app-cli" | |
| # Use the "expanded_assets" page for the tag to get direct links | |
| PAGE="$BASE/releases/expanded_assets/${TAG}" | |
| REL_URL=$(curl -fsSL "$PAGE" | grep -oE '/arduino/arduino-app-cli/releases/download/'"$TAG"'/[^"]+\.deb' | head -n1) | |
| test -n "$REL_URL" | |
| URL="https://github.com${REL_URL}" | |
| echo "Found asset: $URL" | |
| curl -fL "$URL" -o "$STABLE_DIR/arduino-app-cli_${TAG}.deb" | |
| ls -l "$STABLE_DIR" | |
| # --- Arduino Router (.deb) --- | |
| - name: Download arduino-router .deb (from hard-coded tag page) | |
| run: | | |
| set -euo pipefail | |
| BASE="https://github.com/arduino/arduino-router" | |
| PAGE="$BASE/releases/expanded_assets/${TAG}" | |
| REL_URL=$(curl -fsSL "$PAGE" | grep -oE '/arduino/arduino-router/releases/download/'"$TAG"'/[^"]+\.deb' | head -n1) | |
| test -n "$REL_URL" | |
| URL="https://github.com${REL_URL}" | |
| echo "Found asset: $URL" | |
| curl -fL "$URL" -o "$STABLE_DIR/arduino-router_${TAG}.deb" | |
| ls -l "$STABLE_DIR" | |
| - name: Build Docker image (no cache) | |
| run: | | |
| docker build --no-cache -t mock-apt-repo -f test.Dockerfile . | |
| - name: Run mock-apt-repo container | |
| run: | | |
| docker run --rm -d \ | |
| --privileged \ | |
| --cgroupns=host \ | |
| -v /sys/fs/cgroup:/sys/fs/cgroup:rw \ | |
| -v /var/run/docker.sock:/var/run/docker.sock \ | |
| -e DOCKER_HOST=unix:///var/run/docker.sock \ | |
| --name apt-test-update \ | |
| mock-apt-repo | |
| - name: Verify container is running | |
| run: docker ps |