ssh agent forwarding fix #71
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # SPDX-License-Identifier: 0BSD | |
| # Copyright (c) 2023-2026 Aryan Ameri | |
| # | |
| # ============================================================================= | |
| # YABB CI Workflow | |
| # Runs format check, lint, and tests on every push and PR | |
| # ============================================================================= | |
| name: CI | |
| on: | |
| push: | |
| branches: ["**"] | |
| pull_request: | |
| branches: [main] | |
| jobs: | |
| reuse: | |
| name: REUSE Compliance | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: REUSE Compliance Check | |
| uses: fsfe/reuse-action@v6 | |
| ci: | |
| name: Format, Lint, Test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Load versions from versions.env | |
| run: | | |
| # Source versions.env - the single source of truth | |
| if [ -f versions.env ]; then | |
| source versions.env | |
| echo "NIM_VERSION=$NIM_VERSION" >> $GITHUB_ENV | |
| echo "NPH_VERSION=$NPH_VERSION" >> $GITHUB_ENV | |
| echo "ZIG_VERSION=$ZIG_VERSION" >> $GITHUB_ENV | |
| echo "SHFMT_VERSION=$SHFMT_VERSION" >> $GITHUB_ENV | |
| echo "Loaded: NIM=$NIM_VERSION, NPH=$NPH_VERSION, ZIG=$ZIG_VERSION, SHFMT=$SHFMT_VERSION" | |
| else | |
| echo "ERROR: versions.env not found" | |
| exit 1 | |
| fi | |
| - name: Cache Nim + Zig toolchain | |
| uses: actions/cache@v4 | |
| id: toolchain-cache | |
| with: | |
| path: | | |
| ~/nim-${{ env.NIM_VERSION }} | |
| ~/zig | |
| ~/.nimble/bin | |
| ~/.nimble/pkgs2 | |
| key: toolchain-${{ runner.os }}-nim${{ env.NIM_VERSION }}-zig${{ env.ZIG_VERSION }}-${{ env.NPH_VERSION }}-${{ hashFiles('*.nimble') }} | |
| restore-keys: | | |
| toolchain-${{ runner.os }}-nim${{ env.NIM_VERSION }}-zig${{ env.ZIG_VERSION }}- | |
| - name: Install Zig | |
| if: steps.toolchain-cache.outputs.cache-hit != 'true' | |
| run: | | |
| cd ~ | |
| echo "Installing Zig ${{ env.ZIG_VERSION }}..." | |
| curl -LO "https://ziglang.org/download/${{ env.ZIG_VERSION }}/zig-x86_64-linux-${{ env.ZIG_VERSION }}.tar.xz" | |
| tar xf "zig-x86_64-linux-${{ env.ZIG_VERSION }}.tar.xz" | |
| rm -rf zig | |
| mv "zig-x86_64-linux-${{ env.ZIG_VERSION }}" zig | |
| rm -f "zig-x86_64-linux-${{ env.ZIG_VERSION }}.tar.xz" | |
| echo "Zig ${{ env.ZIG_VERSION }} installed successfully" | |
| - name: Install Nim from source | |
| if: steps.toolchain-cache.outputs.cache-hit != 'true' | |
| run: | | |
| cd ~ | |
| echo "Installing Nim ${{ env.NIM_VERSION }} from source..." | |
| curl -LO "https://nim-lang.org/download/nim-${{ env.NIM_VERSION }}.tar.xz" | |
| tar xf "nim-${{ env.NIM_VERSION }}.tar.xz" | |
| cd "nim-${{ env.NIM_VERSION }}" | |
| sh build.sh | |
| ./bin/nim c -d:release koch | |
| ./koch boot -d:release | |
| ./koch nimble | |
| ./bin/nim c -d:release -o:bin/testament testament/testament.nim | |
| cd .. | |
| rm -f "nim-${{ env.NIM_VERSION }}.tar.xz" | |
| echo "Nim ${{ env.NIM_VERSION }} installed successfully" | |
| - name: Add tools to PATH | |
| run: | | |
| echo "$HOME/nim-${{ env.NIM_VERSION }}/bin" >> $GITHUB_PATH | |
| echo "$HOME/.nimble/bin" >> $GITHUB_PATH | |
| echo "$HOME/zig" >> $GITHUB_PATH | |
| - name: Verify toolchain | |
| run: | | |
| nim --version | |
| nimble --version | |
| zig version | |
| - name: Install just | |
| uses: extractions/setup-just@v2 | |
| - name: Install shfmt and shellcheck | |
| run: | | |
| # Install shellcheck from apt (0.10.0 on Ubuntu 24.04) | |
| sudo apt-get update | |
| sudo apt-get install -y shellcheck | |
| # Install shfmt from GitHub releases | |
| curl -fsSL "https://github.com/mvdan/sh/releases/download/v${{ env.SHFMT_VERSION }}/shfmt_v${{ env.SHFMT_VERSION }}_linux_amd64" \ | |
| -o /tmp/shfmt | |
| sudo install -m 755 /tmp/shfmt /usr/local/bin/shfmt | |
| rm /tmp/shfmt | |
| # Verify installations | |
| shfmt --version | |
| shellcheck --version | |
| - name: Install zigcc | |
| run: | | |
| if ! command -v zigcc &> /dev/null; then | |
| nimble install -y zigcc | |
| fi | |
| zigcc --version | |
| - name: Install nph formatter | |
| if: steps.toolchain-cache.outputs.cache-hit != 'true' | |
| run: | | |
| # nph requires Nim 2.2.x compiler internals. Build from source using | |
| # our Nim to avoid nimble resolving to old nim package (2.0.8) | |
| git clone --depth 1 --branch "v${{ env.NPH_VERSION }}" https://github.com/arnetheduck/nph.git /tmp/nph | |
| cd /tmp/nph | |
| nimble setup | |
| nim c -d:release -o:"$HOME/.nimble/bin/nph" src/nph.nim | |
| cd - | |
| rm -rf /tmp/nph | |
| echo "nph installed: $(nph --version)" | |
| - name: Install project dependencies | |
| run: | | |
| # Pre-emptively remove any stale nim package from cache | |
| rm -rf ~/.nimble/pkgs2/nim-* | |
| nimble install -d --accept | |
| nimble setup | |
| # Remove again in case nimble reinstalled nim from registry | |
| rm -rf ~/.nimble/pkgs2/nim-* | |
| - name: Check formatting | |
| run: just fmt-check | |
| - name: Lint | |
| run: just lint | |
| - name: Run tests | |
| run: just test |