diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml new file mode 100644 index 0000000..59aa9f2 --- /dev/null +++ b/.github/workflows/nightly.yml @@ -0,0 +1,99 @@ +name: Nightly Publish + +permissions: + contents: read + +on: + push: + branches: + - master + pull_request: + branches: + - master + schedule: + - cron: '0 0 * * *' + +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + include: +#VERSIONS + - name: buster + context: nightly/buster + platforms: linux/amd64,linux/arm/v7,linux/arm64,linux/386 + tags: | + nightly-buster + - name: slim-buster + context: nightly/buster/slim + platforms: linux/amd64,linux/arm/v7,linux/arm64,linux/386 + tags: | + nightly-buster-slim + - name: bullseye + context: nightly/bullseye + platforms: linux/amd64,linux/arm/v7,linux/arm64,linux/386,linux/ppc64le + tags: | + nightly-bullseye + - name: slim-bullseye + context: nightly/bullseye/slim + platforms: linux/amd64,linux/arm/v7,linux/arm64,linux/386,linux/ppc64le + tags: | + nightly-bullseye-slim + - name: bookworm + context: nightly/bookworm + platforms: linux/amd64,linux/arm/v7,linux/arm64,linux/386,linux/ppc64le + tags: | + nightly-bookworm + nightly + - name: slim-bookworm + context: nightly/bookworm/slim + platforms: linux/amd64,linux/arm/v7,linux/arm64,linux/386,linux/ppc64le + tags: | + nightly-bookworm-slim + nightly-slim + - name: alpine3.18 + context: nightly/alpine3.18 + platforms: linux/amd64,linux/arm64 + tags: | + nightly-alpine3.18 + - name: alpine3.19 + context: nightly/alpine3.19 + platforms: linux/amd64,linux/arm64 + tags: | + nightly-alpine3.19 + nightly-alpine +#VERSIONS + name: ${{ matrix.name }} + steps: + - uses: actions/checkout@v4 + - uses: docker/setup-qemu-action@v3 + - uses: docker/setup-buildx-action@v3 +# - uses: docker/login-action@v3 +# if: github.event_name != 'pull_request' +# with: +# registry: ghcr.io +# username: ${{ github.actor }} +# password: ${{ secrets.GITHUB_TOKEN }} + + - uses: docker/login-action@v3 + if: github.event_name != 'pull_request' + with: + username: rustopsbot + password: ${{ secrets.DOCKER_HUB_TOKEN }} + + - id: meta + uses: docker/metadata-action@v5 + with: + images: | + rustlang/rust +# ghcr.io/rust-lang/rust + tags: ${{ matrix.tags }} + + - uses: docker/build-push-action@v5 + with: + context: ${{ matrix.context }} + platforms: ${{ matrix.platforms }} + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} \ No newline at end of file diff --git a/nightly/alpine3.18/Dockerfile b/nightly/alpine3.18/Dockerfile new file mode 100644 index 0000000..76d2247 --- /dev/null +++ b/nightly/alpine3.18/Dockerfile @@ -0,0 +1,28 @@ +FROM alpine:3.18 + +RUN apk add --no-cache \ + ca-certificates \ + gcc + +ENV RUSTUP_HOME=/usr/local/rustup \ + CARGO_HOME=/usr/local/cargo \ + PATH=/usr/local/cargo/bin:$PATH \ + RUST_VERSION=nightly + +RUN set -eux; \ + apkArch="$(apk --print-arch)"; \ + case "$apkArch" in \ + x86_64) rustArch='x86_64-unknown-linux-musl'; rustupSha256='7aa9e2a380a9958fc1fc426a3323209b2c86181c6816640979580f62ff7d48d4' ;; \ + aarch64) rustArch='aarch64-unknown-linux-musl'; rustupSha256='b1962dfc18e1fd47d01341e6897cace67cddfabf547ef394e8883939bd6e002e' ;; \ + *) echo >&2 "unsupported architecture: $apkArch"; exit 1 ;; \ + esac; \ + url="https://static.rust-lang.org/rustup/archive/1.26.0/${rustArch}/rustup-init"; \ + wget "$url"; \ + echo "${rustupSha256} *rustup-init" | sha256sum -c -; \ + chmod +x rustup-init; \ + ./rustup-init -y --no-modify-path --profile minimal --default-toolchain $RUST_VERSION --default-host ${rustArch}; \ + rm rustup-init; \ + chmod -R a+w $RUSTUP_HOME $CARGO_HOME; \ + rustup --version; \ + cargo --version; \ + rustc --version; diff --git a/nightly/alpine3.19/Dockerfile b/nightly/alpine3.19/Dockerfile new file mode 100644 index 0000000..830bb4d --- /dev/null +++ b/nightly/alpine3.19/Dockerfile @@ -0,0 +1,28 @@ +FROM alpine:3.19 + +RUN apk add --no-cache \ + ca-certificates \ + gcc + +ENV RUSTUP_HOME=/usr/local/rustup \ + CARGO_HOME=/usr/local/cargo \ + PATH=/usr/local/cargo/bin:$PATH \ + RUST_VERSION=nightly + +RUN set -eux; \ + apkArch="$(apk --print-arch)"; \ + case "$apkArch" in \ + x86_64) rustArch='x86_64-unknown-linux-musl'; rustupSha256='7aa9e2a380a9958fc1fc426a3323209b2c86181c6816640979580f62ff7d48d4' ;; \ + aarch64) rustArch='aarch64-unknown-linux-musl'; rustupSha256='b1962dfc18e1fd47d01341e6897cace67cddfabf547ef394e8883939bd6e002e' ;; \ + *) echo >&2 "unsupported architecture: $apkArch"; exit 1 ;; \ + esac; \ + url="https://static.rust-lang.org/rustup/archive/1.26.0/${rustArch}/rustup-init"; \ + wget "$url"; \ + echo "${rustupSha256} *rustup-init" | sha256sum -c -; \ + chmod +x rustup-init; \ + ./rustup-init -y --no-modify-path --profile minimal --default-toolchain $RUST_VERSION --default-host ${rustArch}; \ + rm rustup-init; \ + chmod -R a+w $RUSTUP_HOME $CARGO_HOME; \ + rustup --version; \ + cargo --version; \ + rustc --version; diff --git a/nightly/bookworm/Dockerfile b/nightly/bookworm/Dockerfile new file mode 100644 index 0000000..6526bc6 --- /dev/null +++ b/nightly/bookworm/Dockerfile @@ -0,0 +1,27 @@ +FROM buildpack-deps:bookworm + +ENV RUSTUP_HOME=/usr/local/rustup \ + CARGO_HOME=/usr/local/cargo \ + PATH=/usr/local/cargo/bin:$PATH \ + RUST_VERSION=nightly + +RUN set -eux; \ + dpkgArch="$(dpkg --print-architecture)"; \ + case "${dpkgArch##*-}" in \ + amd64) rustArch='x86_64-unknown-linux-gnu'; rustupSha256='0b2f6c8f85a3d02fde2efc0ced4657869d73fccfce59defb4e8d29233116e6db' ;; \ + armhf) rustArch='armv7-unknown-linux-gnueabihf'; rustupSha256='f21c44b01678c645d8fbba1e55e4180a01ac5af2d38bcbd14aa665e0d96ed69a' ;; \ + arm64) rustArch='aarch64-unknown-linux-gnu'; rustupSha256='673e336c81c65e6b16dcdede33f4cc9ed0f08bde1dbe7a935f113605292dc800' ;; \ + i386) rustArch='i686-unknown-linux-gnu'; rustupSha256='e7b0f47557c1afcd86939b118cbcf7fb95a5d1d917bdd355157b63ca00fc4333' ;; \ + ppc64el) rustArch='powerpc64le-unknown-linux-gnu'; rustupSha256='1032934fb154ad2d365e02dcf770c6ecfaec6ab2987204c618c21ba841c97b44' ;; \ + *) echo >&2 "unsupported architecture: ${dpkgArch}"; exit 1 ;; \ + esac; \ + url="https://static.rust-lang.org/rustup/archive/1.26.0/${rustArch}/rustup-init"; \ + wget "$url"; \ + echo "${rustupSha256} *rustup-init" | sha256sum -c -; \ + chmod +x rustup-init; \ + ./rustup-init -y --no-modify-path --profile minimal --default-toolchain $RUST_VERSION --default-host ${rustArch}; \ + rm rustup-init; \ + chmod -R a+w $RUSTUP_HOME $CARGO_HOME; \ + rustup --version; \ + cargo --version; \ + rustc --version; diff --git a/nightly/bookworm/slim/Dockerfile b/nightly/bookworm/slim/Dockerfile new file mode 100644 index 0000000..610fb9f --- /dev/null +++ b/nightly/bookworm/slim/Dockerfile @@ -0,0 +1,38 @@ +FROM debian:bookworm-slim + +ENV RUSTUP_HOME=/usr/local/rustup \ + CARGO_HOME=/usr/local/cargo \ + PATH=/usr/local/cargo/bin:$PATH \ + RUST_VERSION=nightly + +RUN set -eux; \ + apt-get update; \ + apt-get install -y --no-install-recommends \ + ca-certificates \ + gcc \ + libc6-dev \ + wget \ + ; \ + dpkgArch="$(dpkg --print-architecture)"; \ + case "${dpkgArch##*-}" in \ + amd64) rustArch='x86_64-unknown-linux-gnu'; rustupSha256='0b2f6c8f85a3d02fde2efc0ced4657869d73fccfce59defb4e8d29233116e6db' ;; \ + armhf) rustArch='armv7-unknown-linux-gnueabihf'; rustupSha256='f21c44b01678c645d8fbba1e55e4180a01ac5af2d38bcbd14aa665e0d96ed69a' ;; \ + arm64) rustArch='aarch64-unknown-linux-gnu'; rustupSha256='673e336c81c65e6b16dcdede33f4cc9ed0f08bde1dbe7a935f113605292dc800' ;; \ + i386) rustArch='i686-unknown-linux-gnu'; rustupSha256='e7b0f47557c1afcd86939b118cbcf7fb95a5d1d917bdd355157b63ca00fc4333' ;; \ + ppc64el) rustArch='powerpc64le-unknown-linux-gnu'; rustupSha256='1032934fb154ad2d365e02dcf770c6ecfaec6ab2987204c618c21ba841c97b44' ;; \ + *) echo >&2 "unsupported architecture: ${dpkgArch}"; exit 1 ;; \ + esac; \ + url="https://static.rust-lang.org/rustup/archive/1.26.0/${rustArch}/rustup-init"; \ + wget "$url"; \ + echo "${rustupSha256} *rustup-init" | sha256sum -c -; \ + chmod +x rustup-init; \ + ./rustup-init -y --no-modify-path --profile minimal --default-toolchain $RUST_VERSION --default-host ${rustArch}; \ + rm rustup-init; \ + chmod -R a+w $RUSTUP_HOME $CARGO_HOME; \ + rustup --version; \ + cargo --version; \ + rustc --version; \ + apt-get remove -y --auto-remove \ + wget \ + ; \ + rm -rf /var/lib/apt/lists/*; diff --git a/nightly/bullseye/Dockerfile b/nightly/bullseye/Dockerfile new file mode 100644 index 0000000..880f743 --- /dev/null +++ b/nightly/bullseye/Dockerfile @@ -0,0 +1,27 @@ +FROM buildpack-deps:bullseye + +ENV RUSTUP_HOME=/usr/local/rustup \ + CARGO_HOME=/usr/local/cargo \ + PATH=/usr/local/cargo/bin:$PATH \ + RUST_VERSION=nightly + +RUN set -eux; \ + dpkgArch="$(dpkg --print-architecture)"; \ + case "${dpkgArch##*-}" in \ + amd64) rustArch='x86_64-unknown-linux-gnu'; rustupSha256='0b2f6c8f85a3d02fde2efc0ced4657869d73fccfce59defb4e8d29233116e6db' ;; \ + armhf) rustArch='armv7-unknown-linux-gnueabihf'; rustupSha256='f21c44b01678c645d8fbba1e55e4180a01ac5af2d38bcbd14aa665e0d96ed69a' ;; \ + arm64) rustArch='aarch64-unknown-linux-gnu'; rustupSha256='673e336c81c65e6b16dcdede33f4cc9ed0f08bde1dbe7a935f113605292dc800' ;; \ + i386) rustArch='i686-unknown-linux-gnu'; rustupSha256='e7b0f47557c1afcd86939b118cbcf7fb95a5d1d917bdd355157b63ca00fc4333' ;; \ + ppc64el) rustArch='powerpc64le-unknown-linux-gnu'; rustupSha256='1032934fb154ad2d365e02dcf770c6ecfaec6ab2987204c618c21ba841c97b44' ;; \ + *) echo >&2 "unsupported architecture: ${dpkgArch}"; exit 1 ;; \ + esac; \ + url="https://static.rust-lang.org/rustup/archive/1.26.0/${rustArch}/rustup-init"; \ + wget "$url"; \ + echo "${rustupSha256} *rustup-init" | sha256sum -c -; \ + chmod +x rustup-init; \ + ./rustup-init -y --no-modify-path --profile minimal --default-toolchain $RUST_VERSION --default-host ${rustArch}; \ + rm rustup-init; \ + chmod -R a+w $RUSTUP_HOME $CARGO_HOME; \ + rustup --version; \ + cargo --version; \ + rustc --version; diff --git a/nightly/bullseye/slim/Dockerfile b/nightly/bullseye/slim/Dockerfile new file mode 100644 index 0000000..193779d --- /dev/null +++ b/nightly/bullseye/slim/Dockerfile @@ -0,0 +1,38 @@ +FROM debian:bullseye-slim + +ENV RUSTUP_HOME=/usr/local/rustup \ + CARGO_HOME=/usr/local/cargo \ + PATH=/usr/local/cargo/bin:$PATH \ + RUST_VERSION=nightly + +RUN set -eux; \ + apt-get update; \ + apt-get install -y --no-install-recommends \ + ca-certificates \ + gcc \ + libc6-dev \ + wget \ + ; \ + dpkgArch="$(dpkg --print-architecture)"; \ + case "${dpkgArch##*-}" in \ + amd64) rustArch='x86_64-unknown-linux-gnu'; rustupSha256='0b2f6c8f85a3d02fde2efc0ced4657869d73fccfce59defb4e8d29233116e6db' ;; \ + armhf) rustArch='armv7-unknown-linux-gnueabihf'; rustupSha256='f21c44b01678c645d8fbba1e55e4180a01ac5af2d38bcbd14aa665e0d96ed69a' ;; \ + arm64) rustArch='aarch64-unknown-linux-gnu'; rustupSha256='673e336c81c65e6b16dcdede33f4cc9ed0f08bde1dbe7a935f113605292dc800' ;; \ + i386) rustArch='i686-unknown-linux-gnu'; rustupSha256='e7b0f47557c1afcd86939b118cbcf7fb95a5d1d917bdd355157b63ca00fc4333' ;; \ + ppc64el) rustArch='powerpc64le-unknown-linux-gnu'; rustupSha256='1032934fb154ad2d365e02dcf770c6ecfaec6ab2987204c618c21ba841c97b44' ;; \ + *) echo >&2 "unsupported architecture: ${dpkgArch}"; exit 1 ;; \ + esac; \ + url="https://static.rust-lang.org/rustup/archive/1.26.0/${rustArch}/rustup-init"; \ + wget "$url"; \ + echo "${rustupSha256} *rustup-init" | sha256sum -c -; \ + chmod +x rustup-init; \ + ./rustup-init -y --no-modify-path --profile minimal --default-toolchain $RUST_VERSION --default-host ${rustArch}; \ + rm rustup-init; \ + chmod -R a+w $RUSTUP_HOME $CARGO_HOME; \ + rustup --version; \ + cargo --version; \ + rustc --version; \ + apt-get remove -y --auto-remove \ + wget \ + ; \ + rm -rf /var/lib/apt/lists/*; diff --git a/nightly/buster/Dockerfile b/nightly/buster/Dockerfile new file mode 100644 index 0000000..f33b951 --- /dev/null +++ b/nightly/buster/Dockerfile @@ -0,0 +1,26 @@ +FROM buildpack-deps:buster + +ENV RUSTUP_HOME=/usr/local/rustup \ + CARGO_HOME=/usr/local/cargo \ + PATH=/usr/local/cargo/bin:$PATH \ + RUST_VERSION=nightly + +RUN set -eux; \ + dpkgArch="$(dpkg --print-architecture)"; \ + case "${dpkgArch##*-}" in \ + amd64) rustArch='x86_64-unknown-linux-gnu'; rustupSha256='0b2f6c8f85a3d02fde2efc0ced4657869d73fccfce59defb4e8d29233116e6db' ;; \ + armhf) rustArch='armv7-unknown-linux-gnueabihf'; rustupSha256='f21c44b01678c645d8fbba1e55e4180a01ac5af2d38bcbd14aa665e0d96ed69a' ;; \ + arm64) rustArch='aarch64-unknown-linux-gnu'; rustupSha256='673e336c81c65e6b16dcdede33f4cc9ed0f08bde1dbe7a935f113605292dc800' ;; \ + i386) rustArch='i686-unknown-linux-gnu'; rustupSha256='e7b0f47557c1afcd86939b118cbcf7fb95a5d1d917bdd355157b63ca00fc4333' ;; \ + *) echo >&2 "unsupported architecture: ${dpkgArch}"; exit 1 ;; \ + esac; \ + url="https://static.rust-lang.org/rustup/archive/1.26.0/${rustArch}/rustup-init"; \ + wget "$url"; \ + echo "${rustupSha256} *rustup-init" | sha256sum -c -; \ + chmod +x rustup-init; \ + ./rustup-init -y --no-modify-path --profile minimal --default-toolchain $RUST_VERSION --default-host ${rustArch}; \ + rm rustup-init; \ + chmod -R a+w $RUSTUP_HOME $CARGO_HOME; \ + rustup --version; \ + cargo --version; \ + rustc --version; diff --git a/nightly/buster/slim/Dockerfile b/nightly/buster/slim/Dockerfile new file mode 100644 index 0000000..582280b --- /dev/null +++ b/nightly/buster/slim/Dockerfile @@ -0,0 +1,37 @@ +FROM debian:buster-slim + +ENV RUSTUP_HOME=/usr/local/rustup \ + CARGO_HOME=/usr/local/cargo \ + PATH=/usr/local/cargo/bin:$PATH \ + RUST_VERSION=nightly + +RUN set -eux; \ + apt-get update; \ + apt-get install -y --no-install-recommends \ + ca-certificates \ + gcc \ + libc6-dev \ + wget \ + ; \ + dpkgArch="$(dpkg --print-architecture)"; \ + case "${dpkgArch##*-}" in \ + amd64) rustArch='x86_64-unknown-linux-gnu'; rustupSha256='0b2f6c8f85a3d02fde2efc0ced4657869d73fccfce59defb4e8d29233116e6db' ;; \ + armhf) rustArch='armv7-unknown-linux-gnueabihf'; rustupSha256='f21c44b01678c645d8fbba1e55e4180a01ac5af2d38bcbd14aa665e0d96ed69a' ;; \ + arm64) rustArch='aarch64-unknown-linux-gnu'; rustupSha256='673e336c81c65e6b16dcdede33f4cc9ed0f08bde1dbe7a935f113605292dc800' ;; \ + i386) rustArch='i686-unknown-linux-gnu'; rustupSha256='e7b0f47557c1afcd86939b118cbcf7fb95a5d1d917bdd355157b63ca00fc4333' ;; \ + *) echo >&2 "unsupported architecture: ${dpkgArch}"; exit 1 ;; \ + esac; \ + url="https://static.rust-lang.org/rustup/archive/1.26.0/${rustArch}/rustup-init"; \ + wget "$url"; \ + echo "${rustupSha256} *rustup-init" | sha256sum -c -; \ + chmod +x rustup-init; \ + ./rustup-init -y --no-modify-path --profile minimal --default-toolchain $RUST_VERSION --default-host ${rustArch}; \ + rm rustup-init; \ + chmod -R a+w $RUSTUP_HOME $CARGO_HOME; \ + rustup --version; \ + cargo --version; \ + rustc --version; \ + apt-get remove -y --auto-remove \ + wget \ + ; \ + rm -rf /var/lib/apt/lists/*; diff --git a/x.py b/x.py index f81abb0..4fb62a3 100755 --- a/x.py +++ b/x.py @@ -6,20 +6,21 @@ import subprocess import sys -rust_version = "1.76.0" +stable_rust_version = "1.76.0" +supported_rust_versions = [stable_rust_version, "nightly"] rustup_version = "1.26.0" -DebianArch = namedtuple("DebianArch", ["bashbrew", "dpkg", "rust"]) +DebianArch = namedtuple("DebianArch", ["bashbrew", "dpkg", "qemu", "rust"]) debian_arches = [ - DebianArch("amd64", "amd64", "x86_64-unknown-linux-gnu"), - DebianArch("arm32v7", "armhf", "armv7-unknown-linux-gnueabihf"), - DebianArch("arm64v8", "arm64", "aarch64-unknown-linux-gnu"), - DebianArch("i386", "i386", "i686-unknown-linux-gnu"), + DebianArch("amd64", "amd64", "linux/amd64", "x86_64-unknown-linux-gnu"), + DebianArch("arm32v7", "armhf", "linux/arm/v7", "armv7-unknown-linux-gnueabihf"), + DebianArch("arm64v8", "arm64", "linux/arm64", "aarch64-unknown-linux-gnu"), + DebianArch("i386", "i386", "linux/386", "i686-unknown-linux-gnu"), ] debian_non_buster_arches = [ - DebianArch("ppc64le", "ppc64el", "powerpc64le-unknown-linux-gnu"), + DebianArch("ppc64le", "ppc64el", "linux/ppc64le", "powerpc64le-unknown-linux-gnu"), ] debian_variants = [ @@ -30,11 +31,11 @@ default_debian_variant = "bookworm" -AlpineArch = namedtuple("AlpineArch", ["bashbrew", "apk", "rust"]) +AlpineArch = namedtuple("AlpineArch", ["bashbrew", "apk", "qemu", "rust"]) alpine_arches = [ - AlpineArch("amd64", "x86_64", "x86_64-unknown-linux-musl"), - AlpineArch("arm64v8", "aarch64", "aarch64-unknown-linux-musl"), + AlpineArch("amd64", "x86_64", "linux/amd64", "x86_64-unknown-linux-musl"), + AlpineArch("arm64v8", "aarch64", "linux/arm64", "aarch64-unknown-linux-musl"), ] alpine_versions = [ @@ -82,19 +83,20 @@ def update_debian(): case += end - rendered = template \ - .replace("%%RUST-VERSION%%", rust_version) \ - .replace("%%RUSTUP-VERSION%%", rustup_version) \ - .replace("%%DEBIAN-SUITE%%", variant) \ - .replace("%%ARCH-CASE%%", case) - write_file(f"{rust_version}/{variant}/Dockerfile", rendered) - - rendered = slim_template \ - .replace("%%RUST-VERSION%%", rust_version) \ - .replace("%%RUSTUP-VERSION%%", rustup_version) \ - .replace("%%DEBIAN-SUITE%%", variant) \ - .replace("%%ARCH-CASE%%", case) - write_file(f"{rust_version}/{variant}/slim/Dockerfile", rendered) + for rust_version in supported_rust_versions: + rendered = template \ + .replace("%%RUST-VERSION%%", rust_version) \ + .replace("%%RUSTUP-VERSION%%", rustup_version) \ + .replace("%%DEBIAN-SUITE%%", variant) \ + .replace("%%ARCH-CASE%%", case) + write_file(f"{rust_version}/{variant}/Dockerfile", rendered) + + rendered = slim_template \ + .replace("%%RUST-VERSION%%", rust_version) \ + .replace("%%RUSTUP-VERSION%%", rustup_version) \ + .replace("%%DEBIAN-SUITE%%", variant) \ + .replace("%%ARCH-CASE%%", case) + write_file(f"{rust_version}/{variant}/slim/Dockerfile", rendered) def update_alpine(): arch_case = 'apkArch="$(apk --print-arch)"; \\\n' @@ -108,12 +110,13 @@ def update_alpine(): template = read_file("Dockerfile-alpine.template") for version in alpine_versions: - rendered = template \ - .replace("%%RUST-VERSION%%", rust_version) \ - .replace("%%RUSTUP-VERSION%%", rustup_version) \ - .replace("%%TAG%%", version) \ - .replace("%%ARCH-CASE%%", arch_case) - write_file(f"{rust_version}/alpine{version}/Dockerfile", rendered) + for rust_version in supported_rust_versions: + rendered = template \ + .replace("%%RUST-VERSION%%", rust_version) \ + .replace("%%RUSTUP-VERSION%%", rustup_version) \ + .replace("%%TAG%%", version) \ + .replace("%%ARCH-CASE%%", arch_case) + write_file(f"{rust_version}/alpine{version}/Dockerfile", rendered) def update_ci(): file = ".github/workflows/ci.yml" @@ -121,7 +124,7 @@ def update_ci(): marker = "#RUST_VERSION\n" split = config.split(marker) - rendered = split[0] + marker + f" RUST_VERSION: {rust_version}\n" + marker + split[2] + rendered = split[0] + marker + f" RUST_VERSION: {stable_rust_version}\n" + marker + split[2] versions = "" for variant in debian_variants: @@ -139,6 +142,61 @@ def update_ci(): rendered = split[0] + marker + versions + marker + split[2] write_file(file, rendered) +def update_nightly_ci(): + file = ".github/workflows/nightly.yml" + config = read_file(file) + + + versions = "" + for variant in debian_variants: + platforms = [] + for arch in debian_arches: + platforms.append(f"{arch.qemu}") + if variant != "buster": + for arch in debian_non_buster_arches: + platforms.append(f"{arch.qemu}") + platforms = ",".join(platforms) + + tags = [f"nightly-{variant}"] + if variant == default_debian_variant: + tags.append("nightly") + + versions += f" - name: {variant}\n" + versions += f" context: nightly/{variant}\n" + versions += f" platforms: {platforms}\n" + versions += f" tags: |\n" + for tag in tags: + versions += f" {tag}\n" + + versions += f" - name: slim-{variant}\n" + versions += f" context: nightly/{variant}/slim\n" + versions += f" platforms: {platforms}\n" + versions += f" tags: |\n" + for tag in tags: + versions += f" {tag}-slim\n" + + for version in alpine_versions: + platforms = [] + for arch in alpine_arches: + platforms.append(f"{arch.qemu}") + platforms = ",".join(platforms) + + tags = [f"nightly-alpine{version}"] + if version == default_alpine_version: + tags.append("nightly-alpine") + + versions += f" - name: alpine{version}\n" + versions += f" context: nightly/alpine{version}\n" + versions += f" platforms: {platforms}\n" + versions += f" tags: |\n" + for tag in tags: + versions += f" {tag}\n" + + marker = "#VERSIONS\n" + split = config.split(marker) + rendered = split[0] + marker + versions + marker + split[2] + write_file(file, rendered) + def file_commit(file): return subprocess.run( ["git", "log", "-1", "--format=%H", "HEAD", "--", file], @@ -148,7 +206,7 @@ def file_commit(file): .strip() def version_tags(): - parts = rust_version.split(".") + parts = stable_rust_version.split(".") tags = [] for i in range(len(parts)): tags.append(".".join(parts[:i + 1])) @@ -190,7 +248,7 @@ def generate_stackbrew_library(): library += single_library( tags, map(lambda a: a.bashbrew, arches), - os.path.join(rust_version, variant)) + os.path.join(stable_rust_version, variant)) tags = [] for version_tag in version_tags(): @@ -204,7 +262,7 @@ def generate_stackbrew_library(): library += single_library( tags, map(lambda a: a.bashbrew, arches), - os.path.join(rust_version, variant, "slim")) + os.path.join(stable_rust_version, variant, "slim")) for version in alpine_versions: tags = [] @@ -219,7 +277,7 @@ def generate_stackbrew_library(): library += single_library( tags, map(lambda a: a.bashbrew, alpine_arches), - os.path.join(rust_version, f"alpine{version}")) + os.path.join(stable_rust_version, f"alpine{version}")) print(library) @@ -236,6 +294,7 @@ def usage(): update_debian() update_alpine() update_ci() + update_nightly_ci() elif task == "generate-stackbrew-library": generate_stackbrew_library() else: