Compare commits

...

27 commits

Author SHA1 Message Date
75ceb6061c feat: add cargo machete to image
All checks were successful
/ test (map[name:nightly]) (push) Successful in 2m42s
/ test (map[name:v1.81.0]) (push) Successful in 40s
/ test (map[name:stable]) (push) Successful in 4m16s
2024-09-17 15:03:34 +01:00
d135d5869d fix: fix typo in Dockerfile
All checks were successful
/ test (map[name:v1.81.0]) (push) Successful in 12s
/ test (map[name:stable]) (push) Successful in 58s
/ test (map[name:nightly]) (push) Successful in 1m47s
2024-09-17 11:39:10 +01:00
68a78fbaa3 feat: add libdbus-1-dev >=1.14.10 to image
All checks were successful
/ test (map[name:stable]) (push) Successful in 1m7s
/ test (map[name:v1.81.0]) (push) Successful in 12s
/ test (map[name:nightly]) (push) Successful in 1m51s
2024-09-17 11:32:20 +01:00
3daf1c7ccf test: test the cargo fmt and clippy work
All checks were successful
/ test (map[name:stable]) (push) Successful in 2m15s
/ test (map[name:v1.81.0]) (push) Successful in 12s
/ test (map[name:nightly]) (push) Successful in 2m48s
2024-09-17 11:09:03 +01:00
18e606baa8 fix: install rustfmt and clippy into correct toolchains
All checks were successful
/ test (map[name:stable]) (push) Successful in 40s
/ test (map[name:v1.81.0]) (push) Successful in 9s
/ test (map[name:nightly]) (push) Successful in 34s
2024-09-17 10:54:37 +01:00
cdce2e3048 build: less restrictive cargo-chef, cargo-hack and release-plz versions
All checks were successful
/ test (map[name:nightly]) (push) Successful in 38s
/ test (map[name:stable]) (push) Successful in 40s
/ test (map[name:v1.81.0]) (push) Successful in 9s
Allow patch version upgrades without intervention.
2024-09-17 10:43:25 +01:00
8b9b16aa2e fix: make rustfmt and clippy available to all toolchains
All checks were successful
/ test (map[name:nightly]) (push) Successful in 37s
/ test (map[name:stable]) (push) Successful in 39s
/ test (map[name:v1.81.0]) (push) Successful in 5s
2024-09-17 10:41:21 +01:00
c6101c1e9e docs: fix typo in README
All checks were successful
/ test (map[name:nightly]) (push) Successful in 1m6s
/ test (map[name:stable]) (push) Successful in 33s
/ test (map[name:v1.81.0]) (push) Successful in 20s
2024-09-17 09:51:59 +01:00
3fa43fa798 build: test against a specific version of rust
All checks were successful
/ test (map[name:nightly]) (push) Successful in 32s
/ test (map[name:v1.81.0]) (push) Successful in 5s
/ test (map[name:stable]) (push) Successful in 57s
2024-09-17 09:51:55 +01:00
b352ee0e67 test: use correct matrix syntax
All checks were successful
/ test (map[name:nightly]) (push) Successful in 2m16s
/ test (map[name:stable]) (push) Successful in 1m51s
2024-09-17 09:29:18 +01:00
d9532aa17a build: be more flexible in apt-get versions for docker image
All checks were successful
/ test (push) Successful in 1h0m55s
Also merges as we can't build without both in place:

fix(build): revert invalid matrix syntax

Back out "test: verify matrix with stable and nightly"

