Skip to content

Commit fb7c1d8

Browse files
committed
Improve test workflow
1 parent 54ba1e3 commit fb7c1d8

File tree

1 file changed

+74
-22
lines changed

1 file changed

+74
-22
lines changed

.github/workflows/run-tests.yml

+74-22
Original file line numberDiff line numberDiff line change
@@ -8,49 +8,101 @@ on:
88
- master
99
workflow_call:
1010

11+
# Ensure that multiple runs on the same branch do not overlap.
12+
concurrency:
13+
group: ${{ github.workflow }}-${{ github.ref }}
14+
cancel-in-progress: true
15+
16+
defaults:
17+
run:
18+
shell: bash
19+
1120
jobs:
12-
test:
21+
build-test:
22+
name: Build and test
1323
runs-on: buildjet-2vcpu-ubuntu-2204
1424
strategy:
1525
matrix:
16-
nim:
17-
- "1.6.x"
18-
- "2.0.x"
19-
- "2.2.x"
20-
- "devel"
26+
nim: ["1.6.x", "2.0.x", "2.2.x", "devel"]
2127
steps:
22-
- uses: actions/checkout@v3
28+
- name: Checkout Code
29+
uses: actions/checkout@v4
2330
with:
2431
fetch-depth: 0
25-
- name: Cache nimble
32+
33+
- name: Cache Nimble Dependencies
2634
id: cache-nimble
27-
uses: buildjet/cache@v3
35+
uses: buildjet/cache@v4
2836
with:
2937
path: ~/.nimble
30-
key: ${{ matrix.nim }}-nimble-${{ hashFiles('*.nimble') }}
38+
key: ${{ matrix.nim }}-nimble-v2-${{ hashFiles('*.nimble') }}
3139
restore-keys: |
32-
${{ matrix.nim }}-nimble-
33-
- uses: actions/setup-python@v4
40+
${{ matrix.nim }}-nimble-v2-
41+
42+
- name: Setup Nim
43+
uses: jiro4989/setup-nim-action@v2
44+
with:
45+
nim-version: ${{ matrix.nim }}
46+
use-nightlies: true
47+
repo-token: ${{ secrets.GITHUB_TOKEN }}
48+
49+
- name: Build Project
50+
run: nimble build -d:release -Y
51+
52+
integration-test:
53+
needs: [build-test]
54+
name: Integration test
55+
runs-on: buildjet-2vcpu-ubuntu-2204
56+
steps:
57+
- name: Checkout code
58+
uses: actions/checkout@v4
59+
with:
60+
fetch-depth: 0
61+
62+
- name: Cache Nimble Dependencies
63+
id: cache-nimble
64+
uses: buildjet/cache@v4
65+
with:
66+
path: ~/.nimble
67+
key: devel-nimble-v2-${{ hashFiles('*.nimble') }}
68+
restore-keys: |
69+
devel-nimble-v2-
70+
71+
- name: Setup Python (3.10) with pip cache
72+
uses: buildjet/setup-python@v4
3473
with:
3574
python-version: "3.10"
36-
cache: "pip"
37-
- uses: jiro4989/setup-nim-action@v1
75+
cache: pip
76+
77+
- name: Setup Nim
78+
uses: jiro4989/setup-nim-action@v2
3879
with:
39-
nim-version: ${{ matrix.nim }}
80+
nim-version: devel
81+
use-nightlies: true
4082
repo-token: ${{ secrets.GITHUB_TOKEN }}
41-
- run: nimble build -d:release -Y
42-
- run: pip install seleniumbase
43-
- run: seleniumbase install chromedriver
44-
- uses: supercharge/[email protected]
45-
- name: Prepare Nitter
83+
84+
- name: Build Project
85+
run: nimble build -d:release -Y
86+
87+
- name: Install SeleniumBase and Chromedriver
88+
run: |
89+
pip install seleniumbase
90+
seleniumbase install chromedriver
91+
92+
- name: Start Redis Service
93+
uses: supercharge/[email protected]
94+
95+
- name: Prepare Nitter Environment
4696
run: |
47-
sudo apt install libsass-dev -y
97+
sudo apt-get update && sudo apt-get install -y libsass-dev
4898
cp nitter.example.conf nitter.conf
4999
sed -i 's/enableDebug = false/enableDebug = true/g' nitter.conf
50100
nimble md
51101
nimble scss
102+
echo '${{ secrets.SESSIONS }}' | head -n1
52103
echo '${{ secrets.SESSIONS }}' > ./sessions.jsonl
53-
- name: Run tests
104+
105+
- name: Run Tests
54106
run: |
55107
./nitter &
56108
pytest -n3 tests

0 commit comments

Comments
 (0)