File: python.yml

package info (click to toggle)
python-cmake-build-extension 0.6.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 484 kB
  • sloc: python: 504; cpp: 70; sh: 13; makefile: 5
file content (119 lines) | stat: -rw-r--r-- 3,013 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
name: Python CI/CD

on:
  push:
  pull_request:
  release:
    types:
      - published

jobs:

  build-and-test:
    name: 'Python${{ matrix.python-version }}@${{ matrix.os }}'
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        python-version:
          - 3.8
          - 3.9
          - "3.10"
          - "3.11"
          - "3.12"
        os:
          - ubuntu-20.04
          - macos-latest
          - windows-latest
        include:
          - optional: false

    steps:

      - uses: actions/checkout@master
      - run: git fetch --prune --unshallow

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

      - name: Install cmake-build-extensions
        run: pip install wheel && pip install -v .[all]

      - name: Example dependencies [Windows]
        if: contains(matrix.os, 'windows')
        shell: bash
        run: |
          choco install -y swig
          vcpkg install --triplet x64-windows eigen3

      - name: Example dependencies [macOS]
        if: contains(matrix.os, 'macOS')
        run: |
          brew install swig eigen
          # https://cibuildwheel.readthedocs.io/en/stable/cpp_standards
          echo "MACOSX_DEPLOYMENT_TARGET=10.14" >> $GITHUB_ENV

      - name: Example dependencies [Ubuntu]
        if: contains(matrix.os, 'ubuntu')
        run: |
          sudo apt update
          sudo apt install build-essential swig libeigen3-dev

      - name: Build and install example
        continue-on-error: ${{ matrix.optional }}
        working-directory: example
        run: pip install -v .[all]
        env:
          # Pretend to be using cibuildwheel
          CIBUILDWHEEL: 1

      - name: Test example
        continue-on-error: ${{ matrix.optional }}
        working-directory: example
        run: pytest

  publish:
    name: Publish to PyPI
    needs: build-and-test
    runs-on: ubuntu-20.04

    steps:

      - uses: actions/checkout@master
      - run: git fetch --prune --unshallow

      - name: Set up Python
        uses: actions/setup-python@v2
        with:
          python-version: 3.8

      - name: Install Python tools
        run: pip install build

      - name: Create distributions
        run: python -m build -o dist/

      - name: Inspect dist folder
        run: ls -lah dist/

      - name: Check wheel
        run: test $(find dist/ -name *-none-any.whl | wc -l) -gt 0

      - name: Upload artifacts
        uses: actions/upload-artifact@v2
        with:
          path: dist/*
          name: dist

      - name: Publish to PyPI
        if: |
          github.repository == 'diegoferigo/cmake-build-extension' &&
          ((github.event_name == 'push' && github.ref == 'refs/heads/master') ||
           (github.event_name == 'release'))
        uses: pypa/gh-action-pypi-publish@master
        with:
          user: __token__
          password: ${{ secrets.PYPI_TOKEN }}
          skip_existing: true