File: tests.yml

package info (click to toggle)
dpath-python 2.2.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 256 kB
  • sloc: python: 1,671; makefile: 3
file content (86 lines) | stat: -rw-r--r-- 2,236 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
name: Run tests

# Controls when the workflow will run
on:
  # Triggers the workflow on push or pull request events but only for important files
  push:
    branches:
      - master
    paths:
      - "dpath/"
      - "**.py"
      - "tox.ini"
  pull_request:
    paths:
      - "dpath/"
      - "**.py"
      - "tox.ini"

  # Allows you to run this workflow manually from the Actions tab
  workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:

  # Run flake8 linter
  flake8:
    runs-on: ubuntu-latest

    steps:
      - name: Check out code
        uses: actions/checkout@main

      - name: Set up Python 3.12
        uses: actions/setup-python@main
        with:
          python-version: "3.12"

      - name: Setup flake8 annotations
        uses: TrueBrain/actions-flake8@v2.3
        with:
          path: setup.py dpath/ tests/

  # Generate a common hashseed for all tests
  generate-hashseed:
    runs-on: ubuntu-latest

    outputs:
      hashseed: ${{ steps.generate.outputs.hashseed }}

    steps:
      - name: Generate Hashseed
        id: generate
        run: |
          python -c "import os
          from random import randint
          hashseed = randint(0, 4294967295)
          print(f'{hashseed=}')
          open(os.environ['GITHUB_OUTPUT'], 'a').write(f'hashseed={hashseed}')"

  # Tests job
  tests:
    # The type of runner that the job will run on
    runs-on: ubuntu-latest

    needs: [generate-hashseed, flake8]

    strategy:
      matrix:
        # Match versions specified in tox.ini
        python-version: ['3.8', '3.9', '3.10', '3.11', 'pypy-3.7', '3.12']

    # Steps represent a sequence of tasks that will be executed as part of the job
    steps:
      # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
    - name: Check out code
      uses: actions/checkout@main

    - name: Set up Python ${{ matrix.python-version }}
      uses: actions/setup-python@main
      with:
        python-version: ${{ matrix.python-version }}

    - name: Run tox with tox-gh-actions
      uses: ymyzk/run-tox-gh-actions@main
      with:
        tox-args: -vv --hashseed=${{ needs.generate-hashseed.outputs.hashseed }}