mirror of
https://github.com/logos-messaging/logos-delivery.git
synced 2026-06-04 05:00:02 +00:00
Restores a fix that was dropped in e5b46e5e and re-exposed when cda01971 reintroduced nim/nimble into nimble.lock: the nim package never matches its Linux-computed checksum on Windows because nim's own .gitattributes forces line endings on parts of its tree, so the SHA1 differs regardless of core.autocrlf. autocrlf alone therefore cannot fix the nim mismatch. Remove nim/nimble from the lock before `nimble setup` (they are provided by the toolchain installed in CI, not real project deps). Added to the Windows workflow, which never had it, and restored in ci.yml's setup steps since the cache-key bump now forces those to run on a fresh tree. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
264 lines
8.3 KiB
YAML
264 lines
8.3 KiB
YAML
name: ci
|
|
|
|
on:
|
|
pull_request:
|
|
push:
|
|
branches:
|
|
- master
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
|
|
cancel-in-progress: true
|
|
|
|
env:
|
|
NPROC: 2
|
|
MAKEFLAGS: "-j${NPROC}"
|
|
NIMFLAGS: "--parallelBuild:${NPROC} --colors:off -d:chronicles_colors:none -d:disableMarchNative"
|
|
NIM_PARAMS: "-d:disableMarchNative"
|
|
NIM_VERSION: '2.2.4'
|
|
NIMBLE_VERSION: '0.22.3'
|
|
|
|
jobs:
|
|
changes: # changes detection
|
|
runs-on: ubuntu-22.04
|
|
permissions:
|
|
pull-requests: read
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
name: Checkout code
|
|
id: checkout
|
|
- uses: dorny/paths-filter@v2
|
|
id: filter
|
|
with:
|
|
filters: |
|
|
common:
|
|
- '.github/workflows/**'
|
|
- 'nimble.lock'
|
|
- 'waku.nimble'
|
|
- 'Makefile'
|
|
- 'scripts/**'
|
|
- 'flake.nix'
|
|
- 'flake.lock'
|
|
- 'library/**'
|
|
- 'liblogosdelivery/**'
|
|
v2:
|
|
- 'waku/**'
|
|
- 'apps/**'
|
|
- 'tools/**'
|
|
- 'tests/all_tests_v2.nim'
|
|
- 'tests/**'
|
|
- 'channels/**'
|
|
docker:
|
|
- 'docker/**'
|
|
|
|
outputs:
|
|
common: ${{ steps.filter.outputs.common }}
|
|
v2: ${{ steps.filter.outputs.v2 }}
|
|
docker: ${{ steps.filter.outputs.docker }}
|
|
|
|
build:
|
|
needs: changes
|
|
if: ${{ needs.changes.outputs.v2 == 'true' || needs.changes.outputs.common == 'true' }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
os: [ubuntu-22.04, macos-15]
|
|
runs-on: ${{ matrix.os }}
|
|
timeout-minutes: 45
|
|
|
|
name: build-${{ matrix.os }}
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Install Nim ${{ env.NIM_VERSION }}
|
|
uses: jiro4989/setup-nim-action@v2
|
|
with:
|
|
nim-version: ${{ env.NIM_VERSION }}
|
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Install Nimble ${{ env.NIMBLE_VERSION }}
|
|
run: |
|
|
cd /tmp && nimble install "nimble@${{ env.NIMBLE_VERSION }}" -y
|
|
echo "$HOME/.nimble/bin" >> $GITHUB_PATH
|
|
|
|
- name: Cache nimble deps
|
|
id: cache-nimbledeps
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: |
|
|
nimbledeps/
|
|
nimble.paths
|
|
key: ${{ runner.os }}-nimbledeps-v2-nimble${{ env.NIMBLE_VERSION }}-${{ hashFiles('nimble.lock', 'BearSSL.mk', 'Nat.mk') }}
|
|
|
|
- name: Install nimble deps
|
|
if: steps.cache-nimbledeps.outputs.cache-hit != 'true'
|
|
run: |
|
|
# nim and nimble have unstable cross-platform checksums (their source
|
|
# trees check out differently per OS), so strip them from the lock
|
|
# before setup to avoid spurious mismatches; the toolchain installed
|
|
# above provides them, they are not resolved as project deps.
|
|
python3 -c "
|
|
import json
|
|
lock = json.load(open('nimble.lock'))
|
|
for key in ['nim', 'nimble']:
|
|
lock['packages'].pop(key, None)
|
|
json.dump(lock, open('nimble.lock', 'w'), indent=2)
|
|
"
|
|
nimble setup --localdeps -y
|
|
make rebuild-nat-libs-nimbledeps
|
|
make rebuild-bearssl-nimbledeps
|
|
touch nimbledeps/.nimble-setup
|
|
|
|
- name: Build binaries
|
|
run: make V=1 all
|
|
|
|
build-windows:
|
|
needs: changes
|
|
if: ${{ needs.changes.outputs.v2 == 'true' || needs.changes.outputs.common == 'true' }}
|
|
uses: ./.github/workflows/windows-build.yml
|
|
with:
|
|
branch: ${{ github.ref }}
|
|
|
|
test:
|
|
needs: changes
|
|
if: ${{ needs.changes.outputs.v2 == 'true' || needs.changes.outputs.common == 'true' }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
os: [ubuntu-22.04, macos-15]
|
|
runs-on: ${{ matrix.os }}
|
|
timeout-minutes: 45
|
|
|
|
name: test-${{ matrix.os }}
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Install Nim ${{ env.NIM_VERSION }}
|
|
uses: jiro4989/setup-nim-action@v2
|
|
with:
|
|
nim-version: ${{ env.NIM_VERSION }}
|
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Install Nimble ${{ env.NIMBLE_VERSION }}
|
|
run: |
|
|
cd /tmp && nimble install "nimble@${{ env.NIMBLE_VERSION }}" -y
|
|
echo "$HOME/.nimble/bin" >> $GITHUB_PATH
|
|
|
|
- name: Cache nimble deps
|
|
id: cache-nimbledeps
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: |
|
|
nimbledeps/
|
|
nimble.paths
|
|
key: ${{ runner.os }}-nimbledeps-v2-nimble${{ env.NIMBLE_VERSION }}-${{ hashFiles('nimble.lock', 'BearSSL.mk', 'Nat.mk') }}
|
|
|
|
- name: Install nimble deps
|
|
if: steps.cache-nimbledeps.outputs.cache-hit != 'true'
|
|
run: |
|
|
# nim and nimble have unstable cross-platform checksums (their source
|
|
# trees check out differently per OS), so strip them from the lock
|
|
# before setup to avoid spurious mismatches; the toolchain installed
|
|
# above provides them, they are not resolved as project deps.
|
|
python3 -c "
|
|
import json
|
|
lock = json.load(open('nimble.lock'))
|
|
for key in ['nim', 'nimble']:
|
|
lock['packages'].pop(key, None)
|
|
json.dump(lock, open('nimble.lock', 'w'), indent=2)
|
|
"
|
|
nimble setup --localdeps -y
|
|
make rebuild-nat-libs-nimbledeps
|
|
make rebuild-bearssl-nimbledeps
|
|
touch nimbledeps/.nimble-setup
|
|
|
|
- name: Run tests
|
|
run: |
|
|
postgres_enabled=0
|
|
if [ ${{ runner.os }} == "Linux" ]; then
|
|
sudo docker run --rm -d -e POSTGRES_PASSWORD=test123 -p 5432:5432 postgres:15.4-alpine3.18
|
|
postgres_enabled=1
|
|
fi
|
|
|
|
export MAKEFLAGS="-j1"
|
|
export NIMFLAGS="--colors:off -d:chronicles_colors:none -d:disableMarchNative"
|
|
export USE_LIBBACKTRACE=0
|
|
|
|
make V=1 POSTGRES=$postgres_enabled test
|
|
make V=1 POSTGRES=$postgres_enabled testwakunode2
|
|
|
|
build-docker-image:
|
|
needs: changes
|
|
if: ${{ needs.changes.outputs.v2 == 'true' || needs.changes.outputs.common == 'true' || needs.changes.outputs.docker == 'true' }}
|
|
uses: ./.github/workflows/container-image.yml
|
|
secrets: inherit
|
|
|
|
nwaku-nwaku-interop-tests:
|
|
needs: build-docker-image
|
|
uses: logos-messaging/logos-delivery-interop-tests/.github/workflows/nim_waku_PR.yml@SMOKE_TEST_STABLE
|
|
with:
|
|
node_nwaku: ${{ needs.build-docker-image.outputs.image }}
|
|
|
|
secrets: inherit
|
|
|
|
lint:
|
|
name: "Lint"
|
|
runs-on: ubuntu-22.04
|
|
needs: build
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Install Nim ${{ env.NIM_VERSION }}
|
|
uses: jiro4989/setup-nim-action@v2
|
|
with:
|
|
nim-version: ${{ env.NIM_VERSION }}
|
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Install Nimble ${{ env.NIMBLE_VERSION }}
|
|
run: |
|
|
cd /tmp && nimble install "nimble@${{ env.NIMBLE_VERSION }}" -y
|
|
echo "$HOME/.nimble/bin" >> $GITHUB_PATH
|
|
|
|
- name: Cache nimble deps
|
|
id: cache-nimbledeps
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: |
|
|
nimbledeps/
|
|
nimble.paths
|
|
key: ${{ runner.os }}-nimbledeps-v2-nimble${{ env.NIMBLE_VERSION }}-${{ hashFiles('nimble.lock', 'BearSSL.mk', 'Nat.mk') }}
|
|
|
|
- name: Install nimble deps
|
|
if: steps.cache-nimbledeps.outputs.cache-hit != 'true'
|
|
run: |
|
|
# nim and nimble have unstable cross-platform checksums (their source
|
|
# trees check out differently per OS), so strip them from the lock
|
|
# before setup to avoid spurious mismatches; the toolchain installed
|
|
# above provides them, they are not resolved as project deps.
|
|
python3 -c "
|
|
import json
|
|
lock = json.load(open('nimble.lock'))
|
|
for key in ['nim', 'nimble']:
|
|
lock['packages'].pop(key, None)
|
|
json.dump(lock, open('nimble.lock', 'w'), indent=2)
|
|
"
|
|
nimble setup --localdeps -y
|
|
make rebuild-nat-libs-nimbledeps
|
|
make rebuild-bearssl-nimbledeps
|
|
touch nimbledeps/.nimble-setup
|
|
|
|
- name: Build nph
|
|
run: |
|
|
make build-nph
|
|
|
|
- name: Check nph formatting
|
|
run: |
|
|
shopt -s extglob # Enable extended globbing
|
|
NPH=$(make print-nph-path)
|
|
echo "using nph at ${NPH}"
|
|
"${NPH}" examples waku tests tools apps *.@(nim|nims|nimble)
|
|
git diff --exit-code
|