Debian Codegraph @

.github/workflows/tests.yml

raw symbols SCIP
1 name: Run tests
2
3 # Controls when the workflow will run
4 on:
5 # Triggers the workflow on push or pull request events but only for important files
6 push:
7 branches:
8 - master
9 paths:
10 - "dpath/"
11 - "**.py"
12 - "tox.ini"
13 pull_request:
14 paths:
15 - "dpath/"
16 - "**.py"
17 - "tox.ini"
18
19 # Allows you to run this workflow manually from the Actions tab
20 workflow_dispatch:
21
22 # A workflow run is made up of one or more jobs that can run sequentially or in parallel
23 jobs:
24
25 # Run flake8 linter
26 flake8:
27 runs-on: ubuntu-latest
28
29 steps:
30 - name: Check out code
31 uses: actions/checkout@main
32
33 - name: Set up Python 3.12
34 uses: actions/setup-python@main
35 with:
36 python-version: "3.12"
37
38 - name: Setup flake8 annotations
39 uses: TrueBrain/[email protected]
40 with:
41 path: setup.py dpath/ tests/
42
43 # Generate a common hashseed for all tests
44 generate-hashseed:
45 runs-on: ubuntu-latest
46
47 outputs:
48 hashseed: ${{ steps.generate.outputs.hashseed }}
49
50 steps:
51 - name: Generate Hashseed
52 id: generate
53 run: |
54 python -c "import os
55 from random import randint
56 hashseed = randint(0, 4294967295)
57 print(f'{hashseed=}')
58 open(os.environ['GITHUB_OUTPUT'], 'a').write(f'hashseed={hashseed}')"
59
60 # Tests job
61 tests:
62 # The type of runner that the job will run on
63 runs-on: ubuntu-latest
64
65 needs: [generate-hashseed, flake8]
66
67 strategy:
68 matrix:
69 # Match versions specified in tox.ini
70 python-version: ['3.8', '3.9', '3.10', '3.11', 'pypy-3.7', '3.12']
71
72 # Steps represent a sequence of tasks that will be executed as part of the job
73 steps:
74 # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
75 - name: Check out code
76 uses: actions/checkout@main
77
78 - name: Set up Python ${{ matrix.python-version }}
79 uses: actions/setup-python@main
80 with:
81 python-version: ${{ matrix.python-version }}
82
83 - name: Run tox with tox-gh-actions
84 uses: ymyzk/run-tox-gh-actions@main
85 with:
86 tox-args: -vv --hashseed=${{ needs.generate-hashseed.outputs.hashseed }}