Compare commits
19 commits
Author | SHA1 | Date | |
---|---|---|---|
75ceb6061c | |||
d135d5869d | |||
68a78fbaa3 | |||
3daf1c7ccf | |||
18e606baa8 | |||
cdce2e3048 | |||
8b9b16aa2e | |||
c6101c1e9e | |||
3fa43fa798 | |||
b352ee0e67 | |||
d9532aa17a | |||
5fc345c0de | |||
dbe6a60417 | |||
e931692d33 | |||
41d2bb484e | |||
de4785cc29 | |||
c231f792f2 | |||
|
af08c9a7ce | ||
ec0b626ed8 |
4 changed files with 89 additions and 32 deletions
|
@ -5,20 +5,42 @@ on:
|
||||||
jobs:
|
jobs:
|
||||||
test:
|
test:
|
||||||
runs-on: docker
|
runs-on: docker
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
toolchain:
|
||||||
|
- name: stable
|
||||||
|
- name: nightly
|
||||||
|
- name: v1.81.0
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Machete
|
||||||
|
uses: https://git.kemitix.net/kemitix/rust@next
|
||||||
|
with:
|
||||||
|
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
|
- name: Test
|
||||||
uses: https://git.kemitix.net/kemitix/rust@next
|
uses: https://git.kemitix.net/kemitix/rust@next
|
||||||
with:
|
with:
|
||||||
args: cargo test
|
args: ${{ matrix.toolchain.name }} cargo test
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
uses: https://git.kemitix.net/kemitix/rust@next
|
uses: https://git.kemitix.net/kemitix/rust@next
|
||||||
with:
|
with:
|
||||||
args: cargo build
|
args: ${{ matrix.toolchain.name }} cargo build
|
||||||
|
|
||||||
- name: Run
|
- name: Run
|
||||||
uses: https://git.kemitix.net/kemitix/rust@next
|
uses: https://git.kemitix.net/kemitix/rust@next
|
||||||
with:
|
with:
|
||||||
args: cargo run
|
args: ${{ matrix.toolchain.name }} cargo run
|
||||||
|
|
20
Dockerfile
20
Dockerfile
|
@ -1,4 +1,4 @@
|
||||||
FROM docker.io/rust:1.80.1-slim-bookworm
|
FROM docker.io/rust:1.81.0-slim-bookworm
|
||||||
|
|
||||||
# nodejs - runtime used by forgejo/github actions
|
# nodejs - runtime used by forgejo/github actions
|
||||||
# curl - to download cargo-binstall
|
# curl - to download cargo-binstall
|
||||||
|
@ -9,16 +9,7 @@ FROM docker.io/rust:1.80.1-slim-bookworm
|
||||||
# git - git
|
# git - git
|
||||||
RUN apt-get update \
|
RUN apt-get update \
|
||||||
&& \
|
&& \
|
||||||
apt-get install -y \
|
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)" \
|
||||||
--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 \
|
|
||||||
libdbus-1-dev=1.14.10-1~deb12u1 \
|
|
||||||
git=1:2.39.2-1.1 \
|
|
||||||
&& \
|
&& \
|
||||||
rm -r /var/lib/apt/lists/*
|
rm -r /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
@ -28,9 +19,10 @@ RUN curl -L https://github.com/cargo-bins/cargo-binstall/releases/download/v1.9.
|
||||||
mv cargo-binstall /usr/local/bin/
|
mv cargo-binstall /usr/local/bin/
|
||||||
|
|
||||||
RUN cargo binstall -y \
|
RUN cargo binstall -y \
|
||||||
cargo-chef@0.1.67 \
|
cargo-chef@0.1 \
|
||||||
release-plz@0.3.80 && \
|
cargo-hack@0.6 \
|
||||||
rustup component add rustfmt clippy
|
cargo-machete@0.6.2 \
|
||||||
|
release-plz@0.3
|
||||||
|
|
||||||
COPY entrypoint.sh /
|
COPY entrypoint.sh /
|
||||||
|
|
||||||
|
|
26
README.md
26
README.md
|
@ -14,32 +14,30 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
- uses: https://git.kemitix.net/kemitix/rust@v1.80.0
|
- uses: https://git.kemitix.net/kemitix/rust@v1.80.0
|
||||||
with:
|
with:
|
||||||
args: test
|
args: nightly cargo test
|
||||||
- uses: https://git.kemitix.net/kemitix/rust@v1.80.0
|
- uses: https://git.kemitix.net/kemitix/rust@v1.80.0
|
||||||
with:
|
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
|
## Contents
|
||||||
|
|
||||||
- nodejs
|
- nodejs
|
||||||
- clang-16
|
|
||||||
- mold
|
|
||||||
- rust
|
- rust
|
||||||
- git
|
- git
|
||||||
- cargo
|
- cargo
|
||||||
- cargo-binstall
|
- 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
|
## Binary size
|
||||||
|
|
||||||
To reduce the size of the debug binary, add the following to the `.cargo/config.toml` file in you project.
|
To reduce the size of the debug binary, add the following to the `.cargo/config.toml` file in you project.
|
||||||
|
|
|
@ -2,4 +2,49 @@
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
${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}
|
||||||
|
|
Loading…
Reference in a new issue