-
-
Notifications
You must be signed in to change notification settings - Fork 89
166 lines (162 loc) · 7.22 KB
/
main.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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
name: openmptcprouter
on: [push]
env:
REPO_URL: 'https://github.com/ysurac/openmptcprouter'
jobs:
build:
strategy:
matrix:
OMR_TARGET: [bpi-r1, bpi-r2, bpi-r64, rpi2, rpi4, wrt32x, espressobin, r2s, rpi3, wrt3200acm, x86, x86_64, ubnt-erx, r4s, r7800, rutx12, rutx50, r5s, qnap-301w, rpi5, z8102ax_128m, z8102ax_64m]
OMR_KERNEL: [5.4, 6.6]
runs-on: ubuntu-latest
continue-on-error: true
steps:
- name: Branch name
id: branch_name
run: |
echo "SOURCE_NAME=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT
echo "SOURCE_BRANCH=${GITHUB_REF#refs/heads/}" >> $GITHUB_OUTPUT
echo "SOURCE_TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
echo "WORKSPACE=${GITHUB_WORKSPACE}" >> $GITHUB_OUTPUT
- name: Prepare
run: |
sudo apt-get update
sudo apt-get install build-essential asciidoc binutils bzip2 gawk gettext git libncurses5-dev libz-dev patch unzip zlib1g-dev lib32gcc-s1 libc6-dev-i386 subversion flex uglifyjs git-core gcc-multilib p7zip p7zip-full msmtp libssl-dev texinfo libglib2.0-dev xmlto qemu-utils upx libelf-dev autoconf automake libtool autopoint device-tree-compiler python3-pyelftools llvm clang
- if: matrix.OMR_KERNEL == '6.6'
name: Install LLVM
run: |
sudo apt-get install llvm clang
- name: Free disk space
run: |
df -h
sudo swapoff -a >/dev/null 2>&1 || true
sudo rm -f /swapfile >/dev/null 2>&1 || true
sudo apt-get autoremove -y >/dev/null 2>&1 || true
sudo apt-get autoclean -y >/dev/null 2>&1 || true
sudo rm -rf "/usr/local/share/boost" >/dev/null 2>&1 || true
sudo rm -rf "$AGENT_TOOLSDIRECTORY" >/dev/null 2>&1 || true
sudo rm -rf /usr/share/dotnet >/dev/null 2>&1 || true
sudo rm -rf /usr/local/lib/android >/dev/null 2>&1 || true
sudo rm -rf /opt/ghc >/dev/null 2>&1 || true
sudo docker rmi $(docker images -qf "dangling=true") >/dev/null 2>&1 || true
df -h
- name: Clone source code
working-directory: ../../
env:
REPO_URL: https://github.com/ysurac/openmptcprouter
SOURCE_NAME: ${{ steps.branch_name.outputs.SOURCE_NAME }}
GITHUB_WORKSPACE: ${{ steps.branch_name.outputs.WORKSPACE }}
run: |
git clone $REPO_URL omr
if [ "$SOURCE_NAME" != "develop" ]; then
cd omr
pwd
git fetch
git checkout master
else
cd omr
git checkout develop
fi
git pull
pwd
- name: Build toolchain
working-directory: ../../omr
env:
OMR_FEED_URL: https://github.com/ysurac/openmptcprouter-feeds
SOURCE_NAME: ${{ steps.branch_name.outputs.SOURCE_NAME }}
OMR_TARGET: ${{ matrix.OMR_TARGET }}
OMR_KERNEL: ${{ matrix.OMR_KERNEL }}
OMR_HOST: ${{ secrets.OMR_HOST }}
OMR_PORT: ${{ secrets.OMR_PORT }}
run: |
OMR_KERNEL="${OMR_KERNEL}" OMR_FEED_SRC="${SOURCE_NAME}" sh build.sh prepare {tools,toolchain}/install -j$(nproc) || OMR_KERNEL="${OMR_KERNEL}" OMR_FEED_SRC="${SOURCE_NAME}" sh build.sh prepare {tools,toolchain}/install -j1 V=s
#echo -e "${{ secrets.OMR_PRIVKEY }}" > $OMR_TARGET/$OMR_KERNEL/source/key-build
#echo -e "${{ secrets.OMR_PUBKEY }}" > $OMR_TARGET/$OMR_KERNEL/source/key-build.pub
- name: Build packages
working-directory: ../../omr
env:
OMR_TARGET: ${{ matrix.OMR_TARGET }}
OMR_KERNEL: ${{ matrix.OMR_KERNEL }}
run: |
make IGNORE_ERRORS=m -C $OMR_TARGET/$OMR_KERNEL/source package/{compile,install,index} -j$(nproc) || make IGNORE_ERRORS=m -C $OMR_TARGET/$OMR_KERNEL/source package/{compile,install,index} -j1 V=s
- name: Build image
working-directory: ../../omr
env:
OMR_TARGET: ${{ matrix.OMR_TARGET }}
OMR_KERNEL: ${{ matrix.OMR_KERNEL }}
run: |
make IGNORE_ERRORS=m -C $OMR_TARGET/$OMR_KERNEL/source target/install -j$(nproc) || make IGNORE_ERRORS=m -C $OMR_TARGET/$OMR_KERNEL/source target/install -j1 V=s
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.OMR_TARGET }}
path: /home/runner/work/omr/${{ matrix.OMR_TARGET }}/${{ matrix.OMR_KERNEL }}/source/bin
overwrite: true
- if: steps.branch_name.outputs.SOURCE_BRANCH == ''
name: Deploy - Create directory
uses: ysurac/ssh-action@master
env:
SOURCE_NAME: ${{ steps.branch_name.outputs.SOURCE_NAME }}
SOURCE_BRANCH: ${{ steps.branch_name.outputs.SOURCE_BRANCH }}
SOURCE_TAG: ${{ steps.branch_name.outputs.SOURCE_TAG }}
with:
command: |
mkdir -p deploy/release/${{env.SOURCE_TAG}}/${{matrix.OMR_TARGET}}
host: ${{ secrets.OMR_DEPLOY_HOST }}
user: deploy
port: ${{ secrets.OMR_DEPLOY_PORT }}
key: ${{ secrets.PRIVATE_KEY }}
args: -tt
- if: steps.branch_name.outputs.SOURCE_BRANCH != ''
name: Deploy - Create directory
uses: ysurac/ssh-action@master
env:
SOURCE_NAME: ${{ steps.branch_name.outputs.SOURCE_NAME }}
SOURCE_BRANCH: ${{ steps.branch_name.outputs.SOURCE_BRANCH }}
SOURCE_TAG: ${{ steps.branch_name.outputs.SOURCE_TAG }}
with:
command: |
mkdir -p deploy/${{env.SOURCE_BRANCH}}/${{matrix.OMR_KERNEL}}/${{matrix.OMR_TARGET}}
host: ${{ secrets.OMR_DEPLOY_HOST }}
user: deploy
port: ${{ secrets.OMR_DEPLOY_PORT }}
key: ${{ secrets.PRIVATE_KEY }}
args: -tt
- name: Move binaries for rsync
working-directory: ../../omr
env:
OMR_TARGET: ${{ matrix.OMR_TARGET }}
OMR_KERNEL: ${{ matrix.OMR_KERNEL }}
GITHUB_WORKSPACE: ${{ steps.branch_name.outputs.WORKSPACE }}
run: |
mv ${OMR_TARGET}/${OMR_KERNEL}/source/bin ${GITHUB_WORKSPACE}/
- if: steps.branch_name.outputs.SOURCE_BRANCH == ''
name: Deploy - Upload via rsync
uses: ysurac/action-rsync@master
env:
ARGS: -av --delete-after
TARGET: deploy/release/${{steps.branch_name.outputs.SOURCE_TAG}}/${{matrix.OMR_TARGET}}
SOURCE: ./bin/
KEY: ${{ secrets.PRIVATE_KEY }}
USER: deploy
HOST: ${{ secrets.OMR_DEPLOY_HOST }}
PORT: ${{ secrets.OMR_DEPLOY_PORT }}
SOURCE_NAME: ${{ steps.branch_name.outputs.SOURCE_NAME }}
SOURCE_BRANCH: ${{ steps.branch_name.outputs.SOURCE_BRANCH }}
SOURCE_TAG: ${{ steps.branch_name.outputs.SOURCE_TAG }}
GITHUB_WORKSPACE: ${{ steps.branch_name.outputs.WORKSPACE }}
- if: steps.branch_name.outputs.SOURCE_BRANCH != ''
name: Deploy - Upload via rsync
uses: ysurac/action-rsync@master
env:
ARGS: -av --delete-after
TARGET: deploy/${{ steps.branch_name.outputs.SOURCE_BRANCH }}/${{matrix.OMR_KERNEL}}/${{matrix.OMR_TARGET}}
SOURCE: ./bin/
KEY: ${{ secrets.PRIVATE_KEY }}
USER: deploy
HOST: ${{ secrets.OMR_DEPLOY_HOST }}
PORT: ${{ secrets.OMR_DEPLOY_PORT }}
SOURCE_NAME: ${{ steps.branch_name.outputs.SOURCE_NAME }}
SOURCE_BRANCH: ${{ steps.branch_name.outputs.SOURCE_BRANCH }}
SOURCE_TAG: ${{ steps.branch_name.outputs.SOURCE_TAG }}
GITHUB_WORKSPACE: ${{ steps.branch_name.outputs.WORKSPACE }}