build: build and publish image nightly
All checks were successful
/ test (map[name:nightly]) (push) Successful in 1m29s
/ test (map[name:stable]) (push) Successful in 1m7s
/ test (map[name:v1.81.0]) (push) Successful in 1m37s

Removes need to update toolchain for every action step
This commit is contained in:
Paul Campbell 2025-01-09 17:26:55 +00:00 committed by Paul Campbell
parent 961c02bcf9
commit 5b2365e925
4 changed files with 59 additions and 5 deletions

View file

@ -0,0 +1,18 @@
on:
schedule:
- cron: '30 1 * * *'
workflow_dispatch:
jobs:
build:
runs-on: docker
steps:
- name: Checkout
uses: actions/checkoutv4
- name: Build
run: docker build . -t git.kemitix.net/kemitix/rust:latest
- name: Publish
run: docker push git.kemitix.net/kemitix/rust:latest

View file

@ -1,5 +1,7 @@
FROM docker.io/rust:1.84.0-slim-bookworm FROM docker.io/rust:1.84.0-slim-bookworm
LABEL org.opencontainers.image.source=https://git.kemitix.net/kemitix/rust
# nodejs - runtime used by forgejo/github actions # nodejs - runtime used by forgejo/github actions
# curl - to download cargo-binstall # curl - to download cargo-binstall
# clang-16 & mold - faster linkers for rust # clang-16 & mold - faster linkers for rust
@ -25,6 +27,13 @@ RUN cargo binstall -y \
cargo-mutants@25.0 \ cargo-mutants@25.0 \
release-plz@0.3 release-plz@0.3
COPY update.sh /
# should be a no-op if the FROM line is up-to-date
RUN /update.sh stable
RUN /update.sh nightly
COPY entrypoint.sh / COPY entrypoint.sh /
RUN git config --global user.email "action@git.kemitix.net" && \ RUN git config --global user.email "action@git.kemitix.net" && \

View file

@ -26,11 +26,6 @@ if [[ "${ARGS[0]}" == v1* ]]; then
fi fi
echo "Selected toolchain: ${TOOLCHAIN}" echo "Selected toolchain: ${TOOLCHAIN}"
echo ">>> Update toolchain"
rustup update "${TOOLCHAIN}"
echo ">>> Install rustfmt and clippy"
rustup component add --toolchain "${TOOLCHAIN}" rustfmt clippy
if test "${ARGS[0]}" == "cargo";then if test "${ARGS[0]}" == "cargo";then
PRE_COMMAND="cargo +${TOOLCHAIN} " PRE_COMMAND="cargo +${TOOLCHAIN} "
else else

32
update.sh Executable file
View file

@ -0,0 +1,32 @@
#!/usr/bin/env bash
set -e
echo "INPUT_ARGS: ${INPUT_ARGS}"
# split input into an array
read -ra ARGS <<<"${INPUT_ARGS}"
# default toolchain
TOOLCHAIN="stable"
echo "Default toolchain: ${TOOLCHAIN}"
# if first parameter is 'nightly'...
if test "${ARGS[0]}" == "nightly"; then
TOOLCHAIN="nightly"
ARGS=("${ARGS[@]:1}")
fi
if test "${ARGS[0]}" == "stable"; then
TOOLCHAIN="stable" # redundant as this is the default
ARGS=("${ARGS[@]:1}")
fi
if [[ "${ARGS[0]}" == v1* ]]; then
TOOLCHAIN="${ARGS[0]:1}"
ARGS=("${ARGS[@]:1}")
fi
echo "Selected toolchain: ${TOOLCHAIN}"
echo ">>> Update toolchain"
rustup update "${TOOLCHAIN}"
echo ">>> Install rustfmt and clippy"
rustup component add --toolchain "${TOOLCHAIN}" rustfmt clippy