source: trunk/.github/workflows/ci.yml

Last change on this file was 61a5d2b, checked in by meejah <meejah@…>, at 2024-12-06T20:20:18Z

don't need

  • Property mode set to 100644
File size: 9.8 KB
Line 
1name: CI
2
3on:
4  push:
5    branches:
6      - "master"
7  pull_request:
8
9# At the start of each workflow run, GitHub creates a unique
10# GITHUB_TOKEN secret to use in the workflow. It is a good idea for
11# this GITHUB_TOKEN to have the minimum of permissions.  See:
12#
13# - https://docs.github.com/en/actions/security-guides/automatic-token-authentication
14# - https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#permissions
15#
16permissions:
17  contents: read
18
19# Control to what degree jobs in this workflow will run concurrently with
20# other instances of themselves.
21#
22# https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions#concurrency
23concurrency:
24  # We want every revision on master to run the workflow completely.
25  # "head_ref" is not set for the "push" event but it is set for the
26  # "pull_request" event.  If it is set then it is the name of the branch and
27  # we can use it to make sure each branch has only one active workflow at a
28  # time.  If it is not set then we can compute a unique string that gives
29  # every master/push workflow its own group.
30  group: "${{ github.head_ref || format('{0}-{1}', github.run_number, github.run_attempt) }}"
31
32  # Then, we say that if a new workflow wants to start in the same group as a
33  # running workflow, the running workflow should be cancelled.
34  cancel-in-progress: true
35
36env:
37  # Tell Hypothesis which configuration we want it to use.
38  TAHOE_LAFS_HYPOTHESIS_PROFILE: "ci"
39
40jobs:
41
42  coverage:
43    runs-on: ${{ matrix.os }}
44    strategy:
45      fail-fast: false
46      matrix:
47        include:
48          - os: macos-14
49            python-version: "3.12"
50          # We only support PyPy on Linux at the moment.
51          - os: ubuntu-22.04
52            python-version: "pypy-3.9"
53          - os: ubuntu-22.04
54            python-version: "3.12"
55          - os: windows-2022
56            python-version: "3.12"
57
58    steps:
59      # See https://github.com/actions/checkout. A fetch-depth of 0
60      # fetches all tags and branches.
61      - name: Check out Tahoe-LAFS sources
62        uses: actions/checkout@v3
63        with:
64          fetch-depth: 0
65
66      - name: Set up Python ${{ matrix.python-version }}
67        uses: actions/setup-python@v4
68        with:
69          python-version: ${{ matrix.python-version }}
70          cache: 'pip'  # caching pip dependencies
71
72      - name: Install Python packages
73        run: |
74          pip install --upgrade tox tox-gh-actions
75          pip list
76
77      - name: Display tool versions
78        run: python misc/build_helpers/show-tool-versions.py
79
80      - name: Run tox for corresponding Python version
81        if: ${{ !contains(matrix.os, 'windows') }}
82        run: python -m tox
83
84      # On Windows, a non-blocking pipe might respond (when emulating Unix-y
85      # API) with ENOSPC to indicate buffer full. Trial doesn't handle this
86      # well, so it breaks test runs. To attempt to solve this, we pipe the
87      # output through passthrough.py that will hopefully be able to do the right
88      # thing by using Windows APIs.
89      - name: Run tox for corresponding Python version
90        if: ${{ contains(matrix.os, 'windows') }}
91        run: |
92          pip install twisted pywin32
93          python -m tox | python misc/windows-enospc/passthrough.py
94
95      - name: Upload eliot.log
96        uses: actions/upload-artifact@v4
97        with:
98          name: "eliot-${{ matrix.os }}-python-${{ matrix.python-version }}.log"
99          path: eliot.log
100
101      - name: Upload trial log
102        uses: actions/upload-artifact@v4
103        with:
104          name: "test-${{ matrix.os }}-python-${{ matrix.python-version }}.log"
105          path: _trial_temp/test.log
106
107      # Upload this job's coverage data to Coveralls.  While there is a GitHub
108      # Action for this, as of Jan 2021 it does not support Python coverage
109      # files - only lcov files.  Therefore, we use coveralls-python, the
110      # coveralls.io-supplied Python reporter, for this.
111      - name: "Report Coverage to Coveralls"
112        run: |
113          pip3 install --upgrade coveralls==3.0.1
114          python3 -m coveralls
115        env:
116          # Some magic value required for some magic reason.
117          GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
118          # Help coveralls identify our project.
119          COVERALLS_REPO_TOKEN: "JPf16rLB7T2yjgATIxFzTsEgMdN1UNq6o"
120          # Every source of coverage reports needs a unique "flag name".
121          # Construct one by smashing a few variables from the matrix together
122          # here.
123          COVERALLS_FLAG_NAME: "run-${{ matrix.os }}-${{ matrix.python-version }}"
124          # Mark the data as just one piece of many because we have more than
125          # one instance of this job (Windows, macOS) which collects and
126          # reports coverage.  This is necessary to cause Coveralls to merge
127          # multiple coverage results into a single report.  Note the merge
128          # only happens when we "finish" a particular build, as identified by
129          # its "build_num" (aka "service_number").
130          COVERALLS_PARALLEL: true
131
132  # Tell Coveralls that we're done reporting coverage data.  Since we're using
133  # the "parallel" mode where more than one coverage data file is merged into
134  # a single report, we have to tell Coveralls when we've uploaded all of the
135  # data files.  This does it.  We make sure it runs last by making it depend
136  # on *all* of the coverage-collecting jobs.
137  #
138  # See notes about parallel builds on GitHub Actions at
139  # https://coveralls-python.readthedocs.io/en/latest/usage/configuration.html
140  finish-coverage-report:
141    needs:
142      - "coverage"
143    runs-on: "ubuntu-22.04"
144    container: "python:3-slim"
145    steps:
146      - name: "Indicate completion to coveralls.io"
147        run: |
148          pip3 install --upgrade coveralls==3.0.1
149          python3 -m coveralls --finish
150        env:
151          # Some magic value required for some magic reason.
152          GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
153
154  integration:
155    runs-on: ${{ matrix.os }}
156    strategy:
157      fail-fast: false
158      matrix:
159        os:
160          # 22.04 has some issue with Tor at the moment:
161          # https://tahoe-lafs.org/trac/tahoe-lafs/ticket/3943
162          - ubuntu-20.04
163          - macos-14
164          - windows-2022
165        python-version:
166          - "3.11"
167        force-foolscap:
168          - false
169        include:
170          - os: ubuntu-20.04
171            python-version: "3.12"
172            force-foolscap: true
173    steps:
174
175      - name: Install Tor [Ubuntu]
176        if: ${{ contains(matrix.os, 'ubuntu') }}
177        run: sudo apt install tor
178
179      # TODO: See https://tahoe-lafs.org/trac/tahoe-lafs/ticket/3744.
180      # We have to use an older version of Tor for running integration
181      # tests on macOS.
182      - name: Install Tor [macOS, ${{ matrix.python-version }} ]
183        if: ${{ contains(matrix.os, 'macos') }}
184        run: |
185          brew install tor
186
187      - name: Install Tor [Windows]
188        if: matrix.os == 'windows-2022'
189        uses: crazy-max/ghaction-chocolatey@v2
190        with:
191          args: install tor
192
193      - name: Check out Tahoe-LAFS sources
194        uses: actions/checkout@v3
195        with:
196          fetch-depth: 0
197
198      - name: Set up Python ${{ matrix.python-version }}
199        uses: actions/setup-python@v4
200        with:
201          python-version: ${{ matrix.python-version }}
202          cache: 'pip'  # caching pip dependencies
203
204      - name: Install Python packages
205        run: |
206          pip install --upgrade tox
207          pip list
208
209      - name: Display tool versions
210        run: python misc/build_helpers/show-tool-versions.py
211
212      - name: Run "Python 3 integration tests"
213        if: "${{ !matrix.force-foolscap }}"
214        env:
215          # On macOS this is necessary to ensure unix socket paths for tor
216          # aren't too long. On Windows tox won't pass it through so it has no
217          # effect. On Linux it doesn't make a difference one way or another.
218          TMPDIR: "/tmp"
219        run: |
220          tox -e integration
221
222      - name: Run "Python 3 integration tests (force Foolscap)"
223        if: "${{ matrix.force-foolscap }}"
224        env:
225          # On macOS this is necessary to ensure unix socket paths for tor
226          # aren't too long. On Windows tox won't pass it through so it has no
227          # effect. On Linux it doesn't make a difference one way or another.
228          TMPDIR: "/tmp"
229        run: |
230          tox -e integration -- --force-foolscap integration/
231
232      - name: Upload eliot.log in case of failure
233        uses: actions/upload-artifact@v4
234        if: failure()
235        with:
236          name: "integration.eliot-${{ matrix.os }}-python-${{ matrix.python-version }}.json"
237          path: integration.eliot.json
238
239  packaging:
240    runs-on: ${{ matrix.os }}
241    strategy:
242      fail-fast: false
243      matrix:
244        os:
245          - macos-14
246          - windows-2022
247          - ubuntu-22.04
248        python-version:
249          - 3.9
250
251    steps:
252
253      - name: Check out Tahoe-LAFS sources
254        uses: actions/checkout@v3
255        with:
256          fetch-depth: 0
257
258      - name: Set up Python ${{ matrix.python-version }}
259        uses: actions/setup-python@v4
260        with:
261          python-version: ${{ matrix.python-version }}
262          cache: 'pip' # caching pip dependencies
263
264      - name: Install Python packages
265        run: |
266          pip install --upgrade tox
267          pip list
268
269      - name: Display tool versions
270        run: python misc/build_helpers/show-tool-versions.py
271
272      - name: Run "tox -e pyinstaller"
273        run: tox -e pyinstaller
274
275      # This step is to ensure there are no packaging/import errors.
276      - name: Test PyInstaller executable
277        run: dist/Tahoe-LAFS/tahoe --version
278
279      - name: Upload PyInstaller package
280        uses: actions/upload-artifact@v4
281        with:
282          name: Tahoe-LAFS-${{ matrix.os }}-Python-${{ matrix.python-version }}
283          path: dist/Tahoe-LAFS-*-*.*
Note: See TracBrowser for help on using the repository browser.