mirror of
https://github.com/logos-messaging/logos-delivery.git
synced 2026-05-06 06:49:29 +00:00
331 lines
9.1 KiB
YAML
331 lines
9.1 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"
|
|
|
|
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/**'
|
|
- 'vendor/**'
|
|
- 'Makefile'
|
|
- 'waku.nimble'
|
|
- 'library/**'
|
|
v2:
|
|
- 'waku/**'
|
|
- 'apps/**'
|
|
- 'tools/**'
|
|
- 'tests/all_tests_v2.nim'
|
|
- 'tests/**'
|
|
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:
|
|
platform:
|
|
- os: linux-gcc-14 # ubuntu-24.04, GCC 14
|
|
cpu: amd64
|
|
cc: gcc
|
|
- os: macos-15
|
|
cpu: arm64
|
|
cc: clang
|
|
- os: windows
|
|
cpu: amd64
|
|
cc: gcc
|
|
include:
|
|
- platform:
|
|
os: linux-gcc-14
|
|
builder: ubuntu-24.04 # GCC 14 (default on 24.04)
|
|
shell: bash
|
|
- platform:
|
|
os: macos-15
|
|
builder: macos-15
|
|
shell: bash
|
|
- platform:
|
|
os: windows
|
|
cc: gcc
|
|
builder: windows-2022
|
|
shell: "msys2 {0}"
|
|
|
|
defaults:
|
|
run:
|
|
shell: ${{ matrix.shell }}
|
|
|
|
runs-on: ${{ matrix.builder }}
|
|
timeout-minutes: 90
|
|
|
|
name: "build-ci-${{ matrix.platform.os }}-${{ matrix.platform.cpu }} (${{ matrix.platform.cc }})"
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup MSYS2 (Windows/gcc)
|
|
if: runner.os == 'Windows'
|
|
uses: msys2/setup-msys2@v2
|
|
with:
|
|
update: true
|
|
install: >-
|
|
git
|
|
base-devel
|
|
mingw-w64-x86_64-toolchain
|
|
make
|
|
cmake
|
|
upx
|
|
unzip
|
|
mingw-w64-x86_64-rust
|
|
mingw-w64-x86_64-postgresql
|
|
mingw-w64-x86_64-gcc
|
|
mingw-w64-x86_64-gcc-libs
|
|
mingw-w64-x86_64-libwinpthread-git
|
|
mingw-w64-x86_64-zlib
|
|
mingw-w64-x86_64-openssl
|
|
mingw-w64-x86_64-python
|
|
mingw-w64-x86_64-cmake
|
|
mingw-w64-x86_64-llvm
|
|
mingw-w64-x86_64-clang
|
|
mingw-w64-x86_64-nimble
|
|
mingw-w64-x86_64-nasm
|
|
|
|
- name: Use gcc-14 (Linux)
|
|
if: matrix.platform.os == 'linux-gcc-14'
|
|
run: |
|
|
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-14 14
|
|
sudo update-alternatives --set gcc /usr/bin/gcc-14
|
|
|
|
- name: Setup Nim
|
|
uses: "./.github/actions/install_nim"
|
|
with:
|
|
os: ${{ runner.os }}
|
|
cpu: ${{ matrix.platform.cpu }}
|
|
shell: ${{ matrix.shell }}
|
|
nim_ref: v2.2.6
|
|
|
|
- name: Print Nim and Nimble versions
|
|
run: |
|
|
nim --version
|
|
nimble --version
|
|
which nim
|
|
which nimble
|
|
|
|
- name: Restore nimbledeps from cache
|
|
id: nimbledeps-cache
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: nimbledeps
|
|
key: nimbledeps-${{ matrix.builder }}-${{ matrix.platform.cpu }}-${{ hashFiles('nimble.lock') }}
|
|
|
|
- name: Make update
|
|
run: make update
|
|
|
|
- name: Build binaries
|
|
run: make V=1 QUICK_AND_DIRTY_COMPILER=1 USE_LIBBACKTRACE=0 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:
|
|
platform:
|
|
- os: linux-gcc-14 # ubuntu-24.04, GCC 14
|
|
cpu: amd64
|
|
cc: gcc
|
|
- os: macos-15
|
|
cpu: arm64
|
|
cc: clang
|
|
- os: windows
|
|
cpu: amd64
|
|
cc: gcc
|
|
include:
|
|
- platform:
|
|
os: linux-gcc-14
|
|
builder: ubuntu-24.04 # GCC 14 (default on 24.04)
|
|
shell: bash
|
|
- platform:
|
|
os: macos-15
|
|
builder: macos-15
|
|
shell: bash
|
|
- platform:
|
|
os: windows
|
|
cc: gcc
|
|
builder: windows-2022
|
|
shell: "msys2 {0}"
|
|
|
|
defaults:
|
|
run:
|
|
shell: ${{ matrix.shell }}
|
|
|
|
runs-on: ${{ matrix.builder }}
|
|
timeout-minutes: 90
|
|
|
|
name: "test-ci-${{ matrix.platform.os }}-${{ matrix.platform.cpu }} (${{ matrix.platform.cc }})"
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup MSYS2 (Windows/gcc)
|
|
if: runner.os == 'Windows'
|
|
uses: msys2/setup-msys2@v2
|
|
with:
|
|
update: true
|
|
install: >-
|
|
git
|
|
base-devel
|
|
mingw-w64-x86_64-toolchain
|
|
make
|
|
cmake
|
|
upx
|
|
unzip
|
|
mingw-w64-x86_64-rust
|
|
mingw-w64-x86_64-postgresql
|
|
mingw-w64-x86_64-gcc
|
|
mingw-w64-x86_64-gcc-libs
|
|
mingw-w64-x86_64-libwinpthread-git
|
|
mingw-w64-x86_64-zlib
|
|
mingw-w64-x86_64-openssl
|
|
mingw-w64-x86_64-python
|
|
mingw-w64-x86_64-cmake
|
|
mingw-w64-x86_64-llvm
|
|
mingw-w64-x86_64-clang
|
|
mingw-w64-x86_64-nimble
|
|
mingw-w64-x86_64-nasm
|
|
|
|
- name: Use gcc-14 (Linux)
|
|
if: matrix.platform.os == 'linux-gcc-14'
|
|
run: |
|
|
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-14 14
|
|
sudo update-alternatives --set gcc /usr/bin/gcc-14
|
|
|
|
- name: Setup Nim
|
|
uses: "./.github/actions/install_nim"
|
|
with:
|
|
os: ${{ runner.os }}
|
|
cpu: ${{ matrix.platform.cpu }}
|
|
shell: ${{ matrix.shell }}
|
|
nim_ref: v2.2.6
|
|
|
|
- name: Restore nimbledeps from cache
|
|
id: nimbledeps-cache
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: nimbledeps
|
|
key: nimbledeps-${{ matrix.builder }}-${{ matrix.platform.cpu }}-${{ hashFiles('nimble.lock') }}
|
|
|
|
- name: Make update
|
|
run: make update
|
|
|
|
- name: Run tests
|
|
if: runner.os != 'Windows'
|
|
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"
|
|
export USE_LIBBACKTRACE=0
|
|
|
|
make V=1 LOG_LEVEL=DEBUG QUICK_AND_DIRTY_COMPILER=1 DEBUG=0 POSTGRES=$postgres_enabled test
|
|
make V=1 LOG_LEVEL=DEBUG QUICK_AND_DIRTY_COMPILER=1 DEBUG=0 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
|
|
|
|
js-waku-node:
|
|
needs: build-docker-image
|
|
uses: logos-messaging/logos-delivery-js/.github/workflows/test-node.yml@master
|
|
with:
|
|
nim_wakunode_image: ${{ needs.build-docker-image.outputs.image }}
|
|
test_type: node
|
|
|
|
js-waku-node-optional:
|
|
needs: build-docker-image
|
|
uses: logos-messaging/logos-delivery-js/.github/workflows/test-node.yml@master
|
|
with:
|
|
nim_wakunode_image: ${{ needs.build-docker-image.outputs.image }}
|
|
test_type: node-optional
|
|
|
|
lint:
|
|
name: "Lint"
|
|
runs-on: ubuntu-22.04
|
|
needs: build
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Nim
|
|
uses: "./.github/actions/install_nim"
|
|
with:
|
|
os: ${{ runner.os }}
|
|
cpu: amd64
|
|
nim_ref: v2.2.6
|
|
|
|
- name: Print Nim and Nimble versions
|
|
run: |
|
|
nim --version
|
|
nimble --version
|
|
|
|
- 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
|