-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathenable-macos-windows.sh
executable file
·86 lines (77 loc) · 2.21 KB
/
enable-macos-windows.sh
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
#!/usr/bin/env bash
## Enable the macOS and Windows Builds for NuttX Mirror.
## Disable Fail-Fast, so all builds will complete.
## Remove Max Parallel, so builds can finish faster.
## https://lupyuen.codeberg.page/articles/ci3.html
set -e # Exit when any command fails
set -x # Echo commands
tmp_dir=/tmp/enable-macos-windows
rm -rf $tmp_dir
mkdir $tmp_dir
cd $tmp_dir
git clone ssh://[email protected]/NuttX/nuttx
cd nuttx
## Build on Push to Master Branch
## Change: branches:
## To: branches:\n - master
file=.github/workflows/build.yml
tmp_file=$tmp_dir/build.yml
search='branches:'
replace='branches:\n - master'
cat $file \
| sed "s/$search/$replace/g" \
>$tmp_file
mv $tmp_file $file
## Point to local arch.yml
## Change: uses: apache/nuttx/.github/workflows/arch.yml@master
## To: uses: NuttX/nuttx/.github/workflows/arch.yml@master
search='apache\/nuttx\/.github\/workflows\/arch.yml@master'
replace='NuttX\/nuttx\/.github\/workflows\/arch.yml@master'
cat $file \
| sed "s/$search/$replace/g" \
>$tmp_file
mv $tmp_file $file
## Continue the Linux Builds, regardless of error
## Change: max-parallel: 12
## To: fail-fast: false
## TODO: Linux max-parallel may change
search="max-parallel: 12"
replace="fail-fast: false"
cat $file \
| sed "s/$search/$replace/g" \
>$tmp_file
mv $tmp_file $file
## Continue the macOS Builds, regardless of error
## Change: max-parallel: 2
## To: fail-fast: false
## TODO: macOS max-parallel may change
search="max-parallel: 2"
replace="fail-fast: false"
cat $file \
| sed "s/$search/$replace/g" \
>$tmp_file
mv $tmp_file $file
## Remove "cache: false"
search="cache: false"
replace=""
cat $file \
| sed "s/$search/$replace/g" \
>$tmp_file
mv $tmp_file $file
## Enable the macOS Builds
## Change: if [[ "${{ inputs.os }}" == "macOS" ]]; then
## To: if [[ "${{ inputs.os }}" == "NOTUSED" ]]; then
file=.github/workflows/arch.yml
tmp_file=$tmp_dir/arch.yml
search="== \"macOS\""
replace="== \"NOTUSED\""
cat $file \
| sed "s/$search/$replace/g" \
>$tmp_file
mv $tmp_file $file
## Commit the modified files
git pull
git status
git add .
git commit --all --message="Enable macOS Builds https://github.com/lupyuen/nuttx-release/blob/main/enable-macos-windows.sh"
git push