Skip to content

Commit 2a756d5

Browse files
committed
ci: add build.yaml
1 parent 0d8eb6a commit 2a756d5

File tree

1 file changed

+163
-0
lines changed

1 file changed

+163
-0
lines changed

.github/workflows/build.yml

+163
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,163 @@
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
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+
102+
- name: Build for bananapi-r64
103+
run: |
104+
sed -ri 's/^#(board=bpi-r64)/\1/' build.conf #change board to r64
105+
bash build.sh importconfig
106+
bash build.sh build
107+
bash build.sh cryptodev
108+
- name: Pack for bananapi-r64
109+
run: |
110+
bash build.sh pack_debs
111+
bash build.sh pack
112+
113+
- name: Build for bananapi-r2pro
114+
run: |
115+
sed -ri 's/^#(board=bpi-r2pro)/\1/' build.conf #change board to r2pro
116+
bash build.sh importconfig
117+
bash build.sh build
118+
- name: Pack for bananapi-r2pro
119+
run: |
120+
bash build.sh pack_debs
121+
bash build.sh pack
122+
123+
- name: Build for bananapi-r3 (mini)
124+
run: |
125+
sed -ri 's/^#(board=bpi-r3)/\1/' build.conf #change board to r3
126+
bash build.sh importconfig
127+
bash build.sh build
128+
- name: Pack for bananapi-r3
129+
run: |
130+
bash build.sh pack_debs
131+
bash build.sh pack
132+
133+
- name: Build for bananapi-r4
134+
run: |
135+
sed -ri 's/^#(board=bpi-r4)/\1/' build.conf #change board to r4
136+
bash build.sh importconfig
137+
bash build.sh build
138+
- name: Pack for bananapi-r4
139+
run: |
140+
bash build.sh pack_debs
141+
bash build.sh pack
142+
143+
- name: Upload binaries to release
144+
if: endsWith(github.ref,'-main')
145+
#uses: marvinpinto/action-automatic-releases@latest
146+
#with:
147+
# repo_token: "${{ secrets.GITHUB_TOKEN }}"
148+
# automatic_release_tag: "CI-BUILD-${{ env.BRANCH }}-${{ env.KERNELVER }}-${{ env.DT }}"
149+
# prerelease: false
150+
# title: "Build for branch ${{ env.BRANCH }} (${{ env.KERNELVER }})"
151+
uses: softprops/action-gh-release@v1
152+
with:
153+
token: ${{ secrets.GITHUB_TOKEN }}
154+
#draft: true
155+
#prerelease: true
156+
body_path: ${{ github.workspace }}-CHANGELOG.txt
157+
body: ${{ github.sha }}-$BRANCH-$KERNELVER
158+
tag_name: "CI-BUILD-${{ env.BRANCH }}-${{ env.KERNELVER }}-${{ env.DT }}"
159+
target_commitish: ${{ github.sha }}
160+
files: |
161+
../SD/*
162+
../*.deb
163+
*.itb

0 commit comments

Comments
 (0)