This backs out commit 5fc345c0de.
2024-09-17 08:44:43 +01:00
5fc345c0de test: verify matrix with stable and nightly
All checks were successful
/ test (nightly) (push) Successful in 4s
/ test (stable) (push) Successful in 4s
2024-09-16 17:19:34 +01:00
dbe6a60417 feat: allow selecting the nightly toolchain
All checks were successful
/ test (push) Successful in 5s
2024-09-16 17:09:17 +01:00
e931692d33 feat!: drop clang and mold
All checks were successful
/ test (push) Successful in 4s
2024-09-16 16:20:38 +01:00
41d2bb484e docs: update README to current syntax
All checks were successful
/ test (push) Successful in 5s
2024-09-16 16:18:24 +01:00
de4785cc29 feat: ensure toolchains are up-to-date
All checks were successful
/ test (push) Successful in 1m25s
2024-09-09 08:30:29 +01:00
c231f792f2 chore: upgrade libssl-dev and curl to current debian versions
All checks were successful
/ test (push) Successful in 5s
2024-09-07 12:39:37 +01:00
Renovate Bot
af08c9a7ce chore(deps): update docker.io/rust docker tag to v1.81.0
All checks were successful
/ test (push) Successful in 6s
2024-09-06 00:02:43 +00:00
ec0b626ed8 feature: add cargo-hack v0.6.31
All checks were successful
/ test (push) Successful in 31s
2024-08-12 09:37:39 +01:00
5b0798277d fix: test runs on push to next and uses next branch
All checks were successful
/ test (push) Successful in 5s
2024-08-11 09:00:32 +01:00
Renovate Bot
2c02c6fdaf chore(deps): update docker.io/rust docker tag to v1.80.1
Some checks are pending
/ test (push) Waiting to run
2024-08-08 20:46:58 +00:00
c52269835b chore(docker): cleanup Dockerfile
All checks were successful
/ test (push) Successful in 6s
2024-08-04 15:40:15 +01:00
be47ad0bab feat!: can run commands other than cargo
All checks were successful
/ test (push) Successful in 5s
All existing uses will now need to explicitly include the leading
`cargo` in their args.
2024-08-04 15:03:35 +01:00
6cd663f559 chore(deps): add release-plz version as v0.3.80
All checks were successful
/ test (push) Successful in 5s
2024-08-04 14:50:43 +01:00
58228eeddb chore(deps): specify cargo-chef version as v0.1.67
All checks were successful
/ test (push) Successful in 4s
2024-08-04 14:50:21 +01:00
1ba7a4bc43 chore(deps): specify cargo-binstall version as v1.9.0
All checks were successful
/ test (push) Successful in 4s
2024-08-04 14:49:42 +01:00
c467d164cf feat: add libdbus-1-dev
All checks were successful
/ test (push) Successful in 4s
2024-08-03 12:58:00 +01:00
4 changed files with 103 additions and 38 deletions

View file

@ -1,21 +1,46 @@
on: [push]
on:
push:
branches:
- next
jobs:
test:
runs-on: docker
strategy:
matrix:
toolchain:
- name: stable
- name: nightly
- name: v1.81.0
steps:
- uses: actions/checkout@v4
- name: Test
uses: https://git.kemitix.net/kemitix/rust@v1.80.0
- name: Machete
uses: https://git.kemitix.net/kemitix/rust@next
with:
args: test
args: cargo machete
- name: Format
uses: https://git.kemitix.net/kemitix/rust@next
with:
args: ${{ matrix.toolchain.name }} cargo fmt --check
- name: Clippy
uses: https://git.kemitix.net/kemitix/rust@next
with:
args: ${{ matrix.toolchain.name }} cargo clippy
- name: Test
uses: https://git.kemitix.net/kemitix/rust@next
with:
args: ${{ matrix.toolchain.name }} cargo test
- name: Build
uses: https://git.kemitix.net/kemitix/rust@v1.80.0
uses: https://git.kemitix.net/kemitix/rust@next
with:
args: build
args: ${{ matrix.toolchain.name }} cargo build
- name: Run
uses: https://git.kemitix.net/kemitix/rust@v1.80.0
uses: https://git.kemitix.net/kemitix/rust@next
with:
args: run
args: ${{ matrix.toolchain.name }} cargo run

View file

