mirror of
https://github.com/zedeus/nitter.git
synced 2026-03-04 13:19:57 -05:00
* Update actions and switch to GitHub runners * Bump workflow Python version to 3.14 * Reuse nitter build for integration test * Add missing libpcre3 installation to workflow * Consolidate workflow runtime deps install * Make nitter binary executable * Run nimble md and scss simultaneously in workflow * Run tests with 4 workers in workflow * Rerun failing integration tests * Bump integration test workers to 5 * Improve python dep install and run less workers * Use native GitHub Actions Redis service * Lower integration test workers to 2 * Switch to poetry to cache venv * Ensure poetry is installed before setup-python * Fix poetry sync command * Switch back to 3 workers * Cache poetry install * WIP * WIP * Fix poetry/pipx caching * Speed up integration test significantly * WIP * Cleanup
145 lines
3.5 KiB
YAML
145 lines
3.5 KiB
YAML
name: Tests
|
|
|
|
on:
|
|
push:
|
|
paths-ignore:
|
|
- "*.md"
|
|
branches-ignore:
|
|
- master
|
|
workflow_call:
|
|
|
|
# Ensure that multiple runs on the same branch do not overlap.
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
defaults:
|
|
run:
|
|
shell: bash
|
|
|
|
jobs:
|
|
build-test:
|
|
name: Build and test
|
|
runs-on: ubuntu-24.04
|
|
strategy:
|
|
matrix:
|
|
nim: ["2.0.x", "2.2.x", "devel"]
|
|
steps:
|
|
- name: Checkout Code
|
|
uses: actions/checkout@v6
|
|
|
|
- name: Cache Nimble Dependencies
|
|
id: cache-nimble
|
|
uses: actions/cache@v5
|
|
with:
|
|
path: ~/.nimble
|
|
key: ${{ matrix.nim }}-nimble-v2-${{ hashFiles('*.nimble') }}
|
|
restore-keys: |
|
|
${{ matrix.nim }}-nimble-v2-
|
|
|
|
- name: Setup Nim
|
|
uses: jiro4989/setup-nim-action@v2
|
|
with:
|
|
nim-version: ${{ matrix.nim }}
|
|
use-nightlies: true
|
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Build Project
|
|
run: nimble build -Y
|
|
|
|
- name: Upload 2.2.x build artifact
|
|
if: matrix.nim == '2.2.x'
|
|
uses: actions/upload-artifact@v6
|
|
with:
|
|
name: nitter-linux-nim-2.2.x-${{ github.sha }}
|
|
path: |
|
|
./nitter
|
|
if-no-files-found: error
|
|
|
|
integration-test:
|
|
needs: [build-test]
|
|
name: Integration test
|
|
runs-on: ubuntu-24.04
|
|
|
|
services:
|
|
redis:
|
|
image: redis:7
|
|
ports:
|
|
- 6379:6379
|
|
|
|
steps:
|
|
- name: Install runtime deps
|
|
run: |
|
|
sudo apt-get install -y --no-install-recommends libsass-dev libpcre3
|
|
|
|
- name: Checkout code
|
|
uses: actions/checkout@v6
|
|
|
|
- name: Cache pipx (poetry)
|
|
uses: actions/cache@v5
|
|
with:
|
|
path: |
|
|
~/.local/pipx
|
|
~/.local/bin
|
|
key: pipx-poetry-${{ runner.os }}
|
|
|
|
- name: Install poetry
|
|
env:
|
|
PIPX_HOME: ~/.local/pipx
|
|
PIPX_BIN_DIR: ~/.local/bin
|
|
run: command -v poetry >/dev/null 2>&1 || pipx install poetry
|
|
|
|
- name: Setup Python (3.14) with Poetry cache
|
|
uses: actions/setup-python@v6
|
|
with:
|
|
python-version: "3.14"
|
|
cache: poetry
|
|
cache-dependency-path: tests/poetry.lock
|
|
|
|
- name: Install Python deps
|
|
working-directory: tests
|
|
run: poetry sync
|
|
|
|
- name: Cache Nimble Dependencies
|
|
uses: actions/cache@v5
|
|
with:
|
|
path: ~/.nimble
|
|
key: 2.2.x-nimble-v2-${{ hashFiles('*.nimble') }}
|
|
restore-keys: |
|
|
2.2.x-nimble-v2-
|
|
|
|
- name: Setup Nim
|
|
uses: jiro4989/setup-nim-action@v2
|
|
with:
|
|
nim-version: 2.2.x
|
|
use-nightlies: true
|
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Download 2.2.x build artifact
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: nitter-linux-nim-2.2.x-${{ github.sha }}
|
|
path: .
|
|
|
|
- name: Make nitter binary executable
|
|
run: chmod +x ./nitter
|
|
|
|
- name: Prepare Nitter Environment
|
|
run: |
|
|
cp nitter.example.conf nitter.conf
|
|
sed -i 's/enableDebug = false/enableDebug = true/g' nitter.conf
|
|
|
|
# Run both Nimble tasks concurrently
|
|
nim r tools/rendermd.nim &
|
|
nim r tools/gencss.nim &
|
|
wait
|
|
|
|
echo '${{ secrets.SESSIONS }}' | head -n1
|
|
echo '${{ secrets.SESSIONS }}' > ./sessions.jsonl
|
|
|
|
- name: Run Tests
|
|
run: |
|
|
./nitter &
|
|
cd tests
|
|
poetry run pytest -n3 --reruns=3 --rs .
|