diff --git a/.gitea/workflows/build-check.yml b/.gitea/workflows/build-check.yml new file mode 100644 index 0000000..2347083 --- /dev/null +++ b/.gitea/workflows/build-check.yml @@ -0,0 +1,47 @@ +name: build-check +# Linux build in Debian 12 + glibc guard, without publishing a release. +on: + workflow_dispatch: + push: + branches: ["ci/**"] + +jobs: + build-check: + strategy: + fail-fast: true + matrix: + include: + # PyInstaller cannot cross-compile: each target builds on a matching runner. + # Building inside Debian 12 (glibc 2.36) keeps the binaries runnable on bookworm and newer. + - { runner: linux-amd64, target: linux-amd64, deb_arch: amd64 } + - { runner: linux-arm64, target: linux-arm64, deb_arch: arm64 } + runs-on: ${{ matrix.runner }} + container: + image: node:20-bookworm + env: + VERSION: 0.0.0-check + steps: + - uses: actions/checkout@v4 + - uses: astral-sh/setup-uv@v5 + with: + python-version: "3.13" + - name: Install dependencies + run: uv sync --all-groups --frozen + - name: Test + run: uv run pytest -q --cov + - name: Build one-dir application + run: uv run pyinstaller envbao.spec --clean --noconfirm + - name: Smoke test + run: ./dist/envbao/envbao --version + - name: Check glibc requirement is Debian 12 compatible (<= 2.36) + run: | + max="$(objdump -T dist/envbao/envbao dist/envbao/_internal/*.so* 2>/dev/null | grep -o 'GLIBC_[0-9.]*' | sed 's/GLIBC_//' | sort -Vu | tail -1)" + echo "max glibc symbol: ${max}" + test "$(printf '%s\n2.36\n' "${max}" | sort -V | tail -1)" = "2.36" + - name: Package + run: | + mkdir -p out + tar -C dist -czf "out/envbao-${VERSION}-${{ matrix.target }}.tar.gz" envbao + python3 scripts/packaging/build_deb.py "${VERSION}" "${{ matrix.deb_arch }}" dist out + ls -l out + diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml index 3a52a0e..24287ee 100644 --- a/.gitea/workflows/release.yml +++ b/.gitea/workflows/release.yml @@ -18,17 +18,55 @@ jobs: version="$(python3 scripts/version_from_tag.py "${GITHUB_REF_NAME}")" echo "version=${version}" >> "$GITHUB_OUTPUT" - build: + build-linux: needs: validate strategy: fail-fast: true matrix: include: # PyInstaller cannot cross-compile: each target builds on a matching runner. + # Building inside Debian 12 (glibc 2.36) keeps the binaries runnable on bookworm and newer. - { runner: linux-amd64, target: linux-amd64, deb_arch: amd64 } - { runner: linux-arm64, target: linux-arm64, deb_arch: arm64 } - - { runner: macos-arm64, target: macos-arm64, deb_arch: "" } runs-on: ${{ matrix.runner }} + container: + image: node:20-bookworm + env: + VERSION: ${{ needs.validate.outputs.version }} + steps: + - uses: actions/checkout@v4 + - uses: astral-sh/setup-uv@v5 + with: + python-version: "3.13" + - name: Install dependencies + run: uv sync --all-groups --frozen + - name: Test + run: uv run pytest -q --cov + - name: Stamp version from tag + run: python3 scripts/version_from_tag.py "${GITHUB_REF_NAME}" + - name: Build one-dir application + run: uv run pyinstaller envbao.spec --clean --noconfirm + - name: Smoke test + run: test "$(./dist/envbao/envbao --version)" = "envbao ${VERSION}" + - name: Check glibc requirement is Debian 12 compatible (<= 2.36) + run: | + max="$(objdump -T dist/envbao/envbao dist/envbao/_internal/*.so* 2>/dev/null | grep -o 'GLIBC_[0-9.]*' | sed 's/GLIBC_//' | sort -Vu | tail -1)" + echo "max glibc symbol: ${max}" + test "$(printf '%s\n2.36\n' "${max}" | sort -V | tail -1)" = "2.36" + - name: Package + run: | + mkdir -p out + tar -C dist -czf "out/envbao-${VERSION}-${{ matrix.target }}.tar.gz" envbao + python3 scripts/packaging/build_deb.py "${VERSION}" "${{ matrix.deb_arch }}" dist out + ls -l out + - uses: actions/upload-artifact@v3 + with: + name: envbao-${{ matrix.target }} + path: out/* + + build-macos: + needs: validate + runs-on: macos-arm64 env: VERSION: ${{ needs.validate.outputs.version }} steps: @@ -49,20 +87,16 @@ jobs: - name: Package run: | mkdir -p out - tar -C dist -czf "out/envbao-${VERSION}-${{ matrix.target }}.tar.gz" envbao - if [ -n "${{ matrix.deb_arch }}" ]; then - python3 scripts/packaging/build_deb.py "${VERSION}" "${{ matrix.deb_arch }}" dist out - else - sh scripts/packaging/build_pkg.sh "${VERSION}" dist out - fi + tar -C dist -czf "out/envbao-${VERSION}-macos-arm64.tar.gz" envbao + sh scripts/packaging/build_pkg.sh "${VERSION}" dist out ls -l out - uses: actions/upload-artifact@v3 with: - name: envbao-${{ matrix.target }} + name: envbao-macos-arm64 path: out/* release: - needs: [validate, build] + needs: [validate, build-linux, build-macos] runs-on: linux-amd64 steps: - uses: actions/download-artifact@v3 @@ -90,3 +124,18 @@ jobs: curl -fsS -X POST "$API/releases/$id/assets?name=$(basename "$f")" \ -H "Authorization: token $TOKEN" -F "attachment=@$f" >/dev/null done + + # Ask the playbooks repo to roll the new release out to every node. + deploy: + needs: release + runs-on: linux-amd64 + continue-on-error: true + steps: + - name: Trigger playbooks deploy (envbao) + env: + TOKEN: ${{ secrets.RELEASE_TOKEN }} + SERVER: ${{ github.server_url }} + run: | + curl -fsS -X POST "$SERVER/api/v1/repos/matt/playbooks/actions/workflows/deploy.yml/dispatches" \ + -H "Authorization: token $TOKEN" -H 'Content-Type: application/json' \ + -d '{"ref":"main","inputs":{"playbook":"envbao","limit":"","check_only":"false","allow_reboot":"false"}}'