Skip to content

Commit 8b060b7

Browse files
committed
Build test
1 parent 54ba1e3 commit 8b060b7

File tree

1 file changed

+70
-32
lines changed

1 file changed

+70
-32
lines changed

.github/workflows/run-tests.yml

+70-32
Original file line numberDiff line numberDiff line change
@@ -8,49 +8,87 @@ 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+
20+
# Define common steps as an anchor to avoid repetition.
21+
x-common-steps: &common-steps
22+
- name: Checkout code
23+
uses: actions/checkout@v3
24+
with:
25+
fetch-depth: 0
26+
27+
- name: Cache Nimble Dependencies
28+
id: cache-nimble
29+
uses: buildjet/cache@v3
30+
with:
31+
path: ~/.nimble
32+
key: ${{ matrix.nim }}-nimble-${{ hashFiles('*.nimble') }}
33+
restore-keys: |
34+
${{ matrix.nim }}-nimble-
35+
36+
- name: Setup Python (3.10) with pip cache
37+
uses: actions/setup-python@v4
38+
with:
39+
python-version: "3.10"
40+
cache: pip
41+
42+
- name: Setup Nim
43+
uses: jiro4989/setup-nim-action@v1
44+
with:
45+
nim-version: ${{ matrix.nim }}
46+
repo-token: ${{ secrets.GITHUB_TOKEN }}
47+
1148
jobs:
12-
test:
49+
build-test:
50+
name: Test building on 1.6, 2.0, 2.2, devel
51+
runs-on: buildjet-2vcpu-ubuntu-2204
52+
strategy:
53+
matrix:
54+
nim: [ "1.6.x", "2.0.x", "2.2.x", "devel" ]
55+
steps:
56+
<<: *common-steps
57+
58+
- name: Build Project
59+
run: nimble build -d:release -Y
60+
61+
integration-test:
62+
name: Full integration test
1363
runs-on: buildjet-2vcpu-ubuntu-2204
1464
strategy:
1565
matrix:
16-
nim:
17-
- "1.6.x"
18-
- "2.0.x"
19-
- "2.2.x"
20-
- "devel"
66+
nim: [ "devel" ]
2167
steps:
22-
- uses: actions/checkout@v3
23-
with:
24-
fetch-depth: 0
25-
- name: Cache nimble
26-
id: cache-nimble
27-
uses: buildjet/cache@v3
28-
with:
29-
path: ~/.nimble
30-
key: ${{ matrix.nim }}-nimble-${{ hashFiles('*.nimble') }}
31-
restore-keys: |
32-
${{ matrix.nim }}-nimble-
33-
- uses: actions/setup-python@v4
34-
with:
35-
python-version: "3.10"
36-
cache: "pip"
37-
- uses: jiro4989/setup-nim-action@v1
38-
with:
39-
nim-version: ${{ matrix.nim }}
40-
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
68+
<<: *common-steps
69+
70+
- name: Build Project
71+
run: nimble build -d:release -Y
72+
73+
- name: Install SeleniumBase and Chromedriver
4674
run: |
47-
sudo apt install libsass-dev -y
75+
pip install seleniumbase
76+
seleniumbase install chromedriver
77+
78+
- name: Start Redis Service
79+
uses: supercharge/[email protected]
80+
81+
- name: Prepare Nitter Environment
82+
run: |
83+
sudo apt-get update && sudo apt-get install -y libsass-dev
4884
cp nitter.example.conf nitter.conf
4985
sed -i 's/enableDebug = false/enableDebug = true/g' nitter.conf
5086
nimble md
5187
nimble scss
88+
echo '${{ secrets.SESSIONS }}' | head -n1
5289
echo '${{ secrets.SESSIONS }}' > ./sessions.jsonl
53-
- name: Run tests
90+
91+
- name: Run Tests
5492
run: |
5593
./nitter &
5694
pytest -n3 tests

0 commit comments

Comments
 (0)