-
Notifications
You must be signed in to change notification settings - Fork 30
77 lines (65 loc) · 3.06 KB
/
Build-Releases.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
name: Release
on:
release:
types: [published]
env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release
jobs:
prepare_release:
runs-on: ubuntu-latest
steps:
- id: last-release
uses: pozetroninc/github-action-get-latest-release@master
with:
repository: ${{ github.repository }}
outputs:
release_id: ${{ steps.last-release.outputs.id }}
build:
runs-on: ubuntu-latest
needs: prepare_release
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Setup env
run: sudo apt-get update && sudo apt-get install -y gcc-arm-none-eabi gcc-arm-linux-gnueabihf gcc-arm-linux-gnueabi g++-arm-linux-gnueabi g++-arm-linux-gnueabihf build-essential libncurses5-dev zlib1g-dev gawk flex bison quilt libssl-dev xsltproc libxml-parser-perl mercurial bzr ecj cvs unzip lsof
- name: Install RV64 Toolchain
run: |
wget https://occ-oss-prod.oss-cn-hangzhou.aliyuncs.com/resource//1705395512373/Xuantie-900-gcc-elf-newlib-x86_64-V2.8.1-20240115.tar.gz
tar -xf Xuantie-900-gcc-elf-newlib-x86_64-V2.8.1-20240115.tar.gz
- name: Find and build CMake files
run: |
export RISCV_ROOT_PATH=${{github.workspace}}/Xuantie-900-gcc-elf-newlib-x86_64-V2.8.1/bin/
find ./cmake/board/ -name "*.cmake" -type f | while read file; do
cmake -B ${{github.workspace}}/build-$(basename "$file") -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_BOARD_FILE=$(basename "$file")
cmake --build ${{github.workspace}}/build-$(basename "$file") --config ${{env.BUILD_TYPE}}
done
- name: Compress files
run: |
mkdir ${{github.workspace}}/releases
find ./cmake/board/ -name "*.cmake" -type f | while read file; do
cmakename=$(basename "$file")
boardname=${cmakename:0:-6}
if [ -d ${{github.workspace}}/build-$(basename "$file")/board/${boardname} ]; then
rm $(find ${{github.workspace}}/build-$(basename "$file")/board/${boardname} -name "*.cmake")
rm $(find ${{github.workspace}}/build-$(basename "$file")/board/${boardname} -name "Makefile")
rm -rf $(find ${{github.workspace}}/build-$(basename "$file")/board/${boardname} -name "CMakeFiles")
cd ${{github.workspace}}/build-$(basename "$file")/board/${boardname} && tar -zcvf ${{github.workspace}}/releases/${boardname}.tar.gz ./*
fi
done
- name: Upload
if: needs.prepare_release.outputs.release_id != ''
uses: xresloader/upload-to-github-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
release_id: ${{ needs.prepare_release.outputs.release_id }}
file: "${{github.workspace}}/releases/*.tar.gz"
draft: false
- name: Rollback release
if: failure() && needs.prepare_release.outputs.release_id != ''
uses: author/action-rollback@stable
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
release_id: ${{ needs.prepare_release.outputs.release_id }}