Skip to content

feat: context store, lazy recall, hooks, and self-documenting hints #64

feat: context store, lazy recall, hooks, and self-documenting hints

feat: context store, lazy recall, hooks, and self-documenting hints #64

Workflow file for this run

name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
permissions:
contents: write
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Build
run: cargo build
- name: Unit tests
run: cargo test
- name: Functional tests
run: bash tests/functional_test.sh
version:
needs: test
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
runs-on: ubuntu-latest
outputs:
version: ${{ steps.calc.outputs.version }}
tag: ${{ steps.calc.outputs.tag }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Calculate next version
id: calc
run: |
LATEST=$(git tag -l 'v*' --sort=-v:refname | head -1)
if [ -z "$LATEST" ]; then
TAG="v0.1.0"
else
PATCH=$(echo "$LATEST" | sed 's/v[0-9]*\.[0-9]*\.//')
MAJOR_MINOR=$(echo "$LATEST" | sed 's/\.[0-9]*$//')
TAG="${MAJOR_MINOR}.$((PATCH + 1))"
fi
echo "version=${TAG#v}" >> $GITHUB_OUTPUT
echo "tag=$TAG" >> $GITHUB_OUTPUT
echo "Next release: $TAG"
build:
needs: version
strategy:
matrix:
include:
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
name: plandb-linux-x86_64
- target: aarch64-unknown-linux-gnu
os: ubuntu-latest
name: plandb-linux-aarch64
- target: x86_64-apple-darwin
os: macos-latest
name: plandb-darwin-x86_64
- target: aarch64-apple-darwin
os: macos-latest
name: plandb-darwin-aarch64
- target: x86_64-pc-windows-msvc
os: windows-latest
name: plandb-windows-x86_64.exe
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Install cross-compilation tools
if: matrix.target == 'aarch64-unknown-linux-gnu'
run: |
sudo apt-get update
sudo apt-get install -y gcc-aarch64-linux-gnu
echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc" >> $GITHUB_ENV
- name: Set version in Cargo.toml
shell: bash
run: |
VERSION="${{ needs.version.outputs.version }}"
sed -i.bak "s/^version = \".*\"/version = \"${VERSION}\"/" Cargo.toml
rm -f Cargo.toml.bak
grep '^version' Cargo.toml
- name: Build
run: cargo build --release --target ${{ matrix.target }}
- name: Package (Unix)
if: runner.os != 'Windows'
run: |
cp target/${{ matrix.target }}/release/plandb ${{ matrix.name }}
chmod +x ${{ matrix.name }}
- name: Package (Windows)
if: runner.os == 'Windows'
shell: bash
run: cp target/${{ matrix.target }}/release/plandb.exe ${{ matrix.name }}
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.name }}
path: ${{ matrix.name }}
release:
needs: [version, build]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Generate checksums
run: |
cd artifacts
sha256sum \
plandb-linux-x86_64/plandb-linux-x86_64 \
plandb-linux-aarch64/plandb-linux-aarch64 \
plandb-darwin-x86_64/plandb-darwin-x86_64 \
plandb-darwin-aarch64/plandb-darwin-aarch64 \
plandb-windows-x86_64.exe/plandb-windows-x86_64.exe \
| sed 's|[^ ]*/||' > ../checksums.txt
- name: Create release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ needs.version.outputs.tag }}
name: Plandb ${{ needs.version.outputs.tag }}
generate_release_notes: true
files: |
artifacts/plandb-linux-x86_64/plandb-linux-x86_64
artifacts/plandb-linux-aarch64/plandb-linux-aarch64
artifacts/plandb-darwin-x86_64/plandb-darwin-x86_64
artifacts/plandb-darwin-aarch64/plandb-darwin-aarch64
artifacts/plandb-windows-x86_64.exe/plandb-windows-x86_64.exe
checksums.txt