Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
179 changes: 179 additions & 0 deletions .github/workflows/coverage-nightly.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,179 @@
name: Coverage (Nightly)

on:
schedule:
# Run at 2 AM UTC every day
- cron: '0 2 * * *'
# Allow manual triggers for testing
workflow_dispatch:
# Allow being called from other workflows
workflow_call:

concurrency:
group: coverage-${{ github.ref }}
cancel-in-progress: true

jobs:
compile:
name: Build with Coverage
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: "3.10"

- name: Install uv
uses: astral-sh/setup-uv@v5

- name: Install dependencies
run: bash -x .github/scripts/setup.sh

- name: Build with coverage instrumentation
run: |
./configure --enable-debugbuild --enable-coverage CC=clang
uv run make -j $(nproc) testpack.tar.bz2

- name: Upload build artifact
uses: actions/upload-artifact@v4
with:
name: cln-coverage-build
path: testpack.tar.bz2

test:
name: Test (${{ matrix.name }})
runs-on: ubuntu-22.04
needs: compile
strategy:
fail-fast: false
matrix:
include:
- name: sqlite
db: sqlite3
pytest_par: 10
- name: postgres
db: postgres
pytest_par: 10

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: "3.10"

- name: Install uv
uses: astral-sh/setup-uv@v5

- name: Install dependencies
run: bash -x .github/scripts/setup.sh

- name: Install Bitcoin Core
run: bash -x .github/scripts/install-bitcoind.sh

- name: Download build artifact
uses: actions/download-artifact@v4
with:
name: cln-coverage-build

- name: Unpack build
run: tar -xaf testpack.tar.bz2

- name: Run tests with coverage
env:
CLN_COVERAGE_DIR: ${{ github.workspace }}/coverage-raw
TEST_DB_PROVIDER: ${{ matrix.db }}
PYTEST_PAR: ${{ matrix.pytest_par }}
SLOW_MACHINE: 1
TIMEOUT: 900
run: |
mkdir -p "$CLN_COVERAGE_DIR"
uv run eatmydata pytest tests/ -n ${PYTEST_PAR} -vvv

- name: Upload coverage data
uses: actions/upload-artifact@v4
if: always()
with:
name: coverage-raw-${{ matrix.name }}
path: coverage-raw/*.profraw
if-no-files-found: error

report:
name: Generate Coverage Report
runs-on: ubuntu-22.04
needs: test
if: always()

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install LLVM tools
run: |
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh 18
sudo ln -sf /usr/bin/llvm-profdata-18 /usr/bin/llvm-profdata
sudo ln -sf /usr/bin/llvm-cov-18 /usr/bin/llvm-cov

- name: Download build artifact
uses: actions/download-artifact@v4
with:
name: cln-coverage-build

- name: Unpack build
run: tar -xaf testpack.tar.bz2

- name: Download all coverage artifacts
uses: actions/download-artifact@v4
with:
pattern: coverage-raw-*
path: coverage-artifacts

- name: Merge coverage data
run: |
mkdir -p coverage-raw coverage
find coverage-artifacts -name "*.profraw" -exec cp {} coverage-raw/ \;
PROFRAW_COUNT=$(ls -1 coverage-raw/*.profraw 2>/dev/null | wc -l)
echo "Found $PROFRAW_COUNT profile files"
if [ "$PROFRAW_COUNT" -eq 0 ]; then
echo "ERROR: No coverage data found"
exit 1
fi
chmod +x contrib/coverage/collect-coverage.sh
CLN_COVERAGE_DIR=coverage-raw ./contrib/coverage/collect-coverage.sh

- name: Generate HTML report
run: |
chmod +x contrib/coverage/generate-coverage-report.sh
./contrib/coverage/generate-coverage-report.sh

- name: Upload to Codecov
uses: codecov/codecov-action@v4
with:
files: coverage/merged.profdata
flags: integration-tests
name: cln-nightly-coverage
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: false

- name: Upload HTML report
uses: actions/upload-artifact@v4
with:
name: coverage-html-report
path: coverage/html
retention-days: 90

- name: Add summary to job
run: |
echo "## Coverage Summary" >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
cat coverage/summary.txt >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "📊 Download detailed HTML report from workflow artifacts" >> $GITHUB_STEP_SUMMARY
100 changes: 100 additions & 0 deletions .github/workflows/docs-nightly.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
name: Documentation (Nightly)

on:
schedule:
# Run at 4 AM UTC every day
- cron: '0 4 * * *'
# Allow manual triggers for testing
workflow_dispatch:
# Allow being called from other workflows
workflow_call:

concurrency:
group: docs-${{ github.ref }}
cancel-in-progress: true

jobs:
generate-docs:
name: Generate Project Documentation
runs-on: ubuntu-22.04

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Prepare documentation directory
run: |
mkdir -p docs-output
cp -r doc/* docs-output/

# Create a simple index.html for the documentation
cat > docs-output/index.html <<'EOF'
<!DOCTYPE html>
<html>
<head>
<title>Core Lightning Documentation</title>
<style>
body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
max-width: 1200px;
margin: 0 auto;
padding: 40px 20px;
line-height: 1.6;
}
h1 {
border-bottom: 2px solid #eaecef;
padding-bottom: 0.3em;
}
.docs-list {
list-style: none;
padding: 0;
}
.docs-list li {
padding: 8px 0;
}
.docs-list a {
color: #0366d6;
text-decoration: none;
font-family: monospace;
}
.docs-list a:hover {
text-decoration: underline;
}
.section {
margin-top: 30px;
}
</style>
</head>
<body>
<h1>Core Lightning Documentation</h1>
<p>Welcome to the Core Lightning documentation site.</p>

<div class="section">
<h2>Available Documentation</h2>
<p>This site contains the complete documentation for Core Lightning.</p>
<ul>
<li><a href="../">← Back to main site</a></li>
</ul>
</div>

<div class="section">
<p>For the full documentation, please visit the <a href="https://github.com/ElementsProject/lightning/tree/master/doc">doc directory on GitHub</a>.</p>
</div>
</body>
</html>
EOF

- name: Upload documentation artifact
uses: actions/upload-artifact@v4
with:
name: project-docs
path: docs-output
retention-days: 90

- name: Add summary to job
run: |
echo "## Project Documentation Generated" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "📖 Documentation files have been collected and prepared." >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "Download the artifact to view the documentation." >> $GITHUB_STEP_SUMMARY
Loading
Loading