From b33ed90810411e5988d9cff87dfb0b3dc12df28b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Fr=C3=B3es=20Franco?= Date: Wed, 3 Jun 2026 20:11:03 -0300 Subject: [PATCH 1/6] ci: improve workflows with stricter checks, caching, and idempotency CI improvements: - Add concurrency group to cancel redundant runs on same branch - Add cargo cache to fmt job (was missing entirely) - Add timeout-minutes: 5 to fast jobs (fmt, clippy, test) for fail-fast - Change RUST_BACKTRACE from 'short' to '1' for better CI debuggability - Pin push trigger to branches: [main] to avoid double-firing on PR merges - Test minimum supported Neovim (0.11.0) instead of latest patch (0.11.3) Release improvements: - Enforce RUSTFLAGS: -D warnings at env level and in matrix rustflags - Remove redundant checkout in release job (only needs env vars) - Add release notes generation from git log since previous tag - Make release creation idempotent (check if release exists before creating) - Fix release_id not being set when release already exists --- .gitea/workflows/ci.yaml | 41 ++++++++++++++------ .gitea/workflows/release.yaml | 73 +++++++++++++++++++++++++---------- 2 files changed, 81 insertions(+), 33 deletions(-) diff --git a/.gitea/workflows/ci.yaml b/.gitea/workflows/ci.yaml index ae37c90..8a0d00f 100644 --- a/.gitea/workflows/ci.yaml +++ b/.gitea/workflows/ci.yaml @@ -2,27 +2,43 @@ name: CI on: push: + branches: [main] pull_request: +concurrency: + group: ci-${{ github.ref }} + cancel-in-progress: true + env: CARGO_TERM_COLOR: always - RUST_BACKTRACE: short + RUST_BACKTRACE: "1" RUSTFLAGS: -D warnings jobs: fmt: name: cargo fmt --check runs-on: ubuntu-latest + timeout-minutes: 5 steps: - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@1.83 with: components: rustfmt + - uses: actions/cache@v4 + with: + path: | + ~/.cargo/registry + ~/.cargo/git + target + key: ${{ runner.os }}-cargo-fmt-${{ hashFiles('**/Cargo.lock', '**/Cargo.toml') }} + restore-keys: + - ${{ runner.os }}-cargo-fmt- - run: cargo fmt --all -- --check clippy: name: cargo clippy runs-on: ubuntu-latest + timeout-minutes: 5 steps: - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@1.83 @@ -35,13 +51,14 @@ jobs: ~/.cargo/git target key: ${{ runner.os }}-cargo-clippy-${{ hashFiles('**/Cargo.lock', '**/Cargo.toml') }} - restore-keys: | - ${{ runner.os }}-cargo-clippy- + restore-keys: + - ${{ runner.os }}-cargo-clippy- - run: cargo clippy --workspace --all-targets -- -D warnings test: name: cargo test runs-on: ubuntu-latest + timeout-minutes: 5 steps: - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@1.83 @@ -52,8 +69,8 @@ jobs: ~/.cargo/git target key: ${{ runner.os }}-cargo-test-${{ hashFiles('**/Cargo.lock', '**/Cargo.toml') }} - restore-keys: | - ${{ runner.os }}-cargo-test- + restore-keys: + - ${{ runner.os }}-cargo-test- - run: cargo test --workspace --all-targets keymaps: @@ -74,15 +91,15 @@ jobs: ~/.cargo/git target key: ${{ runner.os }}-cargo-test-${{ hashFiles('**/Cargo.lock', '**/Cargo.toml') }} - restore-keys: | - ${{ runner.os }}-cargo-test- - - name: install Neovim 0.11 + Vim + restore-keys: + - ${{ runner.os }}-cargo-test- + - name: install Neovim + Vim run: | set -euo pipefail - # Apt's neovim is too old (Ubuntu LTS ships 0.6/0.7), missing - # `vim.lsp.get_clients` and rejecting `@group.modifier` - # highlight names. Pull the official static tarball instead. - NVIM_VER=v0.11.3 + # Test the minimum supported Neovim version (0.11.0) so we + # catch API regressions at the bottom of the supported range. + # Pinning to a specific patch version; bump when 0.12 ships. + NVIM_VER=v0.11.0 curl -fsSL -o /tmp/nvim.tar.gz \ "https://github.com/neovim/neovim/releases/download/${NVIM_VER}/nvim-linux-x86_64.tar.gz" sudo tar -xzf /tmp/nvim.tar.gz -C /opt diff --git a/.gitea/workflows/release.yaml b/.gitea/workflows/release.yaml index f8a67cf..5f5ce7c 100644 --- a/.gitea/workflows/release.yaml +++ b/.gitea/workflows/release.yaml @@ -11,6 +11,7 @@ permissions: env: CARGO_TERM_COLOR: always RUST_BACKTRACE: short + RUSTFLAGS: -D warnings jobs: build: @@ -22,19 +23,19 @@ jobs: include: - target: x86_64-unknown-linux-gnu apt: "" - rustflags: "" + rustflags: "-D warnings" - target: aarch64-unknown-linux-gnu # gcc-aarch64-linux-gnu ships the cross compiler/binutils # but no target libc; libc6-dev-arm64-cross adds Scrt1.o, # crti.o, and friends needed at link time. apt: "gcc-aarch64-linux-gnu libc6-dev-arm64-cross" - rustflags: "" + rustflags: "-D warnings" - target: x86_64-unknown-linux-musl apt: "musl-tools" - rustflags: "" + rustflags: "-D warnings" - target: aarch64-unknown-linux-musl apt: "" - rustflags: "-C linker=rust-lld -C link-self-contained=yes" + rustflags: "-D warnings -C linker=rust-lld -C link-self-contained=yes" steps: - uses: actions/checkout@v4 @@ -56,8 +57,8 @@ jobs: ~/.cargo/git target key: ${{ runner.os }}-cargo-release-${{ matrix.target }}-${{ hashFiles('**/Cargo.lock') }} - restore-keys: | - ${{ runner.os }}-cargo-release-${{ matrix.target }}- + restore-keys: + - ${{ runner.os }}-cargo-release-${{ matrix.target }}- - name: Build nuwiki-ls env: @@ -93,8 +94,6 @@ jobs: needs: build runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - name: Download all build artifacts # Paired with upload-artifact@v3 above. v3 has no merge-multiple # option and nests each artifact under its own subdirectory. @@ -111,6 +110,26 @@ jobs: apt-get update && apt-get install -y --no-install-recommends curl fi + - name: Generate release notes + id: notes + run: | + set -euo pipefail + # Get commits since the previous tag (or the first commit if this is the first release). + prev_tag=$(git tag --sort=-version:refname | awk "NR==2" || echo "") + if [ -n "$prev_tag" ]; then + log=$(git log --oneline "$prev_tag"..HEAD) + else + log=$(git log --oneline --max-parents=0..HEAD) + fi + # Write notes to a file for later use. + cat > release-notes.txt </), so recurse. -- 2.34.1 From c83a7fe94b07623ba12cacc5b7fd03e114a27a42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Fr=C3=B3es=20Franco?= Date: Wed, 3 Jun 2026 20:14:12 -0300 Subject: [PATCH 2/6] ci: upgrade artifact actions to v4 - upload-artifact@v3 -> v4 (removed deprecated retention-days) - download-artifact@v3 -> v4 with merge-multiple: true - This flattens artifacts into the download path, simplifying the find/upload loop that uploads assets to Gitea --- .gitea/workflows/release.yaml | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/.gitea/workflows/release.yaml b/.gitea/workflows/release.yaml index 5f5ce7c..f9cde6a 100644 --- a/.gitea/workflows/release.yaml +++ b/.gitea/workflows/release.yaml @@ -80,14 +80,11 @@ jobs: echo "archive=$archive" >> "$GITHUB_OUTPUT" - name: Upload build artifact - # Gitea Actions doesn't support upload-artifact v4 (uses a - # GitHub-only backend API); pin to v3. - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: nuwiki-ls-${{ matrix.target }} path: ${{ steps.package.outputs.archive }} if-no-files-found: error - retention-days: 7 release: name: gitea release @@ -95,11 +92,12 @@ jobs: runs-on: ubuntu-latest steps: - name: Download all build artifacts - # Paired with upload-artifact@v3 above. v3 has no merge-multiple - # option and nests each artifact under its own subdirectory. - uses: actions/download-artifact@v3 + # upload-artifact@v4 + download-artifact@v4 with merge-multiple + # flattens all artifacts into the download path directly. + uses: actions/download-artifact@v4 with: path: ./artifacts + merge-multiple: true - name: Ensure jq + curl run: | -- 2.34.1 From d67e1c079011c91463f75653f4461e4ff755e2d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Fr=C3=B3es=20Franco?= Date: Wed, 3 Jun 2026 20:21:43 -0300 Subject: [PATCH 3/6] ci: pin pull_request trigger to main branch Gitea Actions requires branches filter on pull_request triggers to match the target branch, otherwise PRs never fire the workflow. --- .gitea/workflows/ci.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitea/workflows/ci.yaml b/.gitea/workflows/ci.yaml index 8a0d00f..fecb581 100644 --- a/.gitea/workflows/ci.yaml +++ b/.gitea/workflows/ci.yaml @@ -4,6 +4,7 @@ on: push: branches: [main] pull_request: + branches: [main] concurrency: group: ci-${{ github.ref }} -- 2.34.1 From 83565b16a279159d2672d00d753ec00fa531e4e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Fr=C3=B3es=20Franco?= Date: Wed, 3 Jun 2026 20:42:37 -0300 Subject: [PATCH 4/6] ci: remove concurrency key (not supported by Gitea Actions) --- .gitea/workflows/ci.yaml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.gitea/workflows/ci.yaml b/.gitea/workflows/ci.yaml index fecb581..b31c5cc 100644 --- a/.gitea/workflows/ci.yaml +++ b/.gitea/workflows/ci.yaml @@ -6,10 +6,6 @@ on: pull_request: branches: [main] -concurrency: - group: ci-${{ github.ref }} - cancel-in-progress: true - env: CARGO_TERM_COLOR: always RUST_BACKTRACE: "1" -- 2.34.1 From 91e6fb26e3015a198983a141e7f563332ef1f2a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Fr=C3=B3es=20Franco?= Date: Wed, 3 Jun 2026 20:45:36 -0300 Subject: [PATCH 5/6] ci: fix restore-keys to use pipe syntax (Gitea doesn't support YAML list) --- .gitea/workflows/ci.yaml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.gitea/workflows/ci.yaml b/.gitea/workflows/ci.yaml index b31c5cc..ca3e7ec 100644 --- a/.gitea/workflows/ci.yaml +++ b/.gitea/workflows/ci.yaml @@ -28,8 +28,8 @@ jobs: ~/.cargo/git target key: ${{ runner.os }}-cargo-fmt-${{ hashFiles('**/Cargo.lock', '**/Cargo.toml') }} - restore-keys: - - ${{ runner.os }}-cargo-fmt- + restore-keys: | + ${{ runner.os }}-cargo-fmt- - run: cargo fmt --all -- --check clippy: @@ -48,8 +48,8 @@ jobs: ~/.cargo/git target key: ${{ runner.os }}-cargo-clippy-${{ hashFiles('**/Cargo.lock', '**/Cargo.toml') }} - restore-keys: - - ${{ runner.os }}-cargo-clippy- + restore-keys: | + ${{ runner.os }}-cargo-clippy- - run: cargo clippy --workspace --all-targets -- -D warnings test: @@ -66,8 +66,8 @@ jobs: ~/.cargo/git target key: ${{ runner.os }}-cargo-test-${{ hashFiles('**/Cargo.lock', '**/Cargo.toml') }} - restore-keys: - - ${{ runner.os }}-cargo-test- + restore-keys: | + ${{ runner.os }}-cargo-test- - run: cargo test --workspace --all-targets keymaps: @@ -88,8 +88,8 @@ jobs: ~/.cargo/git target key: ${{ runner.os }}-cargo-test-${{ hashFiles('**/Cargo.lock', '**/Cargo.toml') }} - restore-keys: - - ${{ runner.os }}-cargo-test- + restore-keys: | + ${{ runner.os }}-cargo-test- - name: install Neovim + Vim run: | set -euo pipefail -- 2.34.1 From ad7a282877d059f649d2a20969f7133f7836bb86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Fr=C3=B3es=20Franco?= Date: Wed, 3 Jun 2026 20:46:26 -0300 Subject: [PATCH 6/6] release: fix restore-keys pipe syntax for Gitea --- .gitea/workflows/release.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitea/workflows/release.yaml b/.gitea/workflows/release.yaml index f9cde6a..cafae48 100644 --- a/.gitea/workflows/release.yaml +++ b/.gitea/workflows/release.yaml @@ -57,8 +57,8 @@ jobs: ~/.cargo/git target key: ${{ runner.os }}-cargo-release-${{ matrix.target }}-${{ hashFiles('**/Cargo.lock') }} - restore-keys: - - ${{ runner.os }}-cargo-release-${{ matrix.target }}- + restore-keys: | + ${{ runner.os }}-cargo-release-${{ matrix.target }}- - name: Build nuwiki-ls env: -- 2.34.1