mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2024-12-22 14:22:25 +00:00
318 lines
10 KiB
YAML
318 lines
10 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- "master"
|
|
pull_request:
|
|
|
|
env:
|
|
# Tell Hypothesis which configuration we want it to use.
|
|
TAHOE_LAFS_HYPOTHESIS_PROFILE: "ci"
|
|
|
|
jobs:
|
|
|
|
coverage:
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
os:
|
|
- macos-latest
|
|
- ubuntu-latest
|
|
python-version:
|
|
- 2.7
|
|
- 3.6
|
|
- 3.7
|
|
- 3.8
|
|
- 3.9
|
|
include:
|
|
# For now we're only doing Windows on 2.7, will be fixed in
|
|
# https://tahoe-lafs.org/trac/tahoe-lafs/ticket/3701
|
|
- os: windows-latest
|
|
python-version: 2.7
|
|
|
|
steps:
|
|
|
|
# See https://github.com/actions/checkout. A fetch-depth of 0
|
|
# fetches all tags and branches.
|
|
- name: Check out Tahoe-LAFS sources
|
|
uses: actions/checkout@v2
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Set up Python ${{ matrix.python-version }}
|
|
if: ${{ matrix.os != 'windows-latest' }}
|
|
uses: actions/setup-python@v2
|
|
with:
|
|
python-version: ${{ matrix.python-version }}
|
|
|
|
# See note below about need for using 32-bit Python 2.7 on
|
|
# Windows.
|
|
- name: Set up Python ${{ matrix.python-version }} [Windows x64]
|
|
if: ${{ ( matrix.os == 'windows-latest' ) && ( matrix.python-version != '2.7' ) }}
|
|
uses: actions/setup-python@v2
|
|
with:
|
|
python-version: ${{ matrix.python-version }}
|
|
architecture: 'x64'
|
|
|
|
# We use netifaces, which does not ship a 64-bit wheel for the
|
|
# Python 2.7 + Windows combination, but it ships a 32-bit wheel.
|
|
# Since MS has removed vcpython27 compiler downloads from their
|
|
# usual download site, building a netifaces wheel locally is not
|
|
# an option anymore. So let us just test with 32-bit Python on
|
|
# Windows.
|
|
- name: Set up Python ${{ matrix.python-version }} [Windows x86]
|
|
if: ${{ ( matrix.os == 'windows-latest' ) && ( matrix.python-version == '2.7' ) }}
|
|
uses: actions/setup-python@v1
|
|
with:
|
|
python-version: ${{ matrix.python-version }}
|
|
architecture: 'x86'
|
|
|
|
# To use pip caching with GitHub Actions in an OS-independent
|
|
# manner, we need `pip cache dir` command, which became
|
|
# available since pip v20.1+. At the time of writing this,
|
|
# GitHub Actions offers pip v20.3.3 for both ubuntu-latest and
|
|
# windows-latest, and pip v20.3.1 for macos-latest.
|
|
- name: Get pip cache directory
|
|
id: pip-cache
|
|
run: |
|
|
echo "::set-output name=dir::$(pip cache dir)"
|
|
|
|
# See https://github.com/actions/cache
|
|
- name: Use pip cache
|
|
uses: actions/cache@v2
|
|
with:
|
|
path: ${{ steps.pip-cache.outputs.dir }}
|
|
key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-pip-
|
|
|
|
- name: Install Python packages
|
|
run: |
|
|
pip install --upgrade codecov tox 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
|
|
run: python -m tox
|
|
|
|
- name: Upload eliot.log in case of failure
|
|
uses: actions/upload-artifact@v1
|
|
if: failure()
|
|
with:
|
|
name: eliot.log
|
|
path: eliot.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.
|
|
#
|
|
# It is coveralls-python 1.x that has maintained compatibility
|
|
# with Python 2, while coveralls-python 3.x is compatible with
|
|
# Python 3. Sadly we can't use them both in the same workflow.
|
|
#
|
|
# The two versions of coveralls-python are somewhat mutually
|
|
# incompatible. Mixing these two different versions when
|
|
# reporting coverage to coveralls.io will lead to grief, since
|
|
# they get job IDs in different fashion. If we use both
|
|
# versions of coveralls in the same workflow, the finalizing
|
|
# step will be able to mark only part of the jobs as done, and
|
|
# the other part will be left hanging, never marked as done: it
|
|
# does not matter if we make an API call or `coveralls --finish`
|
|
# to indicate that CI has finished running.
|
|
#
|
|
# So we try to use the newer coveralls-python that is available
|
|
# via Python 3 (which is present in GitHub Actions tool cache,
|
|
# even when we're running Python 2.7 tests) throughout this
|
|
# workflow.
|
|
- name: "Report Coverage to Coveralls"
|
|
run: |
|
|
pip3 install --upgrade coveralls==3.0.1
|
|
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"
|
|
# 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 }}"
|
|
# 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
|
|
|
|
# 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
|
|
finish-coverage-report:
|
|
needs:
|
|
- "coverage"
|
|
runs-on: "ubuntu-latest"
|
|
container: "python:3-slim"
|
|
steps:
|
|
- name: "Indicate completion to coveralls.io"
|
|
run: |
|
|
pip3 install --upgrade coveralls==3.0.1
|
|
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:
|
|
os:
|
|
- macos-latest
|
|
- windows-latest
|
|
python-version:
|
|
- 2.7
|
|
|
|
steps:
|
|
|
|
- name: Install Tor [Ubuntu]
|
|
if: matrix.os == 'ubuntu-latest'
|
|
run: sudo apt install tor
|
|
|
|
- name: Install Tor [macOS]
|
|
if: matrix.os == 'macos-latest'
|
|
run: brew install tor
|
|
|
|
- name: Install Tor [Windows]
|
|
if: matrix.os == 'windows-latest'
|
|
uses: crazy-max/ghaction-chocolatey@v1
|
|
with:
|
|
args: install tor
|
|
|
|
- name: Check out Tahoe-LAFS sources
|
|
uses: actions/checkout@v2
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Set up Python ${{ matrix.python-version }}
|
|
if: ${{ matrix.os != 'windows-latest' }}
|
|
uses: actions/setup-python@v1
|
|
with:
|
|
python-version: ${{ matrix.python-version }}
|
|
|
|
# See this step under coverage job.
|
|
- name: Set up Python ${{ matrix.python-version }} [Windows x86]
|
|
if: ${{ matrix.os == 'windows-latest' }}
|
|
uses: actions/setup-python@v1
|
|
with:
|
|
python-version: ${{ matrix.python-version }}
|
|
architecture: 'x86'
|
|
|
|
- name: Get pip cache directory
|
|
id: pip-cache
|
|
run: |
|
|
echo "::set-output name=dir::$(pip cache dir)"
|
|
|
|
- name: Use pip cache
|
|
uses: actions/cache@v2
|
|
with:
|
|
path: ${{ steps.pip-cache.outputs.dir }}
|
|
key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-pip-
|
|
|
|
- name: Install Python packages
|
|
run: |
|
|
pip install --upgrade tox
|
|
pip list
|
|
|
|
- name: Display tool versions
|
|
run: python misc/build_helpers/show-tool-versions.py
|
|
|
|
- name: Run "tox -e integration"
|
|
run: tox -e integration
|
|
|
|
- name: Upload eliot.log in case of failure
|
|
uses: actions/upload-artifact@v1
|
|
if: failure()
|
|
with:
|
|
name: integration.eliot.json
|
|
path: integration.eliot.json
|
|
|
|
packaging:
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
os:
|
|
- macos-latest
|
|
- windows-latest
|
|
- ubuntu-latest
|
|
python-version:
|
|
- 2.7
|
|
|
|
steps:
|
|
|
|
- name: Check out Tahoe-LAFS sources
|
|
uses: actions/checkout@v2
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Set up Python ${{ matrix.python-version }}
|
|
if: ${{ matrix.os != 'windows-latest' }}
|
|
uses: actions/setup-python@v1
|
|
with:
|
|
python-version: ${{ matrix.python-version }}
|
|
|
|
# See this step under coverage job.
|
|
- name: Set up Python ${{ matrix.python-version }} [Windows x86]
|
|
if: ${{ matrix.os == 'windows-latest' }}
|
|
uses: actions/setup-python@v1
|
|
with:
|
|
python-version: ${{ matrix.python-version }}
|
|
architecture: 'x86'
|
|
|
|
- name: Get pip cache directory
|
|
id: pip-cache
|
|
run: |
|
|
echo "::set-output name=dir::$(pip cache dir)"
|
|
|
|
- name: Use pip cache
|
|
uses: actions/cache@v2
|
|
with:
|
|
path: ${{ steps.pip-cache.outputs.dir }}
|
|
key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-pip-
|
|
|
|
- name: Install Python packages
|
|
run: |
|
|
pip install --upgrade tox
|
|
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@v2
|
|
with:
|
|
name: Tahoe-LAFS-${{ matrix.os }}-Python-${{ matrix.python-version }}
|
|
path: dist/Tahoe-LAFS-*-*.*
|