build: switch to forgejo actions
Some checks failed
Rust / build (map[name:nightly]) (push) Failing after 1m8s
Rust / build (map[name:stable]) (push) Failing after 2m16s

- Replace the woodpecker config with forgejo actions.
- Add issue number to TODOs to pass CI check
- Remove special clang/mold linker commands
- Remove docker builder
- Add lints.rust.unexoected_cfgs to allo tarpaulin_include
This commit is contained in:
Paul Campbell 2024-10-29 22:11:26 +00:00
parent d90a1c42c8
commit 037e7aca79
7 changed files with 94 additions and 100 deletions

View file

@ -1,7 +1,4 @@
# ./cargo/config
[target.x86_64-unknown-linux-gnu]
linker = "/usr/bin/clang-15"
rustflags = ["-C", "link-arg=--ld-path=/usr/bin/mold", "--cfg", "tokio_unstable"]
[profile.dev]
debug = 0

View file

@ -0,0 +1,36 @@
name: Release Please
permissions:
pull-requests: write
contents: write
on:
push:
branches:
- main
env:
CARGO_TERM_COLOR: always
jobs:
release-plz:
name: Release-plz
runs-on: docker
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Run release-plz release-pr
uses: https://git.kemitix.net/kemitix/rust@v2.3.0
with:
args: release-plz release-pr --backend gitea --git-token ${{ secrets.FORGEJO_TOKEN }}
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
- name: Run release-plz release
uses: https://git.kemitix.net/kemitix/rust@v2.3.0
with:
args: release-plz release --backend gitea --git-token ${{ secrets.FORGEJO_TOKEN }}
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}

View file

@ -0,0 +1,53 @@
name: Rust
on:
push:
branches: ["next"]
pull_request:
branches: ["main"]
env:
CARGO_TERM_COLOR: always
jobs:
build:
runs-on: docker
strategy:
matrix:
toolchain:
- name: stable
- name: nightly
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Check TODOs
uses: kemitix/todo-checker@v1.1.0
- name: Machete
uses: https://git.kemitix.net/kemitix/rust@v2.3.0
with:
args: ${{ matrix.toolchain.name }} cargo machete
- name: Format
uses: https://git.kemitix.net/kemitix/rust@v2.3.0
with:
args: ${{ matrix.toolchain.name }} cargo fmt --all -- --check
- name: Clippy
uses: https://git.kemitix.net/kemitix/rust@v2.3.0
with:
args: ${{ matrix.toolchain.name }} cargo hack --feature-powerset clippy
- name: Build
uses: https://git.kemitix.net/kemitix/rust@v2.3.0
with:
args: ${{ matrix.toolchain.name }} cargo hack --feature-powerset build
- name: Test
uses: https://git.kemitix.net/kemitix/rust@v2.3.0
with:
args: ${{ matrix.toolchain.name }} cargo hack --feature-powerset test

View file

@ -1,72 +0,0 @@
steps:
update-builder-image:
when:
- event: cron
image: docker.io/woodpeckerci/plugin-docker-buildx:4.2
settings:
username: kemitix
repo: git.kemitix.net/kemitix/kxio-builder
auto_tag: true
dockerfile: Dockerfile.builder
dry-run: false # push to remote repo
registry: git.kemitix.net
password:
from_secret: woodpecker-docker-push
todo_check:
# INFO: https://woodpecker-ci.org/plugins/TODO-Checker
image: codeberg.org/epsilon_02/todo-checker:1.1
when:
- event: push
branch: [main, next]
settings:
# kxio-woodpecker-todo-checker - read:issue
repository_token: "4acf14f93747e044aa2d1397367741b53f3d4f8f"
prefix_regex: "(#|//) (TODO|FIXME): "
debug: false
lint_and_build:
when:
- event: push
branch: [main, next]
- event: tag
image: git.kemitix.net/kemitix/kxio-builder:latest
environment:
CARGO_TERM_COLOR: always
commands:
- ls -l /usr/local/cargo/bin/
- cargo fmt --all -- --check
- cargo clippy --features "fs,network" -- -D warnings -W clippy::nursery -W clippy::unwrap_used -W clippy::expect_used
- cargo build --features "fs,network"
test:
when:
- event: push
branch: [main, next]
- event: tag
image: git.kemitix.net/kemitix/kxio-builder:latest
environment:
CARGO_TERM_COLOR: always
commands:
- cargo test --features "fs,network"
publish_to_crates_io:
when:
- event: tag
image: docker.io/rust:1.81
commands:
- cargo login "$CARGO_REGISTRY_TOKEN"
- cargo publish --registry crates-io --no-verify
secrets: [cargo_registry_token]
publish_to_forgejo:
when:
- event: tag
# INFO: https://woodpecker-ci.org/plugins/Gitea%20Release
image: docker.io/woodpeckerci/plugin-gitea-release:latest
settings:
base_url: https://git.kemitix.net
api_key:
from_secret: FORGEJO_RELEASE_PLUGIN
target: main
prerelease: false

View file

@ -13,6 +13,9 @@ default = ["fs", "network"]
fs = []
network = []
[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(tarpaulin_include)'] }
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]

View file

@ -1,23 +0,0 @@
FROM docker.io/rust:latest
RUN apt-get update && \
apt-get install -y clang-15 mold && \
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/ && \
cargo binstall -y cargo-chef && \
rustup component add rustfmt clippy
# verify that the binaries are installed
RUN ls -l /usr/local/cargo/bin/
RUN cargo chef --version
RUN rustfmt --version
RUN cargo fmt --version
RUN cargo clippy --version
RUN mold --version
RUN clang-15 --version
RUN cargo --version
RUN rustc --version
RUN rustup --version
RUN rustup show

View file

@ -221,7 +221,7 @@ mod path_is_dir {
fn should_be_false_when_is_a_link() -> TestResult {
let fs = fs::temp()?;
let path = fs.base().join("foo");
// TODO create a link
// TODO: (#38) create a link
// let_assert!(Ok(_) = fs.file_write(&path, "bar"));
let_assert!(Ok(is_dir) = fs.path_is_dir(&path));
assert!(!is_dir);
@ -271,7 +271,7 @@ mod path_is_file {
fn should_be_false_when_is_a_link() -> TestResult {
let fs = fs::temp()?;
let path = fs.base().join("foo");
// TODO create a link
// TODO: (#38) create a link
// let_assert!(Ok(_) = fs.file_write(&path, "bar"));
let_assert!(Ok(is_file) = fs.path_is_file(&path));
assert!(!is_file);