@ -1,35 +1,32 @@
FROM docker.io/rust:1.80.0-slim-bookworm
FROM docker.io/rust:1.81.0-slim-bookworm
# nodejs - runtime used by forgejo/github actions
# curl - to download cargo-binstall
# clang-16 & mold - faster linkers for rust
# pkg-config - required to compile some rust `-sys` packages
# libssl-dev - build dependency for git-next
# libdbus-1-dev - linux os interop (e.g. desktop notifications)
# git - git
RUN apt-get update \
&& \
apt-get install -y \
--no-install-recommends \
nodejs=18.19.0+dfsg-6~deb12u2 \
curl=7.88.1-10+deb12u6 \
clang-16=1:16.0.6-15~deb12u1 \
mold=1.10.1+dfsg-1 \
pkg-config=1.8.1-1 \
libssl-dev=3.0.13-1~deb12u1 \
git=1:2.39.2-1.1 \
apt-get satisfy -y "nodejs (>=18.19.0), curl (>=7.88.1), pkg-config (>=1.8.1), libssl-dev (>=3.0.14), git (>=2.39.2), libdbus-1-dev (>= 1.14.10)" \
&& \
rm -r /var/lib/apt/lists/*
RUN curl -L https://github.com/cargo-bins/cargo-binstall/releases/latest/download/cargo-binstall-x86_64-unknown-linux-musl.tgz -o cargo-binstall.tgz && \
RUN curl -L https://github.com/cargo-bins/cargo-binstall/releases/download/v1.9.0/cargo-binstall-x86_64-unknown-linux-musl.tgz -o cargo-binstall.tgz && \
tar -xzf cargo-binstall.tgz && \
rm cargo-binstall.tgz && \
mv cargo-binstall /usr/local/bin/
RUN cargo binstall -y cargo-chef
RUN rustup component add rustfmt clippy
RUN cargo binstall -y \
cargo-chef@0.1 \
cargo-hack@0.6 \
cargo-machete@0.6.2 \
release-plz@0.3
COPY entrypoint.sh /
RUN git config --global user.email "action@git.kemitix.net" && git config --global user.name "ForgeJo Action. See: https://git.kemitix.net/kemitix/rust"
RUN git config --global user.email "action@git.kemitix.net" && \
git config --global user.name "ForgeJo Action. See: https://git.kemitix.net/kemitix/rust"
ENTRYPOINT [ "/entrypoint.sh" ]

View file

@ -14,32 +14,30 @@ jobs:
steps:
- uses: https://git.kemitix.net/kemitix/rust@v1.80.0
with:
args: test
args: nightly cargo test
- uses: https://git.kemitix.net/kemitix/rust@v1.80.0
with:
args: build
args: v1.79.0 cargo build
```
The `args` is one of the following:
- <COMMAND>
- [ nightly | stable | v1.xx.x ] <COMMAND>
`COMMAND` is the command you want to run. The optional prefix is the Rust toolchain, or version. Allowed values are `nightly`, `stable` or a Rust version.
Where the optional prefix is not given, the `stable` toolchain will be used.
## Contents
- nodejs
- clang-16
- mold
- rust
- git
- cargo
- cargo-binstall
## Linking
To take advantage of the clang and mold packages, add the following to the `.cargo/config.toml` file in your project.
```toml
[target.x86_64-unknown-linux-gnu]
linker = "/usr/bin/clang-16"
rustflags = ["-C", "link-arg=--ld-path=/usr/bin/mold"]
```
## Binary size
To reduce the size of the debug binary, add the following to the `.cargo/config.toml` file in you project.

View file

@ -2,4 +2,49 @@
set -e
cargo ${INPUT_ARGS}
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
if test "${ARGS[0]}" == "cargo";then
PRE_COMMAND="cargo +${TOOLCHAIN} "
else
PRE_COMMAND="${ARGS[0]}"
fi
ARGS=("${ARGS[@]:1}")
# ensure toolchain is up-to-date
# recombine remaining arguments
COMMAND=$(
IFS=" "
echo "${ARGS[*]}"
)
# execute command
echo ">>> ${PRE_COMMAND} ${COMMAND}"
${PRE_COMMAND} ${COMMAND}