This repository has been archived by the owner on Jan 10, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
111 lines (94 loc) · 3.21 KB
/
robot-workflow.yml
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
name: Robot Workflow
on:
push:
branches:
- "main"
tags:
- "*"
pull_request:
jobs:
formatblack:
name: Style Check Code with Black
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Check files using the black formatter
uses: rickstaa/action-black@v1
id: action_black
with:
black_args: "."
- name: Annotate diff changes using reviewdog
if: steps.action_black.outputs.is_formatted == 'true'
uses: reviewdog/action-suggester@v1
with:
tool_name: blackfmt
- name: Fail if actions taken
if: steps.action_black.outputs.is_formatted == 'true'
run: exit 1
- name: Discord notification
if: ${{ failure() }}
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
uses: Ilshidur/action-discord@master
with:
args: "Black formatter reported errors in {{ EVENT_PAYLOAD.pull_request.html_url }} !"
run_simulator:
name: Run the WPIlib Simulator
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v3
with:
python-version: "3.11"
- name: Install pipenv
run: |
python -m pip install --upgrade pipenv wheel
- id: cache-pipenv
uses: actions/cache@v3
with:
path: ~/.local/share/virtualenvs
key: ${{ runner.os }}-pipenv-${{ hashFiles('rio/Pipfile.lock') }}
- name: Install dependencies
if: steps.cache-pipenv.outputs.cache-hit != 'true'
run: |
cd rio && pipenv install --deploy --dev
- name: Timeout the simulator
run: |
cd rio && timeout 20 pipenv run python -m robotpy sim --nogui || code=$?; if [[ $code -ne 124 && $code -ne 0 ]]; then exit $code; fi
- name: Discord notification
if: ${{ failure() }}
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
uses: Ilshidur/action-discord@master
with:
args: "<@614313406345904148> Simulator failed in {{ EVENT_PAYLOAD.pull_request.html_url }} !"
unit_test:
name: pyfrc Unit tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: "3.11"
- name: Install pipenv
run: |
python -m pip install --upgrade pipenv wheel
- id: cache-pipenv
uses: actions/cache@v3
with:
path: ~/.local/share/virtualenvs
key: ${{ runner.os }}-pipenv-${{ hashFiles('rio/Pipfile.lock') }}
- name: Install dependencies
if: steps.cache-pipenv.outputs.cache-hit != 'true'
run: |
cd rio && pipenv install --deploy --dev
- name: Run unit tests
run: |
cd rio && pipenv run python -m robotpy test -- -vs || code=$?; if [[ $code -ne 124 && $code -ne 0 ]]; then exit $code; fi
- name: Discord notification
if: ${{ failure() }}
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
uses: Ilshidur/action-discord@master
with:
args: "<@614313406345904148> Unit tests failed in {{ EVENT_PAYLOAD.pull_request.html_url }} !"