Compare commits
No commits in common. "main" and "v0.3.1" have entirely different histories.
5 changed files with 39 additions and 110 deletions
|
@ -1,46 +1,21 @@
|
|||
on:
|
||||
push:
|
||||
branches:
|
||||
- next
|
||||
on: [push]
|
||||
jobs:
|
||||
test:
|
||||
runs-on: docker
|
||||
strategy:
|
||||
matrix:
|
||||
toolchain:
|
||||
- name: stable
|
||||
- name: nightly
|
||||
- name: v1.81.0
|
||||
|
||||
steps:
|
||||
- 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
|
||||
uses: https://git.kemitix.net/kemitix/rust@next
|
||||
uses: https://git.kemitix.net/kemitix/rust@v0.3.1
|
||||
with:
|
||||
args: ${{ matrix.toolchain.name }} cargo test
|
||||
args: test
|
||||
|
||||
- name: Build
|
||||
uses: https://git.kemitix.net/kemitix/rust@next
|
||||
uses: https://git.kemitix.net/kemitix/rust@v0.3.1
|
||||
with:
|
||||
args: ${{ matrix.toolchain.name }} cargo build
|
||||
args: build
|
||||
|
||||
- name: Run
|
||||
uses: https://git.kemitix.net/kemitix/rust@next
|
||||
uses: https://git.kemitix.net/kemitix/rust@v0.3.1
|
||||
with:
|
||||
args: ${{ matrix.toolchain.name }} cargo run
|
||||
args: run
|
||||
|
|
27
Dockerfile
27
Dockerfile
|
@ -1,32 +1,35 @@
|
|||
FROM docker.io/rust:1.82.0-slim-bookworm
|
||||
FROM docker.io/rust:1.78.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 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), libtag1-dev (>= 1.13), libtagc0-dev (>= 1.13), xorg-dev (>=7.7), libxcb-shape0-dev (>=0.15), libxcb-xfixes0-dev (>=0.15)" \
|
||||
apt-get install -y \
|
||||
--no-install-recommends \
|
||||
nodejs=18.19.0+dfsg-6~deb12u1 \
|
||||
curl=7.88.1-10+deb12u5 \
|
||||
clang-16=1:16.0.6-15~deb12u1 \
|
||||
mold=1.10.1+dfsg-1 \
|
||||
pkg-config=1.8.1-1 \
|
||||
libssl-dev=3.0.11-1~deb12u2 \
|
||||
git=1:2.39.2-1.1 \
|
||||
&& \
|
||||
rm -r /var/lib/apt/lists/*
|
||||
|
||||
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 && \
|
||||
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 && \
|
||||
tar -xzf cargo-binstall.tgz && \
|
||||
rm cargo-binstall.tgz && \
|
||||
mv cargo-binstall /usr/local/bin/
|
||||
|
||||
RUN cargo binstall -y \
|
||||
cargo-chef@0.1 \
|
||||
cargo-hack@0.6 \
|
||||
cargo-machete@0.6.2 \
|
||||
release-plz@0.3
|
||||
RUN cargo binstall -y cargo-chef
|
||||
|
||||
RUN rustup component add rustfmt clippy
|
||||
|
||||
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" ]
|
||||
|
|
30
README.md
30
README.md
|
@ -12,32 +12,34 @@ jobs:
|
|||
test:
|
||||
runs-on: docker
|
||||
steps:
|
||||
- uses: https://git.kemitix.net/kemitix/rust@v2.3.0
|
||||
- uses: https://git.kemitix.net/kemitix/rust@v0.3.1
|
||||
with:
|
||||
args: nightly cargo test
|
||||
- uses: https://git.kemitix.net/kemitix/rust@v2.3.0
|
||||
args: test
|
||||
- uses: https://git.kemitix.net/kemitix/rust@v0.3.1
|
||||
with:
|
||||
args: v1.79.0 cargo build
|
||||
args: 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.
|
||||
|
|
|
@ -2,49 +2,4 @@
|
|||
|
||||
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
|
||||
|
||||
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}
|
||||
cargo ${INPUT_ARGS}
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
{
|
||||
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
||||
"extends": [
|
||||
"config:recommended"
|
||||
]
|
||||
}
|
Loading…
Reference in a new issue