blob: e9f35c9d93846a2ae50a53009960ff25da0509c2 [file] [log] [blame]
name: PR Checks
# Run the CI if branches are pushed locally, allowing us to
# run CI without the need of creating a pull request.
#
# Run the CI on pull requests only if they are from forked
# repositories.
#
on:
push:
branches-ignore:
- gh-pages
- master
pull_request:
types: [assigned, opened, synchronize, reopened]
branches:
# Branches from forks have the form 'user:branch-name' so we only run
# this job on pull_request events for branches that look like fork
# branches. Without this we would end up running this job twice for non
# forked PRs, once for the push and then once for opening the PR.
- '**:**'
# Left to-do:
# - coverage
# - publishing docs to gh-pages
# - persistent artifact cache
# - overnight jobs
# - other one-off jobs like missing-deps, plugin jobs etc
# - wsl tasks (TODO: Check if GitHub's Windows runners allow WSL)
#
# New opportunities:
# - run tests on mac (GitHub provides MacOS runners)
# - standardize WSL tasks by using GitHub-provided runners
env:
CI_IMAGE: registry.gitlab.com/buildstream/buildstream-docker-images/testsuite-fedora:32-master-177137613
PYTEST_ARGS: --color=yes --integration
jobs:
tests:
runs-on: ubuntu-20.04
continue-on-error: ${{ matrix.allow-failure || false }}
env:
CI_IMAGE_PREFIX: registry.gitlab.com/buildstream/buildstream-docker-images/testsuite
CI_IMAGE_SUFFIX: master-177137613
TOXENV: py36,py37,py38-nocover,py36-plugins,py37-plugins,py38-plugins-nocover
# FIXME: De-duplicate against tox.ini
BST_PLUGINS_EXPERIMENTAL_VERSION: 1.93.4
strategy:
fail-fast: false
matrix:
# Main test targets, the name defines the image that will be used as
# the base for running tests.
test-name:
- debian:10
- fedora:31
- fedora:32
- ubuntu:18.04
- centos:7.7.1908
include:
# Ensure that tests also pass without `--develop` flag.
- test-name: no-usedevelop
image-name: fedora:32
toxenv: py36-nocover,py37-nocover,py38-nocover
# Test the master version of some external plugins
- test-name: plugins-master
image-name: fedora:32
bst-plugins-experimental-version: master
allow-failure: true
steps:
- name: Check out repository
uses: actions/checkout@v2
# BuildStream requires tags to be able to find its version.
with:
fetch-depth: 0
# XXX: Our run command looks like a monstrosity because we need to
# specify `--device /dev/fuse` and there's no way to do that using the
# `container` directive directly.
# This is also why we have forward environment variables by hand.
# TODO: In future, we should find a way to simplify this. See some
# relevant discussion at:
# https://github.community/t/how-to-run-privileged-docker-container/16431.
# XXX: Value of `volume` and `workdir` must match how GitHub
# Actions sets up paths.
# TODO: Have test user pre-created in the test image.
- name: Run tox inside a container
run: |
cat << EOF > runtox.sh
#!/bin/bash
# Create user
useradd -Um buildstream
chown -R buildstream:buildstream .
# Diagnostics
echo "Running diagnostics checks"
mount
df -h
tox --version
# Run tox as user, ensure we have a login shell
echo "Running tests"
su buildstream -c '/bin/bash --login -c "tox -vvvvv -- $PYTEST_ARGS"'
EOF
chmod +x runtox.sh
docker run \
--privileged \
--device /dev/fuse \
--env PYTEST_ARGS \
--env TOXENV=${{ matrix.toxenv || env.TOXENV }} \
--env BST_PLUGINS_EXPERIMENTAL_VERSION=${{ matrix.bst-plugins-experimental-version || env.BST_PLUGINS_EXPERIMENTAL_VERSION }} \
--volume /home/runner/work:/__w \
--workdir /__w/buildstream/buildstream \
"$CI_IMAGE_PREFIX"-${{ matrix.image-name || matrix.test-name }}-"$CI_IMAGE_SUFFIX" \
./runtox.sh
tests-fedora-missing-deps:
runs-on: ubuntu-20.04
container: registry.gitlab.com/buildstream/buildstream-docker-images/testsuite-fedora:32-master-177137613
steps:
- name: Check out repository
uses: actions/checkout@v2
# BuildStream requires tags to be able to find its version.
with:
fetch-depth: 0
- name: Uninstall Bubblewrap and OSTree
# We remove the Bubblewrap and OSTree packages here so that we catch any
# codepaths that try to use them. Removing OSTree causes fuse-libs to
# disappear unless we mark it as user-installed.
run: |
dnf mark install fuse-libs systemd-udev
dnf erase -y bubblewrap ostree
- name: Add test user
run: |
useradd -Um buildstream
chown -R buildstream:buildstream .
- name: Run tests
run: su buildstream -c "tox -- $PYTEST_ARGS"
mypy:
runs-on: ubuntu-20.04
container: registry.gitlab.com/buildstream/buildstream-docker-images/testsuite-fedora:32-master-177137613
steps:
- name: Check out repository
uses: actions/checkout@v2
# BuildStream requires tags to be able to find its version.
with:
fetch-depth: 0
- name: Run tox inside a container
run: tox -e mypy
lint:
runs-on: ubuntu-20.04
container: registry.gitlab.com/buildstream/buildstream-docker-images/testsuite-fedora:32-master-177137613
steps:
- name: Check out repository
uses: actions/checkout@v2
# BuildStream requires tags to be able to find its version.
with:
fetch-depth: 0
- name: Run tox inside a container
run: tox -e format-check,lint
docs:
runs-on: ubuntu-20.04
env:
BST_FORCE_SESSION_REBUILD: 1
steps:
- name: Check out repository
uses: actions/checkout@v2
# BuildStream requires tags to be able to find its version.
with:
fetch-depth: 0
- name: Run tox inside a container
run: |
docker run \
--privileged \
--device /dev/fuse \
--env BST_FORCE_SESSION_REBUILD \
--volume /home/runner/work:/__w \
--workdir /__w/buildstream/buildstream \
$CI_IMAGE \
tox -e docs
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: docs
path: doc/build/html