From 7bad733ae5ade3407ec1465a589d44412bcb868c Mon Sep 17 00:00:00 2001 From: Jan Klattenhoff Date: Tue, 20 Aug 2024 10:23:13 +0200 Subject: [PATCH 1/7] Add pr pipeline --- .gitea/workflows/ci.yaml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 .gitea/workflows/ci.yaml diff --git a/.gitea/workflows/ci.yaml b/.gitea/workflows/ci.yaml new file mode 100644 index 0000000..86859f1 --- /dev/null +++ b/.gitea/workflows/ci.yaml @@ -0,0 +1,15 @@ +name: Cargo Build & Test + +on: + pull_request: + +jobs: + can-publish: + container: git.kjan.de/actions/rust-node + name: Test publish + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - run: cargo publish -n + + -- 2.45.2 From 29b0b133feca8ec0b37f97735f1cb5d37111c305 Mon Sep 17 00:00:00 2001 From: Jan Klattenhoff Date: Tue, 20 Aug 2024 10:24:46 +0200 Subject: [PATCH 2/7] Add Cache --- .gitea/workflows/ci.yaml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.gitea/workflows/ci.yaml b/.gitea/workflows/ci.yaml index 86859f1..09c0f7f 100644 --- a/.gitea/workflows/ci.yaml +++ b/.gitea/workflows/ci.yaml @@ -10,6 +10,16 @@ jobs: 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 -- 2.45.2 From 4ac4c6223dd8c74e1cb3489d68b8203cc0a8ddac Mon Sep 17 00:00:00 2001 From: Jan Klattenhoff Date: Tue, 20 Aug 2024 11:57:40 +0200 Subject: [PATCH 3/7] Check if cargo version is updated --- .gitea/workflows/ci.yaml | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/.gitea/workflows/ci.yaml b/.gitea/workflows/ci.yaml index 09c0f7f..60cfbcb 100644 --- a/.gitea/workflows/ci.yaml +++ b/.gitea/workflows/ci.yaml @@ -22,4 +22,33 @@ jobs: 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 -- 2.45.2 From 23047dc85535b2206df7706e7f652e8efcfe0b2d Mon Sep 17 00:00:00 2001 From: Jan Klattenhoff Date: Tue, 20 Aug 2024 11:59:01 +0200 Subject: [PATCH 4/7] Update cargo version --- Cargo.lock | 2 +- Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 533a5f7..5c48b31 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -22,7 +22,7 @@ checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" [[package]] name = "loadstar" -version = "0.0.2" +version = "0.0.3" dependencies = [ "tiny_http", ] diff --git a/Cargo.toml b/Cargo.toml index df526ce..15e69c9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,7 +2,7 @@ name = "loadstar" description = "A simple web framework for rust" repository = "https://git.kjan.de/jank/loadstar" -version = "0.0.2" +version = "0.0.3" license = "GPL-3.0-only" edition = "2021" -- 2.45.2 From c76cb8196bc21714a1cf8f6f4f7250c179800ecb Mon Sep 17 00:00:00 2001 From: Jan Klattenhoff Date: Tue, 20 Aug 2024 12:02:07 +0200 Subject: [PATCH 5/7] Add publish pipeline --- .gitea/workflows/publish.yaml | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 .gitea/workflows/publish.yaml diff --git a/.gitea/workflows/publish.yaml b/.gitea/workflows/publish.yaml new file mode 100644 index 0000000..c64fd03 --- /dev/null +++ b/.gitea/workflows/publish.yaml @@ -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.45.2 From f351ef4d46f942a71a362d5d4fee6d17596a207f Mon Sep 17 00:00:00 2001 From: Jan Klattenhoff Date: Tue, 20 Aug 2024 12:08:36 +0200 Subject: [PATCH 6/7] Add pipeline for tests --- .gitea/workflows/ci.yaml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/.gitea/workflows/ci.yaml b/.gitea/workflows/ci.yaml index 60cfbcb..a56806f 100644 --- a/.gitea/workflows/ci.yaml +++ b/.gitea/workflows/ci.yaml @@ -4,6 +4,24 @@ on: pull_request: jobs: + test: + 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 test + can-publish: container: git.kjan.de/actions/rust-node name: Test publish -- 2.45.2 From 69aff9fa3ef6e9d7112711b2e5469be260a345fa Mon Sep 17 00:00:00 2001 From: Jan Klattenhoff Date: Tue, 20 Aug 2024 12:09:43 +0200 Subject: [PATCH 7/7] Change pipeline name --- .gitea/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitea/workflows/ci.yaml b/.gitea/workflows/ci.yaml index a56806f..c6b18df 100644 --- a/.gitea/workflows/ci.yaml +++ b/.gitea/workflows/ci.yaml @@ -6,7 +6,7 @@ on: jobs: test: container: git.kjan.de/actions/rust-node - name: Test publish + name: Tests runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 -- 2.45.2