File: ci.yml

package info (click to toggle)
dbus-fast 3.1.2-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,804 kB
  • sloc: python: 9,997; xml: 39; makefile: 29; sh: 5
file content (227 lines) | stat: -rw-r--r-- 8,026 bytes parent folder | download
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
name: CI

on:
  push:
    branches:
      - main
  pull_request:

concurrency:
  group: ${{ github.head_ref || github.run_id }}
  cancel-in-progress: true

jobs:
  lint:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v4
      - uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v5
        with:
          python-version: "3.10"
      - uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd # v3.0.1

  # Make sure commit messages follow the conventional commits convention:
  # https://www.conventionalcommits.org
  commitlint:
    name: Lint Commit Messages
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v4
        with:
          fetch-depth: 0
      - uses: wagoid/commitlint-github-action@b948419dd99f3fd78a6548d48f94e3df7f6bf3ed # v6

  test:
    strategy:
      fail-fast: false
      matrix:
        python-version:
          - "3.10"
          - "3.11"
          - "3.12"
          - "3.13"
          - "3.14"
          - "3.14t"
        os:
          - ubuntu-latest
        extension:
          - "skip_cython"
          - "use_cython"
    runs-on: ${{ matrix.os }}
    steps:
      - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v4
      - name: Install libs
        run: sudo apt-get install -y dbus-daemon python3-gi libgirepository1.0-dev gcc libcairo2-dev pkg-config python3-dev gir1.2-gtk-3.0
      - uses: snok/install-poetry@76e04a911780d5b312d89783f7b1cd627778900a # v1.4.1
      - name: Set up Python
        uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v5
        with:
          python-version: ${{ matrix.python-version }}
          cache: "poetry"
          allow-prereleases: true
      - name: Install Dependencies
        run: |
          if [ "${{ matrix.extension }}" = "skip_cython" ]; then
            SKIP_CYTHON=1 poetry install --only=main,dev
          else
            REQUIRE_CYTHON=1 poetry install --only=main,dev
          fi
      - name: Test with Pytest
        run: dbus-run-session -- poetry run pytest --cov-report=xml --timeout=5
      - name: Upload coverage to Codecov
        uses: codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7 # v5
        with:
          token: ${{ secrets.CODECOV_TOKEN }}

  test_big_endian:
    name: Big-endian s390x tests
    runs-on: ubuntu-latest

    steps:
      - name: Checkout code
        uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v4
      - uses: uraimo/run-on-arch-action@1c358dc49363439f8c563ce8f93005f7fe76b849 # v3
        name: Run commands
        id: runcmd
        with:
          arch: s390x
          distro: ubuntu_latest
          run: |
            apt-get -y update
            apt-get -y install git python3-pip python3-venv python3-poetry dbus-daemon python3-gi libgirepository1.0-dev gcc libcairo2-dev pkg-config python3-dev gir1.2-gtk-3.0
            git clone --depth 1 $GITHUB_SERVER_URL/$GITHUB_REPOSITORY
            cd dbus-fast
            git fetch origin --depth 1 $GITHUB_SHA
            git checkout $GITHUB_SHA
            REQUIRE_CYTHON=1 poetry install --only=main,dev
            dbus-run-session -- poetry run pytest --no-cov --timeout=100

  benchmark:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v4
      - name: Install libs
        run: sudo apt-get install -y dbus-daemon python3-gi libgirepository1.0-dev gcc libcairo2-dev pkg-config python3-dev gir1.2-gtk-3.0
      - uses: snok/install-poetry@76e04a911780d5b312d89783f7b1cd627778900a # v1.4.1
      - name: Setup Python 3.13
        uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v5
        with:
          python-version: 3.13
          cache: "poetry"
      - name: Install Dependencies
        run: |
          REQUIRE_CYTHON=1 poetry install --only=main,dev
        shell: bash
      - name: Run benchmarks
        uses: CodSpeedHQ/action@4348f634fa7309fe23aac9502e88b999ec90a164 # v3
        with:
          mode: instrumentation
          token: ${{ secrets.CODSPEED_TOKEN }}
          run: dbus-run-session -- poetry run pytest --no-cov -vvvvv --codspeed tests/benchmarks

  release:
    needs:
      - test
      - lint
      - commitlint

    runs-on: ubuntu-latest
    environment: release
    concurrency: release
    permissions:
      id-token: write
      contents: write
    outputs:
      released: ${{ steps.release.outputs.released }}
      newest_release_tag: ${{ steps.release_tag.outputs.newest_release_tag }}

    steps:
      - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v4
        with:
          fetch-depth: 0
          ref: ${{ github.head_ref || github.ref_name }}

      # Do a dry run of PSR
      - name: Test release
        uses: python-semantic-release/python-semantic-release@4d4cb0ab842247caea1963132c242c62aab1e4d5 # v10.4.1
        if: github.ref_name != 'main'
        with:
          no_operation_mode: true

      # On main branch: actual PSR + upload to PyPI & GitHub
      - name: Release
        uses: python-semantic-release/python-semantic-release@4d4cb0ab842247caea1963132c242c62aab1e4d5 # v10.4.1
        id: release
        if: github.ref_name == 'main'
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}

      - name: Publish package distributions to PyPI
        uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # release/v1
        if: steps.release.outputs.released == 'true'

      - name: Publish package distributions to GitHub Releases
        uses: python-semantic-release/upload-to-gh-release@0a92b5d7ebfc15a84f9801ebd1bf706343d43711 # main
        if: steps.release.outputs.released == 'true'
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}

      - name: Install python-semantic-release
        run: python3 -m pip install python-semantic-release==7.34.6

      - name: Get Release Tag
        id: release_tag
        shell: bash
        run: |
          echo "newest_release_tag=$(semantic-release print-version --current)" >> $GITHUB_OUTPUT

  build_wheels:
    needs: [release]
    if: needs.release.outputs.released == 'true'

    name: Build wheels on ${{ matrix.os }} with arch ${{ matrix.arch }}
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os: [ubuntu-24.04-arm, ubuntu-latest, macos-latest]
        musl: ["", "musllinux"]
        exclude:
          - os: macos-latest
            musl: "musllinux"
    steps:
      - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v4
        with:
          ref: "v${{ needs.release.outputs.newest_release_tag }}"
          fetch-depth: 0

      - name: Build wheels
        uses: pypa/cibuildwheel@9c00cb4f6b517705a3794b22395aedc36257242c # v3.2.1
        env:
          CIBW_SKIP: "*p36-* *p37-* *p38-* ${{ matrix.musl == 'musllinux' && '*manylinux*' || '*musllinux*' }}"
          CIBW_BEFORE_ALL_LINUX: apt-get install -y gcc || yum install -y gcc || apk add gcc
          CIBW_BUILD_VERBOSITY: 3
          REQUIRE_CYTHON: 1
          CIBW_ARCHS_LINUX: ${{ matrix.os == 'ubuntu-24.04-arm' && 'aarch64' || 'auto' }}

      - uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v4
        with:
          path: ./wheelhouse/*.whl
          name: wheels-${{ matrix.os }}-${{ matrix.musl }}

  upload_pypi:
    needs: [build_wheels]
    runs-on: ubuntu-latest
    environment: release
    permissions:
      id-token: write
      contents: write
    steps:
      - uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v4
        with:
          # unpacks default artifact into dist/
          # if `name: artifact` is omitted, the action will create extra parent dir
          pattern: wheels-*
          path: dist
          merge-multiple: true

      - uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.13.0