-
Notifications
You must be signed in to change notification settings - Fork 6
154 lines (151 loc) · 6.05 KB
/
ci.yml
File metadata and controls
154 lines (151 loc) · 6.05 KB
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: CI
on:
push:
branches: [ master, develop ]
pull_request:
branches: [ master, develop ]
schedule:
- cron: '0 0 1 1 *'
jobs:
test:
# Skip CI if [ci skip] in the commit message
if: "! contains(toJSON(github.event.commits.*.message), '[ci skip]')"
strategy:
fail-fast: true
matrix:
os: [ "ubuntu-20.04" ]
# python-version: [ "3.6.2", "3.7", "3.8", "3.9" ]
python-version: [ "3.8" ]
runs-on: self-hosted
timeout-minutes: 40
steps:
#----------------------------------------------
# check-out repo and set-up python
#----------------------------------------------
- name: Check out repository
uses: actions/checkout@v2
- name: Set up python ${{ matrix.python-version }}
id: setup-python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
#----------------------------------------------
# ----- install & configure poetry -----
#----------------------------------------------
- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: 1.3.2
virtualenvs-create: true
virtualenvs-in-project: true
#----------------------------------------------
# load cached venv if cache exists
#----------------------------------------------
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v3
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
#----------------------------------------------
# install dependencies if cache does not exist
#----------------------------------------------
- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --no-interaction --no-root
#----------------------------------------------
# install your root project, if required
#----------------------------------------------
- name: Install library
run: poetry install --no-interaction
#----------------------------------------------
# check codestyle & lint
#----------------------------------------------
- name: Check codestyle
run: |
make check-codestyle
- name: Lint with flake8
run: |
make lint
#----------------------------------------------
# ----- install & configure ROS -----
#----------------------------------------------
- name: install ROS
run: |
sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
sudo apt install -y curl # if you haven't already installed curl
curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | sudo apt-key add -
sudo apt update
sudo apt install -y ros-noetic-ros-base
echo "source /opt/ros/noetic/setup.bash" >> .venv/bin/activate
sudo apt-get install -y ros-noetic-cv-bridge
sudo apt-get install -y freeglut3-dev
#----------------------------------------------
# Build docs
#----------------------------------------------
- name: Build the doc
run: |
sudo apt-get install -y python3-sphinx
source .venv/bin/activate
make doc
#----------------------------------------------
# add matrix specifics and run test suite
#----------------------------------------------
- name: Run tests
run: |
source .venv/bin/activate
make pytest
#----------------------------------------------
# Save code coverage
#----------------------------------------------
- uses: actions/upload-artifact@v4
with:
name: 'coverage'
path: coverage.xml
release:
needs: test
# https://github.community/t/how-do-i-specify-job-dependency-running-in-another-workflow/16482
if: github.event_name == 'push' && github.ref == 'refs/heads/master' && !contains(github.event.head_commit.message, 'chore(release):')
runs-on: self-hosted
steps:
#----------------------------------------------
# check-out repo and set-up python
#----------------------------------------------
- uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0
token: ${{ secrets.GH_TOKEN }}
#-----------------------------------------------
# Publish to PYPI in case of a new version
#-----------------------------------------------
- name: Semantic Release
run: |
pip install python-semantic-release==7.34.6
git config --global user.name "github-actions"
git config --global user.email "action@github.com"
semantic-release publish -D commit_author="github-actions <action@github.com>"
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPOSITORY_USERNAME: ${{ secrets.PYPI_USERNAME }}
REPOSITORY_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
# #----------------------------------------------
# # Download coverage and publish to CodeClimate
# #----------------------------------------------
# - name: Download artifacts
# uses: actions/download-artifact@v4
# with:
# name: 'coverage'
# path: .
# - name: Publish code coverage to CodeClimate
# uses: paambaati/codeclimate-action@v2.7.5
# env:
# CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
# with:
# debug: true