[FEATURE] Add pipelines #1
72
.gitea/workflows/ci.yaml
Normal file
72
.gitea/workflows/ci.yaml
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
name: Cargo Build & Test
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
test:
|
||||||
|
container: git.kjan.de/actions/rust-node
|
||||||
|
name: Tests
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- name: ⚡ Cache
|
||||||
|
uses: https://git.kjan.de/actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
~/.cargo/registry
|
||||||
|
~/.cargo/git
|
||||||
|
target/release/deps
|
||||||
|
target/release/build
|
||||||
|
target
|
||||||
|
key: ${{ runner.os }}-cargo-${{ hashFiles('Cargo.lock') }}-loadstar
|
||||||
|
- run: cargo test
|
||||||
|
|
||||||
|
can-publish:
|
||||||
|
container: git.kjan.de/actions/rust-node
|
||||||
|
name: Test publish
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- name: ⚡ Cache
|
||||||
|
uses: https://git.kjan.de/actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
~/.cargo/registry
|
||||||
|
~/.cargo/git
|
||||||
|
target/release/deps
|
||||||
|
target/release/build
|
||||||
|
target
|
||||||
|
key: ${{ runner.os }}-cargo-${{ hashFiles('Cargo.lock') }}-loadstar
|
||||||
|
- run: cargo publish -n
|
||||||
|
|
||||||
|
check-cargo-version:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Get current version from Cargo.toml
|
||||||
|
id: cargo-version
|
||||||
|
run: |
|
||||||
|
# Extract the version from Cargo.toml in the PR branch
|
||||||
|
CARGO_VERSION=$(grep '^version' Cargo.toml | sed -e 's/version = "//' -e 's/"//')
|
||||||
|
echo "cargo_version=$CARGO_VERSION" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
- name: Get previous version from main branch
|
||||||
|
id: main-cargo-version
|
||||||
|
run: |
|
||||||
|
# Fetch the Cargo.toml from the main branch and extract its version
|
||||||
|
git fetch origin main
|
||||||
|
MAIN_CARGO_VERSION=$(git show origin/main:Cargo.toml | grep '^version' | sed -e 's/version = "//' -e 's/"//')
|
||||||
|
echo "main_cargo_version=$MAIN_CARGO_VERSION" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
- name: Compare versions
|
||||||
|
run: |
|
||||||
|
if [ "$cargo_version" = "$main_cargo_version" ]; then
|
||||||
|
echo "Cargo version has not been updated."
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
echo "Cargo version has been updated."
|
||||||
|
fi
|
26
.gitea/workflows/publish.yaml
Normal file
26
.gitea/workflows/publish.yaml
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
name: Cargo Build & Test
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
can-publish:
|
||||||
|
container: git.kjan.de/actions/rust-node
|
||||||
|
name: Test publish
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- name: ⚡ Cache
|
||||||
|
uses: https://git.kjan.de/actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
~/.cargo/registry
|
||||||
|
~/.cargo/git
|
||||||
|
target/release/deps
|
||||||
|
target/release/build
|
||||||
|
target
|
||||||
|
key: ${{ runner.os }}-cargo-${{ hashFiles('Cargo.lock') }}-loadstar
|
||||||
|
- run: cargo login ${{ secrets.CRATES_IO_TOKEN }}
|
||||||
|
- run: cargo publish
|
2
Cargo.lock
generated
2
Cargo.lock
generated
@ -22,7 +22,7 @@ checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "loadstar"
|
name = "loadstar"
|
||||||
version = "0.0.2"
|
version = "0.0.3"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"tiny_http",
|
"tiny_http",
|
||||||
]
|
]
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
name = "loadstar"
|
name = "loadstar"
|
||||||
description = "A simple web framework for rust"
|
description = "A simple web framework for rust"
|
||||||
repository = "https://git.kjan.de/jank/loadstar"
|
repository = "https://git.kjan.de/jank/loadstar"
|
||||||
version = "0.0.2"
|
version = "0.0.3"
|
||||||
license = "GPL-3.0-only"
|
license = "GPL-3.0-only"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user