generated from RIT-EVT/project-template
-
Notifications
You must be signed in to change notification settings - Fork 0
62 lines (54 loc) · 2.2 KB
/
cmake.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
# This file defines a GitHub Workflow which is used to test building EVT-Core and other EVT code.
# When a pull request is made to the main branch, this Workflow will be automatically run on the
# requested changes to ensure the repository still builds successfully and all files fit the team's
# formatting standard. This workflow is designed to work only on a linux server.
name: CMake
# Define the workflow's triggers
on:
pull_request:
branches: [ main ]
push:
branches: [ main ]
# Set necessary environment variables
env:
GCC_ARM_TOOLS_PATH: /usr/bin
jobs:
build:
# Select the server's operating system
runs-on: ubuntu-latest
steps:
# Checkout the repository, including all submodules
- name: Checkout Repository
uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.ref }}
submodules: recursive
# Install the gcc-arm tools and clang-format, and ensure clang-format 12 is being used
- name: Install Compiler and Linter
run: |
sudo apt-get install gcc-arm-none-eabi
sudo apt-get install clang-format-12
sudo update-alternatives --install /usr/bin/clang-format clang-format /usr/bin/clang-format-12 10000
# Build the code for all supported chips
- name: F302 Build
run: |
cmake -DTARGET_DEV=STM32F302x8 -B ${{github.workspace}}/build
cmake --build ${{github.workspace}}/build
# - name: F334 Build
# run: |
# cmake -DTARGET_DEV=STM32F334x8 -B ${{github.workspace}}/build
# cmake --build ${{github.workspace}}/build
# Apply clang-format formatting to the branch and create a new commit if any files are changed
- name: Apply Formatting
run: |
cmake --build ${{github.workspace}}/build --target clang-format
if git diff-files --quiet; then
echo 'No formatting changes'
else
echo 'Formatting changes applied:'
git diff --raw
git config --global user.email "N/A"
git config --global user.name "GitHub Build"
git commit -a -m "Applied Formatting Changes During GitHub Build"
git push origin
fi