-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathaction.yaml
66 lines (62 loc) · 2.19 KB
/
action.yaml
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
---
name: colcon pytest
description: Continuous integration for colcon repositories
runs:
using: composite
steps:
- shell: bash
run: |
echo ::group::Initialize environment
VENV=$(mktemp -d)
python -m venv $VENV
if [ -f $VENV/Scripts/activate ]; then
. $VENV/Scripts/activate
else
. $VENV/bin/activate
fi
python -m pip install -U pip setuptools
echo ::endgroup::
echo ::group::Install package
python -m pip install -U -e .[test] --no-deps
echo ::endgroup::
echo ::group::Install dependencies
# Remove this package from constraints
PKG_NAME=$(pip list -l -e --format json | jq '.[0].name' -r | tr _ -)
cp -a ${GITHUB_ACTION_PATH}/constraints{,-heads,-pins}.txt ./
sed -i.orig "s/^${PKG_NAME}@.*//g" constraints-heads.txt
# Install dependencies, including 'test' extras, as well as pytest-cov
python -m pip install -U -e .[test] pytest-cov -c constraints.txt
echo ::endgroup::
echo ::group::Run tests
python -m pytest \
--cov --cov-branch \
--cov-report xml:coverage.xml \
--cov-config setup.cfg
echo ::endgroup::
echo ::group::Test publish
# Run publish-python without uploading the results
if [ -f publish-python.yaml ]; then
PUBLISH_PYTHON=$(mktemp -d)
pushd $PUBLISH_PYTHON
git clone https://github.com/colcon/publish-python.git .
popd
python -m pip install -U PyYAML wheel
python $PUBLISH_PYTHON/bin/publish-python wheel:pypi
if [ ! -z "${{matrix.stdeb-check}}" ]; then
sudo apt install \
debhelper \
dh-python \
fakeroot \
python3-all \
python3-stdeb \
python3-yaml \
-y
DEB_BUILD_OPTIONS=nocheck /usr/bin/python3 \
$PUBLISH_PYTHON/bin/publish-python stdeb:packagecloud
else
echo "Skipping stdeb test on non-Debian platform..."
fi
else
echo "Repository not configured - Skipping..."
fi
echo ::endgroup::