mirror of
https://github.com/daywalker90/cln-nip47.git
synced 2026-08-13 12:33:43 +02:00
init
This commit is contained in:
commit
2529bb5863
35 changed files with 6788 additions and 0 deletions
188
.github/workflows/ci.yml
vendored
Normal file
188
.github/workflows/ci.yml
vendored
Normal file
|
|
@ -0,0 +1,188 @@
|
|||
name: CI
|
||||
|
||||
# Cancel duplicate jobs
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
cln-version:
|
||||
required: true
|
||||
type: string
|
||||
pyln-version:
|
||||
required: true
|
||||
type: string
|
||||
tagged-release:
|
||||
required: true
|
||||
type: boolean
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Test CLN=${{ inputs.cln-version }}, OS=${{ matrix.os }}, PY=${{ matrix.python-version }}, BCD=${{ matrix.bitcoind-version }}, EXP=${{ matrix.experimental }}, DEP=${{ matrix.deprecated }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
bitcoind-version: ["28.0"]
|
||||
experimental: [1]
|
||||
deprecated: [0]
|
||||
python-version: ["3.8", "3.11"]
|
||||
os: ["ubuntu-24.04"]
|
||||
|
||||
runs-on: ${{ matrix.os }}
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Create cache paths
|
||||
run: |
|
||||
sudo mkdir /usr/local/libexec
|
||||
sudo mkdir /usr/local/libexec/c-lightning
|
||||
sudo mkdir /usr/local/libexec/c-lightning/plugins
|
||||
sudo chown -R $USER /usr/local/libexec
|
||||
|
||||
- name: Set up Python ${{ matrix.python-version }}
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
|
||||
- name: Extract exact python and os version
|
||||
id: exact_versions
|
||||
run: |
|
||||
PYTHON_VERSION=$(python --version 2>&1 | grep -oP '(?<=Python )\d+\.\d+(\.\d+)?')
|
||||
echo "Python version: $PYTHON_VERSION"
|
||||
echo "python_version=$PYTHON_VERSION" >> "$GITHUB_OUTPUT"
|
||||
OS_VERSION=$(lsb_release -rs)
|
||||
echo "OS version: $OS_VERSION"
|
||||
echo "os_version=$OS_VERSION" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Cache CLN
|
||||
id: cache-cln
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
/usr/local/bin/lightning*
|
||||
/usr/local/libexec/c-lightning
|
||||
key: cache-cln-${{ inputs.cln-version }}-${{ steps.exact_versions.outputs.os_version }}
|
||||
|
||||
- name: Cache bitcoind
|
||||
id: cache-bitcoind
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: /usr/local/bin/bitcoin*
|
||||
key: cache-bitcoind-${{ matrix.bitcoind-version }}-${{ steps.exact_versions.outputs.os_version }}
|
||||
|
||||
- name: Cache python dependencies
|
||||
id: cache-python
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: venv
|
||||
key: cache-python-${{ steps.exact_versions.outputs.python_version }}-${{ steps.exact_versions.outputs.os_version }}-${{ inputs.pyln-version }}-${{ hashFiles('tests/requirements.txt') }}
|
||||
|
||||
- name: Download Bitcoin ${{ matrix.bitcoind-version }} & install binaries
|
||||
if: ${{ steps.cache-bitcoind.outputs.cache-hit != 'true' }}
|
||||
run: |
|
||||
export BITCOIND_VERSION=${{ matrix.bitcoind-version }}
|
||||
if [[ "${{ matrix.os }}" =~ "ubuntu" ]]; then
|
||||
export TARGET_ARCH="x86_64-linux-gnu"
|
||||
fi
|
||||
if [[ "${{ matrix.os }}" =~ "macos" ]]; then
|
||||
export TARGET_ARCH="x86_64-apple-darwin"
|
||||
fi
|
||||
wget https://bitcoincore.org/bin/bitcoin-core-${BITCOIND_VERSION}/bitcoin-${BITCOIND_VERSION}-${TARGET_ARCH}.tar.gz
|
||||
tar -xzf bitcoin-${BITCOIND_VERSION}-${TARGET_ARCH}.tar.gz
|
||||
sudo mv bitcoin-${BITCOIND_VERSION}/bin/* /usr/local/bin
|
||||
rm -rf bitcoin-${BITCOIND_VERSION}-${TARGET_ARCH}.tar.gz bitcoin-${BITCOIND_VERSION}
|
||||
|
||||
- name: Download Core Lightning ${{ inputs.cln-version }} & install binaries
|
||||
if: ${{ contains(matrix.os, 'ubuntu') && steps.cache-cln.outputs.cache-hit != 'true' }}
|
||||
run: |
|
||||
url=$(curl -s https://api.github.com/repos/ElementsProject/lightning/releases/tags/${{ inputs.cln-version }} \
|
||||
| jq '.assets[] | select(.name | contains("22.04")) | .browser_download_url' \
|
||||
| tr -d '\"')
|
||||
wget $url
|
||||
sudo tar -xvf ${url##*/} -C /usr/local --strip-components=2
|
||||
echo "CLN_VERSION=$(lightningd --version)" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Set up Rust
|
||||
if: ${{ inputs.tagged-release == false}}
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
|
||||
- name: Set up protoc
|
||||
if: ${{ inputs.tagged-release == false}} || contains(matrix.os, 'macos') && ${{ steps.cache-cln.outputs.cache-hit != 'true' }}
|
||||
uses: arduino/setup-protoc@v3
|
||||
with:
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Checkout Core Lightning ${{ inputs.cln-version }}
|
||||
if: ${{ contains(matrix.os, 'macos') && steps.cache-cln.outputs.cache-hit != 'true' }}
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
repository: 'ElementsProject/lightning'
|
||||
path: 'lightning'
|
||||
ref: ${{ inputs.cln-version }}
|
||||
submodules: 'recursive'
|
||||
|
||||
- name: Install System dependencies
|
||||
run: |
|
||||
if [[ "${{ matrix.os }}" =~ "macos" ]]; then
|
||||
brew install autoconf automake libtool gnu-sed gettext libsodium sqlite
|
||||
fi
|
||||
|
||||
- name: Install Python dependencies
|
||||
if: ${{ steps.cache-python.outputs.cache-hit != 'true' }}
|
||||
run: |
|
||||
python -m venv venv
|
||||
source venv/bin/activate
|
||||
python -m pip install -U pip poetry wheel
|
||||
pip3 install "pyln-proto<=${{ inputs.pyln-version }}" "pyln-client<=${{ inputs.pyln-version }}" "pyln-testing<=${{ inputs.pyln-version }}"
|
||||
pip3 install pytest-xdist pytest-test-groups pytest-timeout
|
||||
if [ -f "tests/requirements.txt" ]; then
|
||||
pip3 install -r tests/requirements.txt
|
||||
fi
|
||||
|
||||
- name: Compile Core Lightning ${{ inputs.cln-version }} & install binaries
|
||||
if: ${{ contains(matrix.os, 'macos') && steps.cache-cln.outputs.cache-hit != 'true' }}
|
||||
run: |
|
||||
export EXPERIMENTAL_FEATURES=${{ matrix.experimental }}
|
||||
export COMPAT=${{ matrix.deprecated }}
|
||||
export VALGRIND=0
|
||||
source venv/bin/activate
|
||||
|
||||
cd lightning
|
||||
|
||||
poetry lock
|
||||
poetry install
|
||||
./configure --disable-valgrind
|
||||
poetry run make
|
||||
sudo make install
|
||||
|
||||
- name: Get plugin binary
|
||||
run: |
|
||||
source venv/bin/activate
|
||||
if ${{ inputs.tagged-release }}; then
|
||||
cd tests
|
||||
./setup.sh
|
||||
cd ..
|
||||
else
|
||||
if [ -d "proto" ]; then
|
||||
python -m grpc_tools.protoc --proto_path="proto" --python_out="tests" --grpc_python_out="tests" proto/*.proto
|
||||
fi
|
||||
|
||||
cargo build
|
||||
fi
|
||||
|
||||
- name: Run tests
|
||||
run: |
|
||||
export CLN_PATH=${{ github.workspace }}/lightning
|
||||
export COMPAT=${{ matrix.deprecated }}
|
||||
export EXPERIMENTAL_FEATURES=${{ matrix.experimental }}
|
||||
export SLOW_MACHINE=1
|
||||
export TEST_DEBUG=1
|
||||
export TRAVIS=1
|
||||
export VALGRIND=0
|
||||
export PYTEST_TIMEOUT=600
|
||||
source venv/bin/activate
|
||||
pytest -n=5 tests/test_*.py
|
||||
14
.github/workflows/latest_v24.08.yml
vendored
Normal file
14
.github/workflows/latest_v24.08.yml
vendored
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
name: latest release on CLN v24.08.2
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [published, edited]
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
call-ci:
|
||||
uses: ./.github/workflows/ci.yml
|
||||
with:
|
||||
cln-version: "v24.08.2"
|
||||
pyln-version: "24.08"
|
||||
tagged-release: true
|
||||
14
.github/workflows/latest_v24.11.yml
vendored
Normal file
14
.github/workflows/latest_v24.11.yml
vendored
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
name: latest release on CLN v24.11
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [published, edited]
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
call-ci:
|
||||
uses: ./.github/workflows/ci.yml
|
||||
with:
|
||||
cln-version: "v24.11"
|
||||
pyln-version: "24.11"
|
||||
tagged-release: true
|
||||
14
.github/workflows/latest_v25.02.yml
vendored
Normal file
14
.github/workflows/latest_v25.02.yml
vendored
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
name: latest release on CLN v25.02
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [published, edited]
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
call-ci:
|
||||
uses: ./.github/workflows/ci.yml
|
||||
with:
|
||||
cln-version: "v25.02"
|
||||
pyln-version: "25.02"
|
||||
tagged-release: true
|
||||
24
.github/workflows/main_v24.08.yml
vendored
Normal file
24
.github/workflows/main_v24.08.yml
vendored
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
name: main on CLN v24.08.2
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
paths-ignore:
|
||||
- 'tools/**'
|
||||
- 'CHANGELOG.md'
|
||||
- 'README.md'
|
||||
- 'LICENSE'
|
||||
- '.gitignore'
|
||||
- 'coffee.yml'
|
||||
- 'tests/setup.sh'
|
||||
pull_request:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
call-ci:
|
||||
uses: ./.github/workflows/ci.yml
|
||||
with:
|
||||
cln-version: "v24.08.2"
|
||||
pyln-version: "24.08"
|
||||
tagged-release: false
|
||||
24
.github/workflows/main_v24.11.yml
vendored
Normal file
24
.github/workflows/main_v24.11.yml
vendored
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
name: main on CLN v24.11
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
paths-ignore:
|
||||
- 'tools/**'
|
||||
- 'CHANGELOG.md'
|
||||
- 'README.md'
|
||||
- 'LICENSE'
|
||||
- '.gitignore'
|
||||
- 'coffee.yml'
|
||||
- 'tests/setup.sh'
|
||||
pull_request:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
call-ci:
|
||||
uses: ./.github/workflows/ci.yml
|
||||
with:
|
||||
cln-version: "v24.11"
|
||||
pyln-version: "24.11"
|
||||
tagged-release: false
|
||||
24
.github/workflows/main_v25.02.yml
vendored
Normal file
24
.github/workflows/main_v25.02.yml
vendored
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
name: main on CLN v25.02
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
paths-ignore:
|
||||
- 'tools/**'
|
||||
- 'CHANGELOG.md'
|
||||
- 'README.md'
|
||||
- 'LICENSE'
|
||||
- '.gitignore'
|
||||
- 'coffee.yml'
|
||||
- 'tests/setup.sh'
|
||||
pull_request:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
call-ci:
|
||||
uses: ./.github/workflows/ci.yml
|
||||
with:
|
||||
cln-version: "v25.02"
|
||||
pyln-version: "25.02"
|
||||
tagged-release: false
|
||||
104
.github/workflows/release.yml
vendored
Normal file
104
.github/workflows/release.yml
vendored
Normal file
|
|
@ -0,0 +1,104 @@
|
|||
name: Build and release
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- 'v*'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: build release binaries on ${{ matrix.os }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: ["ubuntu-24.04"]
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
- name: Install rust
|
||||
id: rust
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
- name: Install cross
|
||||
if: contains(matrix.os, 'ubuntu')
|
||||
run: |
|
||||
cargo install cross --git https://github.com/cross-rs/cross
|
||||
- name: Build unix
|
||||
id: unix_build
|
||||
if: contains(matrix.os, 'ubuntu')
|
||||
run: |
|
||||
cross build --profile optimized --locked --target x86_64-unknown-linux-gnu
|
||||
cross build --profile optimized --locked --target armv7-unknown-linux-gnueabihf
|
||||
cross build --profile optimized --locked --target aarch64-unknown-linux-gnu
|
||||
tar -czf "${{ github.event.repository.name }}-${{github.ref_name}}-aarch64-linux-gnu.tar.gz" --transform 's|.*/||' "target/aarch64-unknown-linux-gnu/optimized/${{ github.event.repository.name }}"
|
||||
tar -czf "${{ github.event.repository.name }}-${{github.ref_name}}-armv7-linux-gnueabihf.tar.gz" --transform 's|.*/||' "target/armv7-unknown-linux-gnueabihf/optimized/${{ github.event.repository.name }}"
|
||||
tar -czf "${{ github.event.repository.name }}-${{github.ref_name}}-x86_64-linux-gnu.tar.gz" --transform 's|.*/||' "target/x86_64-unknown-linux-gnu/optimized/${{ github.event.repository.name }}"
|
||||
ls -alh
|
||||
- name: Build macos
|
||||
id: macos_build
|
||||
if: contains(matrix.os, 'macos')
|
||||
run: |
|
||||
rustup target add aarch64-apple-darwin
|
||||
export CROSSBUILD_MACOS_SDK="macosx13.1"
|
||||
export SDKROOT=$(xcrun -sdk $CROSSBUILD_MACOS_SDK --show-sdk-path)
|
||||
export MACOSX_DEPLOYMENT_TARGET=12.0
|
||||
cargo build --profile optimized --locked --target=x86_64-apple-darwin
|
||||
cargo build --profile optimized --locked --target=aarch64-apple-darwin
|
||||
lipo -create -output target/${{ github.event.repository.name }} target/aarch64-apple-darwin/optimized/${{ github.event.repository.name }} target/x86_64-apple-darwin/optimized/${{ github.event.repository.name }}
|
||||
ditto -c -k --sequesterRsrc target/${{ github.event.repository.name }} ${{ github.event.repository.name }}-${{github.ref_name}}-universal-apple-darwin.zip
|
||||
otool -l target/aarch64-apple-darwin/optimized/${{ github.event.repository.name }} | grep -A 5 LC_BUILD_VERSION
|
||||
otool -l target/x86_64-apple-darwin/optimized/${{ github.event.repository.name }} | grep -A 5 LC_BUILD_VERSION
|
||||
echo "macos_version=$MACOSX_DEPLOYMENT_TARGET" >> "$GITHUB_OUTPUT"
|
||||
echo $(xcodebuild -showsdks)
|
||||
ls -alh
|
||||
- name: Upload unix artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
if: contains(matrix.os, 'ubuntu')
|
||||
with:
|
||||
name: unix-binaries
|
||||
path: |
|
||||
${{ github.event.repository.name }}-${{github.ref_name}}-*.tar.gz
|
||||
- name: Upload macos artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
if: contains(matrix.os, 'macos')
|
||||
with:
|
||||
name: macos-binaries
|
||||
path: |
|
||||
${{ github.event.repository.name }}-${{github.ref_name}}-universal-apple-darwin.zip
|
||||
- name: Get rust version
|
||||
id: rversion
|
||||
run: |
|
||||
echo "rust_version=$(rustc --version | awk '{print $2}')" >> "$GITHUB_OUTPUT"
|
||||
outputs:
|
||||
rust-version: ${{ steps.rversion.outputs.rust_version }}
|
||||
macos-version: ${{ steps.macos_build.outputs.macos_version }}
|
||||
|
||||
release:
|
||||
name: Github Release
|
||||
needs: [build]
|
||||
runs-on: "ubuntu-24.04"
|
||||
permissions:
|
||||
contents: write
|
||||
steps:
|
||||
- name: Get semver version from tag
|
||||
id: tag_name
|
||||
run: echo "current_version=${GITHUB_REF#refs/tags/v}" >> "$GITHUB_OUTPUT"
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
- name: Get Changelog Entry
|
||||
id: changelog_reader
|
||||
uses: mindsers/changelog-reader-action@v2
|
||||
with:
|
||||
validation_level: warn
|
||||
version: ${{ steps.tag_name.outputs.current_version }}
|
||||
path: ./CHANGELOG.md
|
||||
- name: Download Artifacts
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
merge-multiple: true
|
||||
- name: Release
|
||||
uses: ncipollo/release-action@v1
|
||||
with:
|
||||
allowUpdates: false
|
||||
artifactErrorsFailBuild: true
|
||||
body: "${{ steps.changelog_reader.outputs.changes }} \n\n### Release binaries info\n\n- Release binaries were built using rust ${{ needs.build.outputs.rust-version }}\n- Linux release binaries require glibc>=2.31"
|
||||
artifacts: "${{ github.event.repository.name }}-${{github.ref_name}}-*.tar.gz"
|
||||
Loading…
Add table
Add a link
Reference in a new issue