Improve test workflow
This commit is contained in:
98
.github/workflows/run-tests.yml
vendored
98
.github/workflows/run-tests.yml
vendored
@@ -8,49 +8,101 @@ on:
|
|||||||
- master
|
- master
|
||||||
workflow_call:
|
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:
|
jobs:
|
||||||
test:
|
build-test:
|
||||||
|
name: Build and test
|
||||||
runs-on: buildjet-2vcpu-ubuntu-2204
|
runs-on: buildjet-2vcpu-ubuntu-2204
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
nim:
|
nim: ["1.6.x", "2.0.x", "2.2.x", "devel"]
|
||||||
- "1.6.x"
|
|
||||||
- "2.0.x"
|
|
||||||
- "2.2.x"
|
|
||||||
- "devel"
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- name: Checkout Code
|
||||||
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
- name: Cache nimble
|
|
||||||
|
- name: Cache Nimble Dependencies
|
||||||
id: cache-nimble
|
id: cache-nimble
|
||||||
uses: buildjet/cache@v3
|
uses: buildjet/cache@v4
|
||||||
with:
|
with:
|
||||||
path: ~/.nimble
|
path: ~/.nimble
|
||||||
key: ${{ matrix.nim }}-nimble-${{ hashFiles('*.nimble') }}
|
key: ${{ matrix.nim }}-nimble-v2-${{ hashFiles('*.nimble') }}
|
||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ matrix.nim }}-nimble-
|
${{ matrix.nim }}-nimble-v2-
|
||||||
- uses: actions/setup-python@v4
|
|
||||||
with:
|
- name: Setup Nim
|
||||||
python-version: "3.10"
|
uses: jiro4989/setup-nim-action@v2
|
||||||
cache: "pip"
|
|
||||||
- uses: jiro4989/setup-nim-action@v1
|
|
||||||
with:
|
with:
|
||||||
nim-version: ${{ matrix.nim }}
|
nim-version: ${{ matrix.nim }}
|
||||||
|
use-nightlies: true
|
||||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
- run: nimble build -d:release -Y
|
|
||||||
- run: pip install seleniumbase
|
- name: Build Project
|
||||||
- run: seleniumbase install chromedriver
|
run: nimble build -d:release -Y
|
||||||
- uses: supercharge/redis-github-action@1.5.0
|
|
||||||
- name: Prepare Nitter
|
integration-test:
|
||||||
|
needs: [build-test]
|
||||||
|
name: Integration test
|
||||||
|
runs-on: buildjet-2vcpu-ubuntu-2204
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Cache Nimble Dependencies
|
||||||
|
id: cache-nimble
|
||||||
|
uses: buildjet/cache@v4
|
||||||
|
with:
|
||||||
|
path: ~/.nimble
|
||||||
|
key: devel-nimble-v2-${{ hashFiles('*.nimble') }}
|
||||||
|
restore-keys: |
|
||||||
|
devel-nimble-v2-
|
||||||
|
|
||||||
|
- name: Setup Python (3.10) with pip cache
|
||||||
|
uses: buildjet/setup-python@v4
|
||||||
|
with:
|
||||||
|
python-version: "3.10"
|
||||||
|
cache: pip
|
||||||
|
|
||||||
|
- name: Setup Nim
|
||||||
|
uses: jiro4989/setup-nim-action@v2
|
||||||
|
with:
|
||||||
|
nim-version: devel
|
||||||
|
use-nightlies: true
|
||||||
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Build Project
|
||||||
|
run: nimble build -d:release -Y
|
||||||
|
|
||||||
|
- name: Install SeleniumBase and Chromedriver
|
||||||
run: |
|
run: |
|
||||||
sudo apt install libsass-dev -y
|
pip install seleniumbase
|
||||||
|
seleniumbase install chromedriver
|
||||||
|
|
||||||
|
- name: Start Redis Service
|
||||||
|
uses: supercharge/redis-github-action@1.5.0
|
||||||
|
|
||||||
|
- name: Prepare Nitter Environment
|
||||||
|
run: |
|
||||||
|
sudo apt-get update && sudo apt-get install -y libsass-dev
|
||||||
cp nitter.example.conf nitter.conf
|
cp nitter.example.conf nitter.conf
|
||||||
sed -i 's/enableDebug = false/enableDebug = true/g' nitter.conf
|
sed -i 's/enableDebug = false/enableDebug = true/g' nitter.conf
|
||||||
nimble md
|
nimble md
|
||||||
nimble scss
|
nimble scss
|
||||||
|
echo '${{ secrets.SESSIONS }}' | head -n1
|
||||||
echo '${{ secrets.SESSIONS }}' > ./sessions.jsonl
|
echo '${{ secrets.SESSIONS }}' > ./sessions.jsonl
|
||||||
- name: Run tests
|
|
||||||
|
- name: Run Tests
|
||||||
run: |
|
run: |
|
||||||
./nitter &
|
./nitter &
|
||||||
pytest -n3 tests
|
pytest -n3 tests
|
||||||
|
|||||||
Reference in New Issue
Block a user