-
-
Notifications
You must be signed in to change notification settings - Fork 115
114 lines (99 loc) · 3.35 KB
/
build.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
on:
push:
tags:
- '*'
pull_request:
branches:
- '*'
# repository_dispatch is a newer github-actions feature that will allow building from triggers other than code merge/PR
repository_dispatch:
types: [build]
name: Build EmuFlight
jobs:
build:
timeout-minutes: 75
strategy:
max-parallel: 3
matrix:
targets: [targets-group-1, targets-group-2, targets-group-rest]
runs-on: ubuntu-latest
steps:
# curl, by default, may timeout easily
- name: curl fix
run: function curl () { command curl --connect-timeout 30 --retry 10 "$@" ; }
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Take the trash out
run: |
sudo swapoff -a
sudo rm -f /swapfile
sudo apt clean
docker rmi -f $(docker image ls -aq)
sync
df -h
continue-on-error: true
- name: Setup Python
uses: actions/setup-python@v1
- name: Setup Toolchain
uses: fiam/arm-none-eabi-gcc@v1
with:
release: '9-2019-q4' # The arm-none-eabi-gcc release to use.
- name: Get code version
id: get_version
run: echo "::set-output name=VERSION::$(make version)"
# for Makefile interaction
- name: Get GitHub Build Number (ENV)
id: get_buildno
run: echo ::set-env name=GITHUBBUILDNUMBER::${{ github.run_number }}
continue-on-error: true
- name: Get pull request number
id: get_pullno
run: echo ::set-env name=PULL_NUMBER::$(echo "$GITHUB_REF" | awk -F / '{print $3}')
if: startsWith(github.ref, 'refs/pull/')
- name: Get revision tag
id: get_revtag
run: echo "::set-output name=REVISION_TAG::${GITHUB_REF/refs\/tags\//}"
if: startsWith(github.ref, 'refs/tags/')
# for debugging
- name: Show Variables
id: show_vars
run: |
echo "Build: ${{ github.run_number }}"
echo "Firmware ${{ steps.get_version.outputs.VERSION }}"
echo "Commit: ${{ github.sha }}"
echo "tag: ${{ steps.get_revtag.outputs.REVISION_TAG}}"
continue-on-error: true
- name: Compile Code
run: |
make ${{ matrix.targets }}
# Upload the Builds to ZIP file with existing SHA in .hex names
- name: Upload Artifacts
uses: actions/upload-artifact@v2
with:
name: EmuFlight-${{ steps.get_version.outputs.VERSION }}-${{ github.run_number }}
path: obj/*.hex
# Rename .hex for Releases
- name: Rename Artifacts
if: startsWith(github.ref, 'refs/tags/')
run: |
sudo apt -y install rename
cd obj
rename 's/_Build_.*/.hex/' *.hex
- name: Draft Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: obj/*.hex
draft: true
prerelease: true
tag_name: ${{ github.run_number }} # use the build Number, but we manually change to version so that it creates a version-tag on release
name: DRAFT / EmuFlight ${{ steps.get_version.outputs.VERSION }} / GitHub Build ${{ github.run_number }}
body: |
# EmuFlight ${{ steps.get_version.outputs.VERSION }}
## BuildTag: ${{ steps.get_revtag.outputs.REVISION_TAG}}
## Commit: ${{ github.sha }}
## Changes in this Release:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}