Skip to content

Commit 7318e3b

Browse files
committed
ci: add build pipeline
1 parent 4b58511 commit 7318e3b

File tree

1 file changed

+178
-0
lines changed

1 file changed

+178
-0
lines changed

.github/workflows/build.yml

Lines changed: 178 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,178 @@
1+
# This is a basic workflow to help you get started with Actions
2+
3+
name: CI
4+
5+
# Controls when the action will run.
6+
on:
7+
# Triggers the workflow on push or pull request events but only for the master branch
8+
push:
9+
branches:
10+
- '*-main'
11+
- '*-ci'
12+
- '*-rc'
13+
paths-ignore:
14+
- README*
15+
- .github/workflows/build.yml
16+
# Allows you to run this workflow manually from the Actions tab
17+
workflow_dispatch:
18+
19+
permissions: {} # none
20+
21+
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
22+
jobs:
23+
# This workflow contains a single job called "build"
24+
build:
25+
permissions:
26+
contents: write # for softprops/action-gh-release to create GitHub release
27+
# The type of runner that the job will run on
28+
#runs-on: ubuntu-latest
29+
runs-on: ubuntu-24.04
30+
31+
# Steps represent a sequence of tasks that will be executed as part of the job
32+
steps:
33+
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
34+
- name: Checkout
35+
uses: actions/checkout@v4
36+
with:
37+
fetch-depth: 10
38+
39+
- name: Setup env
40+
run: |
41+
echo "DT=$(date +'%Y-%m-%d_%H%M')" >> $GITHUB_ENV
42+
echo "KERNELVER=$(make kernelversion)" >> $GITHUB_ENV
43+
echo "BRANCH=${GITHUB_REF##*/}" >> $GITHUB_ENV
44+
echo "UBUNTU_MAJOR_VERSION=$(cat /etc/issue | head -1|sed -e 's/^Ubuntu \([0-9]\+\).*$/\1/')" >> $GITHUB_ENV
45+
46+
- name: Print env
47+
run: |
48+
echo $BRANCH $KERNELVER $DT
49+
echo $UBUNTU_MAJOR_VERSION
50+
51+
- name: update apt-repos (u22)
52+
if: env.UBUNTU_MAJOR_VERSION == '22'
53+
run: |
54+
cat /etc/apt/sources.list
55+
sudo sed -i.bak -e 's/^deb/deb [ arch=amd64,i386 ]/' /etc/apt/sources.list
56+
#deb [arch=amd64,i386] http://archive.ubuntu.com/ubuntu/ jammy main universe
57+
echo "deb [arch=arm64,armhf] http://ports.ubuntu.com/ubuntu-ports jammy main universe" | sudo tee -a /etc/apt/sources.list
58+
59+
60+
- name: update apt-repos (u24)
61+
if: env.UBUNTU_MAJOR_VERSION == '24'
62+
run: |
63+
sudo cp /etc/apt/sources.list.d/ubuntu.sources /etc/apt/sources.list.d/ports.sources
64+
sudo sed -i.bak -e 's/^\(Suites:.*\)$/\1\nArchitectures: amd64 i386/' /etc/apt/sources.list.d/ubuntu.sources
65+
sudo sed -i.bak -e 's/^URIs:.*$/URIs: http:\/\/ports.ubuntu.com\/ubuntu-ports\//' /etc/apt/sources.list.d/ports.sources
66+
sudo sed -i -e 's/^\(Suites:.*\)$/\1\nArchitectures: armhf arm64/' /etc/apt/sources.list.d/ports.sources
67+
cat /etc/apt/sources.list.d/ports.sources
68+
69+
- name: Install depencies
70+
run: |
71+
sudo dpkg --add-architecture armhf
72+
sudo dpkg --add-architecture arm64
73+
sudo apt update
74+
sudo apt install ccache libssl-dev:armhf libssl-dev:arm64 build-essential u-boot-tools python3-mako debhelper fakeroot gcc-arm-linux-gnueabihf gcc-aarch64-linux-gnu make device-tree-compiler libncurses5-dev libelf-dev libdw-dev
75+
76+
- name: Generate Changelog
77+
run: |
78+
echo "# CI-Build for $BRANCH ($KERNELVER)" > ${{ github.workspace }}-CHANGELOG.txt
79+
echo "last commits:" >> ${{ github.workspace }}-CHANGELOG.txt
80+
git log --pretty=format:"%h %ad %s %d by %an" --date=short >> ${{ github.workspace }}-CHANGELOG.txt
81+
82+
- name: Setup cache
83+
id: cache
84+
uses: actions/cache@v4
85+
with:
86+
path: ~/.cache/ccache/
87+
key: ${{ runner.os }}-ccache-${{ github.ref_name }}
88+
restore-keys: |
89+
${{ runner.os }}-ccache-${{ github.ref_name }}
90+
91+
- name: Build for bananapi-r2
92+
run: |
93+
export PATH=/usr/lib/ccache:$PATH
94+
bash build.sh importconfig
95+
bash build.sh build
96+
bash build.sh cryptodev
97+
- name: Pack for bananapi-r2
98+
run: |
99+
bash build.sh pack_debs
100+
bash build.sh pack
101+
bash build.sh clean
102+
df -h;du -h --max-depth=3 ~
103+
104+
- name: Build for bananapi-r64
105+
run: |
106+
sed -ri 's/^#(board=bpi-r64)/\1/' build.conf #change board to r64
107+
bash build.sh importconfig
108+
bash build.sh build
109+
bash build.sh cryptodev
110+
- name: Pack for bananapi-r64
111+
run: |
112+
bash build.sh pack_debs
113+
bash build.sh pack
114+
bash build.sh clean
115+
df -h;du -h --max-depth=3 ~
116+
117+
- name: Build for bananapi-r2pro
118+
run: |
119+
sed -ri 's/^#(board=bpi-r2pro)/\1/' build.conf #change board to r2pro
120+
bash build.sh importconfig
121+
bash build.sh build
122+
- name: Pack for bananapi-r2pro
123+
run: |
124+
bash build.sh pack_debs
125+
bash build.sh pack
126+
bash build.sh clean
127+
df -h;du -h --max-depth=3 ~
128+
129+
- name: Build for bananapi-r3 (mini)
130+
run: |
131+
sed -ri 's/^#(board=bpi-r3)/\1/' build.conf #change board to r3
132+
bash build.sh importconfig
133+
bash build.sh build
134+
- name: Pack for bananapi-r3
135+
run: |
136+
bash build.sh pack_debs
137+
bash build.sh pack
138+
bash build.sh clean
139+
df -h;du -h --max-depth=3 ~
140+
141+
- name: Build for bananapi-r4
142+
run: |
143+
sed -ri 's/^#(board=bpi-r4)$/\1/' build.conf #change board to r4
144+
bash build.sh importconfig
145+
bash build.sh build
146+
- name: Pack for bananapi-r4
147+
run: |
148+
bash build.sh pack_debs
149+
bash build.sh pack
150+
bash build.sh clean
151+
df -h;
152+
du -h --max-depth=3 ~
153+
154+
- name: list files to be uploaded
155+
run: |
156+
ls -lh ../SD/* ../*.deb *.itb
157+
158+
- name: Upload binaries to release
159+
if: endsWith(github.ref,'-main')
160+
#uses: marvinpinto/action-automatic-releases@latest
161+
#with:
162+
# repo_token: "${{ secrets.GITHUB_TOKEN }}"
163+
# automatic_release_tag: "CI-BUILD-${{ env.BRANCH }}-${{ env.KERNELVER }}-${{ env.DT }}"
164+
# prerelease: false
165+
# title: "Build for branch ${{ env.BRANCH }} (${{ env.KERNELVER }})"
166+
uses: softprops/action-gh-release@v1
167+
with:
168+
token: ${{ secrets.GITHUB_TOKEN }}
169+
#draft: true
170+
#prerelease: true
171+
body_path: ${{ github.workspace }}-CHANGELOG.txt
172+
body: ${{ github.sha }}-$BRANCH-$KERNELVER
173+
tag_name: "CI-BUILD-${{ env.BRANCH }}-${{ env.KERNELVER }}-${{ env.DT }}"
174+
target_commitish: ${{ github.sha }}
175+
files: |
176+
../SD/*
177+
../*.deb
178+
*.itb

0 commit comments

Comments
 (0)