tahoe-lafs/.github/workflows/ci.yml

291 lines
9.9 KiB
YAML
Raw Normal View History

name: CI
on:
push:
branches:
- "master"
pull_request:
# At the start of each workflow run, GitHub creates a unique
# GITHUB_TOKEN secret to use in the workflow. It is a good idea for
# this GITHUB_TOKEN to have the minimum of permissions. See:
#
# - https://docs.github.com/en/actions/security-guides/automatic-token-authentication
# - https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#permissions
#
permissions:
contents: read
# Control to what degree jobs in this workflow will run concurrently with
# other instances of themselves.
#
# https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions#concurrency
concurrency:
# We want every revision on master to run the workflow completely.
# "head_ref" is not set for the "push" event but it is set for the
# "pull_request" event. If it is set then it is the name of the branch and
# we can use it to make sure each branch has only one active workflow at a
# time. If it is not set then we can compute a unique string that gives
# every master/push workflow its own group.
group: "${{ github.head_ref || format('{0}-{1}', github.run_number, github.run_attempt) }}"
# Then, we say that if a new workflow wants to start in the same group as a
# running workflow, the running workflow should be cancelled.
cancel-in-progress: true
2021-02-23 14:52:30 +00:00
env:
# Tell Hypothesis which configuration we want it to use.
TAHOE_LAFS_HYPOTHESIS_PROFILE: "ci"
jobs:
2020-02-26 04:02:02 +00:00
coverage:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
2021-05-25 18:12:40 +00:00
- windows-latest
- ubuntu-latest
python-version:
2022-02-23 16:11:04 +00:00
- "3.8"
- "3.9"
- "3.10"
- "3.11"
include:
2023-01-09 16:01:45 +00:00
# On macOS don't bother with 3.8, just to get faster builds.
- os: macos-latest
2022-02-23 16:11:04 +00:00
python-version: "3.9"
2022-02-23 16:07:56 +00:00
- os: macos-latest
python-version: "3.11"
2022-02-23 16:09:49 +00:00
# We only support PyPy on Linux at the moment.
- os: ubuntu-latest
2022-02-23 16:11:04 +00:00
python-version: "pypy-3.8"
2023-01-09 16:01:45 +00:00
- os: ubuntu-latest
python-version: "pypy-3.9"
2022-12-02 06:58:53 +00:00
steps:
# See https://github.com/actions/checkout. A fetch-depth of 0
# fetches all tags and branches.
- name: Check out Tahoe-LAFS sources
2022-11-27 00:37:46 +00:00
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: 'pip' # caching pip dependencies
- name: Install Python packages
run: |
2022-12-12 16:47:32 +00:00
pip install --upgrade codecov "tox<4" tox-gh-actions setuptools
pip list
- name: Display tool versions
run: python misc/build_helpers/show-tool-versions.py
- name: Run tox for corresponding Python version
2023-01-12 14:53:07 +00:00
if: ${{ !contains(matrix.os, 'windows') }}
run: python -m tox
2023-01-12 14:53:07 +00:00
# On Windows, a non-blocking pipe might respond (when emulating Unix-y
# API) with ENOSPC to indicate buffer full. Trial doesn't handle this
2023-01-12 16:12:00 +00:00
# well, so it breaks test runs. To attempt to solve this, we pipe the
2023-01-13 15:29:22 +00:00
# output through passthrough.py that will hopefully be able to do the right
2023-01-12 16:12:00 +00:00
# thing by using Windows APIs.
2023-01-12 14:53:07 +00:00
- name: Run tox for corresponding Python version
if: ${{ contains(matrix.os, 'windows') }}
2023-01-12 15:36:39 +00:00
run: |
2023-01-12 15:39:50 +00:00
pip install twisted pywin32
2023-01-12 15:36:39 +00:00
python -m tox | python misc/windows-enospc/passthrough.py
2023-01-12 14:53:07 +00:00
2021-09-08 13:15:13 +00:00
- name: Upload eliot.log
uses: actions/upload-artifact@v3
with:
name: eliot.log
path: eliot.log
- name: Upload trial log
uses: actions/upload-artifact@v3
with:
2021-09-08 13:42:23 +00:00
name: test.log
path: _trial_temp/test.log
# Upload this job's coverage data to Coveralls. While there is a GitHub
# Action for this, as of Jan 2021 it does not support Python coverage
# files - only lcov files. Therefore, we use coveralls-python, the
# coveralls.io-supplied Python reporter, for this.
2021-01-05 20:57:10 +00:00
- name: "Report Coverage to Coveralls"
run: |
pip3 install --upgrade coveralls==3.0.1
2021-03-31 23:16:58 +00:00
python3 -m coveralls
env:
# Some magic value required for some magic reason.
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
# Help coveralls identify our project.
COVERALLS_REPO_TOKEN: "JPf16rLB7T2yjgATIxFzTsEgMdN1UNq6o"
2021-01-05 20:57:10 +00:00
# Every source of coverage reports needs a unique "flag name".
# Construct one by smashing a few variables from the matrix together
# here.
COVERALLS_FLAG_NAME: "run-${{ matrix.os }}-${{ matrix.python-version }}"
2021-01-05 20:57:10 +00:00
# Mark the data as just one piece of many because we have more than
# one instance of this job (Windows, macOS) which collects and
# reports coverage. This is necessary to cause Coveralls to merge
# multiple coverage results into a single report. Note the merge
# only happens when we "finish" a particular build, as identified by
# its "build_num" (aka "service_number").
COVERALLS_PARALLEL: true
2021-01-05 20:57:10 +00:00
# Tell Coveralls that we're done reporting coverage data. Since we're using
# the "parallel" mode where more than one coverage data file is merged into
# a single report, we have to tell Coveralls when we've uploaded all of the
# data files. This does it. We make sure it runs last by making it depend
# on *all* of the coverage-collecting jobs.
#
# See notes about parallel builds on GitHub Actions at
# https://coveralls-python.readthedocs.io/en/latest/usage/configuration.html
2021-01-05 20:57:10 +00:00
finish-coverage-report:
2021-09-08 13:15:28 +00:00
needs:
- "coverage"
runs-on: "ubuntu-latest"
container: "python:3-slim"
2021-01-05 20:57:10 +00:00
steps:
- name: "Indicate completion to coveralls.io"
run: |
pip3 install --upgrade coveralls==3.0.1
2021-03-31 23:16:58 +00:00
python3 -m coveralls --finish
env:
# Some magic value required for some magic reason.
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
integration:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: macos-latest
python-version: "3.9"
2022-12-12 15:52:01 +00:00
force-foolscap: false
- os: windows-latest
python-version: "3.9"
2022-12-12 15:52:01 +00:00
force-foolscap: false
# 22.04 has some issue with Tor at the moment:
# https://tahoe-lafs.org/trac/tahoe-lafs/ticket/3943
- os: ubuntu-20.04
python-version: "3.11"
2022-12-12 15:52:01 +00:00
force-foolscap: false
steps:
- name: Install Tor [Ubuntu]
2022-11-23 14:43:45 +00:00
if: ${{ contains(matrix.os, 'ubuntu') }}
run: sudo apt install tor
2021-09-08 13:15:28 +00:00
2022-02-15 19:51:55 +00:00
# TODO: See https://tahoe-lafs.org/trac/tahoe-lafs/ticket/3744.
# We have to use an older version of Tor for running integration
# tests on macOS.
2021-07-05 12:37:49 +00:00
- name: Install Tor [macOS, ${{ matrix.python-version }} ]
2021-10-04 15:00:16 +00:00
if: ${{ contains(matrix.os, 'macos') }}
2021-07-05 12:37:49 +00:00
run: |
2022-02-22 16:25:13 +00:00
brew install tor
- name: Install Tor [Windows]
if: matrix.os == 'windows-latest'
uses: crazy-max/ghaction-chocolatey@v2
with:
args: install tor
- name: Check out Tahoe-LAFS sources
2022-11-27 00:37:46 +00:00
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: 'pip' # caching pip dependencies
- name: Install Python packages
run: |
2022-12-12 16:47:32 +00:00
pip install --upgrade "tox<4"
pip list
- name: Display tool versions
run: python misc/build_helpers/show-tool-versions.py
2021-05-13 14:25:48 +00:00
- name: Run "Python 3 integration tests"
2022-12-12 15:52:01 +00:00
if: "${{ !matrix.force-foolscap }}"
2022-02-22 16:40:16 +00:00
env:
# On macOS this is necessary to ensure unix socket paths for tor
# aren't too long. On Windows tox won't pass it through so it has no
# effect. On Linux it doesn't make a difference one way or another.
TMPDIR: "/tmp"
run: |
2022-12-12 15:52:01 +00:00
tox -e integration
2021-05-13 14:25:48 +00:00
2022-12-12 15:52:01 +00:00
- name: Run "Python 3 integration tests (force Foolscap)"
if: "${{ matrix.force-foolscap }}"
env:
# On macOS this is necessary to ensure unix socket paths for tor
# aren't too long. On Windows tox won't pass it through so it has no
# effect. On Linux it doesn't make a difference one way or another.
TMPDIR: "/tmp"
run: |
2022-12-12 16:05:09 +00:00
tox -e integration -- --force-foolscap integration/
2022-12-12 15:52:17 +00:00
- name: Upload eliot.log in case of failure
uses: actions/upload-artifact@v3
if: failure()
with:
name: integration.eliot.json
path: integration.eliot.json
packaging:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
2021-10-04 15:00:16 +00:00
- macos-10.15
- windows-latest
- ubuntu-latest
python-version:
2022-02-14 16:02:25 +00:00
- 3.9
steps:
- name: Check out Tahoe-LAFS sources
2022-11-27 00:37:46 +00:00
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: 'pip' # caching pip dependencies
- name: Install Python packages
run: |
2022-12-12 16:47:32 +00:00
pip install --upgrade "tox<4"
pip list
- name: Display tool versions
run: python misc/build_helpers/show-tool-versions.py
- name: Run "tox -e pyinstaller"
run: tox -e pyinstaller
# This step is to ensure there are no packaging/import errors.
- name: Test PyInstaller executable
run: dist/Tahoe-LAFS/tahoe --version
- name: Upload PyInstaller package
uses: actions/upload-artifact@v3
with:
name: Tahoe-LAFS-${{ matrix.os }}-Python-${{ matrix.python-version }}
path: dist/Tahoe-LAFS-*-*.*