summaryrefslogtreecommitdiff
path: root/.github/workflows/ci.yml
blob: 3aec97a6d1befe66fd26d2d145bd865b16f5ffd0 (plain)
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
name: GitHub CI

on:
  push:
    branches:
      - master
  pull_request:

jobs:
  test:
    runs-on: ${{ matrix.os }}
    container: ${{ matrix.container }}
    strategy:
      fail-fast: false
      matrix:
        include:
          - name: py2.6
            os: ubuntu-latest
            container: centos:6
            python-version: 2.6
            tox-env: py26
          - name: py2.7
            os: ubuntu-16.04
            python-version: 2.7
            tox-env: py27
          - name: py2.7 with old gmpy
            os: ubuntu-16.04
            python-version: 2.7
            tox-env: py27_old_gmpy
          - name: py2.7 with old gmpy2
            os: ubuntu-16.04
            python-version: 2.7
            tox-env: py27_old_gmpy2
          - name: py2.7 with old six
            os: ubuntu-16.04
            python-version: 2.7
            tox-env: py27_old_six
          - name: py2.7 with gmpy
            os: ubuntu-16.04
            python-version: 2.7
            tox-env: gmpypy27
          - name: py2.7 with gmpy2
            os: ubuntu-16.04
            python-version: 2.7
            tox-env: gmpy2py27
          - name: py3.3
            os: ubuntu-18.04
            python-version: 3.3
            tox-env: py33
          - name: py3.4
            os: ubuntu-18.04
            python-version: 3.4
            tox-env: py34
          - name: py3.5
            os: ubuntu-18.04
            python-version: 3.5
            tox-env: py35
          - name: py3.6
            os: ubuntu-18.04
            python-version: 3.6
            tox-env: py36
          - name: py3.7
            os: ubuntu-latest
            python-version: 3.7
            tox-env: py37
          - name: py3.8
            os: ubuntu-latest
            python-version: 3.8
            tox-env: py38
          - name: py3.9
            os: ubuntu-latest
            python-version: 3.9
            tox-env: py39
          - name: py3.9 with gmpy
            os: ubuntu-latest
            python-version: 3.9
            tox-env: gmpypy39
          - name: py3.9 with gmpy2
            os: ubuntu-latest
            python-version: 3.9
            tox-env: gmpy2py39
          - name: pypy
            os: ubuntu-latest
            python-version: pypy-2.7
            tox-env: pypy
          - name: pypy3
            os: ubuntu-latest
            python-version: pypy-3.6
            tox-env: pypy3
          # special configurations
          - name: py2.7 with instrumental
            os: ubuntu-16.04
            python-version: 2.7
            opt-deps: ['instrumental']
          - name: code checks
            os: ubuntu-latest
            python-version: 3.9
            tox-env: codechecks
    steps:
      - uses: actions/checkout@v2
        if: ${{ !matrix.container }}
        with:
          fetch-depth: 50
      - uses: actions/checkout@v1
        # centos 6 doesn't have glibc new enough for the nodejs used by v2
        if: ${{ matrix.container }}
        with:
          fetch-depth: 50
      - name: Ensure dependencies on CentOS
        if: ${{ matrix.container }}
        run: |
          ls /etc/yum.repos.d/
          cat /etc/yum.repos.d/CentOS-Base.repo
          rm /etc/yum.repos.d/CentOS-Base.repo
          cat > /etc/yum.repos.d/CentOS-Base.repo <<EOF
          [base]
          name=CentOS-$releasever - Base
          baseurl=https://vault.centos.org/6.10/os/x86_64/
          gpgcheck=1
          gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

          [updates]
          name=CentOS-$releasever - Updates
          baseurl=https://vault.centos.org/6.10/updates/x86_64/
          gpgcheck=1
          gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

          [extras]
          name=CentOS-$releasever - Extras
          baseurl=https://vault.centos.org/6.10/extras/x86_64/
          gpgcheck=1
          gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

          EOF
          echo installing
          yum clean all
          yum repolist all
          yum install -y git make python curl gcc libffi-devel python-devel glibc-devel openssl-devel
      - name: Verify git status
        run: |
          git status
          git remote -v
      - name: Ensure we have baseline branch for quality coverage
        run: git fetch origin master:refs/remotes/origin/master
      - name: Set up Python ${{ matrix.python-version }}
        # we use containers to use the native python version from them
        if: ${{ !matrix.container }}
        uses: actions/setup-python@v2
        with:
          python-version: ${{ matrix.python-version }}
      - name: Display Python version
        run: python -c "import sys; print(sys.version)"
      - name: Display installed python package versions
        run: |
          pip list || :
      - name: Ensure working pip on 3.3
        if: ${{ matrix.python-version == '3.3' }}
        run: |
          curl -o get-pip.py https://bootstrap.pypa.io/3.3/get-pip.py;
          python get-pip.py
      - name: Ensure working pip on 2.6
        if: ${{ matrix.python-version == '2.6' }}
        run: |
          curl -o get-pip.py https://bootstrap.pypa.io/2.6/get-pip.py;
          python get-pip.py
          pip list
          pip install setuptools==28.8.0 wheel==0.30.0a0
      - name: Install instrumental
        if: ${{ contains(matrix.tox-env, 'instrumental') }}
        run: pip install instrumental
      - name: Install gmpy
        if: ${{ contains(matrix.tox-env, 'gmpy') }}
        run: pip install gmpy
      - name: Install gmpy2 dependencies
        if: ${{ contains(matrix.tox-env, 'gmpy2') }}
        run: sudo apt-get install -y libmpfr-dev libmpc-dev
      - name: Install gmpy2
        if: ${{ contains(matrix.tox-env, 'gmpy2') }}
        run: pip install gmpy2
      - name: Install build dependencies
        run: |
          if [[ -e build-requirements-${{ matrix.python-version }}.txt ]]; then
            pip install -r build-requirements-${{ matrix.python-version }}.txt;
          else
            pip install -r build-requirements.txt;
          fi
      - name: Display installed python package versions
        run: pip list
      - name: Run unit tests
        if: ${{ matrix.tox-env }}
        run: tox -e ${{ matrix.tox-env }}
      - name: Publish coverage to Coveralls
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
          COVERALLS_FLAG_NAME: ${{ matrix.name }}
          COVERALLS_PARALLEL: true
          COVERALLS_SERVICE_NAME: git hub actions
        run: coveralls

  coveralls:
    name: Indicate completion to coveralls.io
    needs: test
    runs-on: ubuntu-latest
    steps:
      - name: Set up Python 3.8
        uses: actions/setup-python@v2
        with:
          python-version: 3.8
      - name: Finished
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          COVERALLS_SERVICE_NAME: git hub actions
        run: |
          pip install --upgrade coveralls
          coveralls --service=github --finish