mirror of
https://github.com/logos-messaging/nim-chat-poc.git
synced 2026-02-26 17:03:08 +00:00
* ci: run nix build on ubuntu and macos * ci: use DeterminateSystems/nix-installer-action * fix: wrong extension for mac --------- Co-authored-by: pablo <p.lopez.lpz@gmail.com>
82 lines
2.4 KiB
YAML
82 lines
2.4 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
pull_request:
|
|
branches:
|
|
- main
|
|
|
|
jobs:
|
|
build-and-test:
|
|
name: Build and Test
|
|
strategy:
|
|
matrix:
|
|
os: [ubuntu-latest, macOS-latest]
|
|
runs-on: ${{ matrix.os }}
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
with:
|
|
submodules: recursive
|
|
- id: hashes
|
|
name: Compute cache hashes
|
|
run: |
|
|
echo "nbs=$(git rev-parse HEAD:vendor/nimbus-build-system)" >> $GITHUB_OUTPUT
|
|
echo "libchat=$(git rev-parse HEAD:vendor/libchat)" >> $GITHUB_OUTPUT
|
|
# Cache the Nim compiler built by nimbus-build-system (NBS).
|
|
# Building Nim from source is the slowest part of `make update`.
|
|
# Keyed on the NBS submodule commit — auto-invalidates when NBS is bumped.
|
|
- name: Cache/restore NBS
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: vendor/nimbus-build-system/vendor/Nim
|
|
key: ${{ runner.os }}-nbs-${{ steps.hashes.outputs.nbs }}
|
|
- name: Cache/restore Cargo registry
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: |
|
|
~/.cargo/registry
|
|
~/.cargo/git
|
|
key: ${{ runner.os }}-cargo-deps-${{ hashFiles('vendor/libchat/Cargo.lock') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-cargo-deps-
|
|
- name: Cache/restore libchat
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: vendor/libchat/target
|
|
key: ${{ runner.os }}-libchat-${{ steps.hashes.outputs.libchat }}
|
|
- name: Update dependencies
|
|
run: make update
|
|
- name: Build
|
|
run: make all
|
|
- name: Test
|
|
run: make tests
|
|
|
|
nix-build:
|
|
name: Nix Build
|
|
strategy:
|
|
matrix:
|
|
os: [ubuntu-latest, macOS-latest]
|
|
runs-on: ${{ matrix.os }}
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
with:
|
|
submodules: recursive
|
|
- uses: DeterminateSystems/nix-installer-action@v12
|
|
with:
|
|
extra_nix_config: |
|
|
experimental-features = nix-command flakes
|
|
nix-path = nixpkgs=channel:nixos-unstable
|
|
- name: Build
|
|
run: nix build ".?submodules=1#" --print-build-logs
|
|
- name: Verify outputs
|
|
run: |
|
|
if [[ "$RUNNER_OS" == "macOS" ]]; then
|
|
ext=dylib
|
|
else
|
|
ext=so
|
|
fi
|
|
test -f result/lib/liblogoschat.$ext
|
|
test -f result/include/liblogoschat.h
|