forked from epfl-lasa/control-libraries
-
Notifications
You must be signed in to change notification settings - Fork 0
115 lines (106 loc) · 3.79 KB
/
build-test.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
112
113
114
115
name: Build and Test
# Run workflow on pushes to main and develop branches, on any pull request, or by manual dispatch
on:
push:
branches:
- main
- develop
pull_request:
workflow_dispatch:
# Define the build test jobs for each configuration
jobs:
check-contribution:
name: Check if changelog and version have been updated
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Check contributions
if: ${{ github.event.pull_request.base.sha }}
run: |
git config user.name github-actions[bot]
git config user.email github-actions[bot]@users.noreply.github.com
git fetch origin main ${{ github.event.pull_request.base.sha }} ${{ github.head_ref }}
git checkout ${{ github.head_ref }}
VER_DIFF=$(git diff ${{ github.event.pull_request.base.sha }} ${{ github.sha }} -- ./VERSION)
if ! [ "${VER_DIFF}" ]; then
bash update_version.sh --commit && git push
fi
CL_DIFF=$(git diff ${{ github.event.pull_request.base.sha }} ${{ github.sha }} -- ./CHANGELOG.md)
if ! [ "${CL_DIFF}" ]; then
SEARCH_STRING="## Upcoming changes (in development)"
NEW_TITLE="${{ github.event.pull_request.title }} (#${{ github.event.pull_request.number }})"
sed -z "s/${SEARCH_STRING}\n/${SEARCH_STRING}\n\n- ${NEW_TITLE}/" -i CHANGELOG.md
git add CHANGELOG.md && git commit -m "Update CHANGELOG" && git push
fi
shell: bash
# check if jobs can be skipped
check-skippable-changes:
name: Check skippable changes
runs-on: ubuntu-latest
outputs:
skip: ${{ steps.check_if_skippable.outputs.should_skip }}
steps:
- id: check_if_skippable
uses: fkirc/skip-duplicate-actions@master
with:
cancel_others: 'true'
do_not_skip: '["workflow_dispatch"]'
paths_ignore: '["**.md"]'
skip_after_successful_duplicate: 'true'
build-test-debug:
needs: check-skippable-changes
if: ${{ needs.check-skippable-changes.outputs.skip != 'true' }}
runs-on: ubuntu-latest
name: Debug configuration test
steps:
# First check out the repository
- name: Checkout
uses: actions/checkout@v3
# Load the repository build-test action
- name: Build and Test
uses: ./.github/actions/build-test
with:
configuration: Debug
build-test-release:
needs: check-skippable-changes
if: ${{ needs.check-skippable-changes.outputs.skip != 'true' }}
runs-on: ubuntu-latest
name: Release configuration test
steps:
# First check out the repository
- name: Checkout
uses: actions/checkout@v3
# Load the repository build-test action
- name: Build and Test
uses: ./.github/actions/build-test
with:
configuration: Release
build-test-python:
needs:
- check-skippable-changes
- build-test-release
if: ${{ needs.check-skippable-changes.outputs.skip != 'true' }}
runs-on: ubuntu-latest
name: Python bindings test
steps:
# First check out the repository
- name: Checkout
uses: actions/checkout@v3
# Load the repository build-test-python action
- name: Build and Test Python
uses: ./.github/actions/build-test-python
build-test-protocol:
needs:
- check-skippable-changes
- build-test-release
if: ${{ needs.check-skippable-changes.outputs.skip != 'true' }}
runs-on: ubuntu-latest
name: Protocol library test
steps:
# First check out the repository
- name: Checkout
uses: actions/checkout@v3
# Load the repository build-test-python action
- name: Build and Test Protocol
uses: ./.github/actions/build-test-protocol