mirror of
https://github.com/GothenburgBitFactory/taskchampion-sync-server.git
synced 2025-06-26 10:54:29 +02:00
Add a suite of Rust-related actions (#55)
* Add a suite of Rust-related actions * cargo fmt * nightly for rustdoc
This commit is contained in:
parent
7d0325e807
commit
5769781553
4 changed files with 137 additions and 10 deletions
5
.github/workflows/build.yml
vendored
5
.github/workflows/build.yml
vendored
|
@ -10,10 +10,8 @@ jobs:
|
||||||
target:
|
target:
|
||||||
- tag: amd64-musl
|
- tag: amd64-musl
|
||||||
target: x86_64-unknown-linux-musl
|
target: x86_64-unknown-linux-musl
|
||||||
test: false
|
|
||||||
- tag: amd64-glibc
|
- tag: amd64-glibc
|
||||||
target: x86_64-unknown-linux-gnu
|
target: x86_64-unknown-linux-gnu
|
||||||
test: true
|
|
||||||
name: Build TaskChampion Sync-Server ${{ matrix.target.tag }}
|
name: Build TaskChampion Sync-Server ${{ matrix.target.tag }}
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
|
@ -26,9 +24,6 @@ jobs:
|
||||||
with:
|
with:
|
||||||
toolchain: ${{ env.RUST_VERSION }}
|
toolchain: ${{ env.RUST_VERSION }}
|
||||||
targets: ${{ matrix.target.target }}
|
targets: ${{ matrix.target.target }}
|
||||||
- name: Test
|
|
||||||
if: ${{ matrix.target.test }}
|
|
||||||
run: cargo test
|
|
||||||
- name: Build
|
- name: Build
|
||||||
run: |
|
run: |
|
||||||
[ "${{ matrix.target.target }}" == "x86_64-unknown-linux-musl" ] && sudo apt update && sudo apt -y install musl-tools
|
[ "${{ matrix.target.target }}" == "x86_64-unknown-linux-musl" ] && sudo apt update && sudo apt -y install musl-tools
|
||||||
|
|
86
.github/workflows/checks.yml
vendored
Normal file
86
.github/workflows/checks.yml
vendored
Normal file
|
@ -0,0 +1,86 @@
|
||||||
|
name: checks
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
pull_request:
|
||||||
|
types: [opened, reopened, synchronize]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
clippy:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
name: "Check & Clippy"
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Cache cargo registry
|
||||||
|
uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: ~/.cargo/registry
|
||||||
|
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
|
||||||
|
|
||||||
|
- name: Cache cargo build
|
||||||
|
uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: target
|
||||||
|
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
|
||||||
|
|
||||||
|
- uses: actions-rs/toolchain@v1
|
||||||
|
with:
|
||||||
|
toolchain: "stable"
|
||||||
|
override: true
|
||||||
|
components: clippy
|
||||||
|
|
||||||
|
- uses: actions-rs/cargo@v1.0.3
|
||||||
|
with:
|
||||||
|
command: check
|
||||||
|
|
||||||
|
- uses: actions-rs/clippy-check@v1
|
||||||
|
with:
|
||||||
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
args: --all-features --no-deps -- -D warnings
|
||||||
|
name: "Clippy Results"
|
||||||
|
|
||||||
|
rustdoc:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
name: "Rustdoc"
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Cache cargo registry
|
||||||
|
uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: ~/.cargo/registry
|
||||||
|
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
|
||||||
|
|
||||||
|
- uses: actions-rs/toolchain@v1
|
||||||
|
with:
|
||||||
|
toolchain: nightly
|
||||||
|
override: true
|
||||||
|
minimal: true
|
||||||
|
|
||||||
|
- uses: actions-rs/cargo@v1.0.3
|
||||||
|
with:
|
||||||
|
command: rustdoc
|
||||||
|
args: -p taskchampion-sync-server --all-features -- -Z unstable-options --check -Dwarnings
|
||||||
|
|
||||||
|
fmt:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
name: "Formatting"
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- uses: actions-rs/toolchain@v1
|
||||||
|
with:
|
||||||
|
profile: minimal
|
||||||
|
components: rustfmt
|
||||||
|
toolchain: stable
|
||||||
|
override: true
|
||||||
|
|
||||||
|
- uses: actions-rs/cargo@v1.0.3
|
||||||
|
with:
|
||||||
|
command: fmt
|
||||||
|
args: --all -- --check
|
42
.github/workflows/rust-tests.yml
vendored
Normal file
42
.github/workflows/rust-tests.yml
vendored
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
name: tests - rust
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
pull_request:
|
||||||
|
types: [opened, reopened, synchronize]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
test:
|
||||||
|
strategy:
|
||||||
|
# A simple matrix for now, but if we introduce an MSRV it can be added here.
|
||||||
|
matrix:
|
||||||
|
rust:
|
||||||
|
- "stable"
|
||||||
|
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
name: "rust ${{ matrix.rust }}"
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Cache cargo registry
|
||||||
|
uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: ~/.cargo/registry
|
||||||
|
key: ${{ runner.os }}-${{ matrix.rust }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
|
||||||
|
|
||||||
|
- name: Cache cargo build
|
||||||
|
uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: target
|
||||||
|
key: ${{ runner.os }}-${{ matrix.rust }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
|
||||||
|
|
||||||
|
- uses: actions-rs/toolchain@v1
|
||||||
|
with:
|
||||||
|
toolchain: "${{ matrix.rust }}"
|
||||||
|
override: true
|
||||||
|
|
||||||
|
- name: test
|
||||||
|
run: cargo test
|
|
@ -79,11 +79,15 @@ pub(crate) fn get_child_version<'a>(
|
||||||
// AddVersion will succeed if either
|
// AddVersion will succeed if either
|
||||||
// - the requested parent version is the latest version; or
|
// - the requested parent version is the latest version; or
|
||||||
// - there is no latest version, meaning there are no versions stored for this client
|
// - there is no latest version, meaning there are no versions stored for this client
|
||||||
Ok(if client.latest_version_id == parent_version_id || client.latest_version_id == NIL_VERSION_ID {
|
Ok(
|
||||||
GetVersionResult::NotFound
|
if client.latest_version_id == parent_version_id
|
||||||
} else {
|
|| client.latest_version_id == NIL_VERSION_ID
|
||||||
GetVersionResult::Gone
|
{
|
||||||
})
|
GetVersionResult::NotFound
|
||||||
|
} else {
|
||||||
|
GetVersionResult::Gone
|
||||||
|
},
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Response to add_version
|
/// Response to add_version
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue