|
8 | 8 | - master
|
9 | 9 | workflow_call:
|
10 | 10 |
|
| 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 | + |
11 | 48 | 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 |
13 | 63 | runs-on: buildjet-2vcpu-ubuntu-2204
|
14 | 64 | strategy:
|
15 | 65 | matrix:
|
16 |
| - nim: |
17 |
| - - "1.6.x" |
18 |
| - - "2.0.x" |
19 |
| - - "2.2.x" |
20 |
| - - "devel" |
| 66 | + nim: [ "devel" ] |
21 | 67 | 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 |
46 | 74 | 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 |
48 | 84 | cp nitter.example.conf nitter.conf
|
49 | 85 | sed -i 's/enableDebug = false/enableDebug = true/g' nitter.conf
|
50 | 86 | nimble md
|
51 | 87 | nimble scss
|
| 88 | + echo '${{ secrets.SESSIONS }}' | head -n1 |
52 | 89 | echo '${{ secrets.SESSIONS }}' > ./sessions.jsonl
|
53 |
| - - name: Run tests |
| 90 | +
|
| 91 | + - name: Run Tests |
54 | 92 | run: |
|
55 | 93 | ./nitter &
|
56 | 94 | pytest -n3 tests
|
0 commit comments