-
Notifications
You must be signed in to change notification settings - Fork 18
executable file
·107 lines (94 loc) · 3.99 KB
/
build_riscv.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
# This is a basic workflow to help you get started with Actions
name: Bitbake qemuriscv
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events
push:
branches: [ main ]
pull_request:
branches: [ main ]
schedule:
- cron: '0 12 * * 5'
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
env:
TARGET_VERSION: master
TARGET_BITBAKE_VERSION: master
WORKING_DIR: /home/runner/work
BUILD_DIR: /mnt/build
DOWNLOAD_DIR: /mnt/build/downloads
SSTATE_DIR: /mnt/build/sstate-cache
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
bitbake-riscv:
strategy:
matrix:
target_machine: [qemuriscv64, qemuriscv32]
tensorflow_version: [2.18.0]
# The type of runner that the job will run on
runs-on: ubuntu-22.04
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
# Install essential host packages
- name: Install Packages
run: |
sudo apt-get update
sudo apt-get -y install gawk wget git diffstat unzip texinfo gcc build-essential \
chrpath socat cpio python3 python3-pip python3-pexpect xz-utils debianutils \
iputils-ping python3-git python3-jinja2 python3-subunit zstd liblz4-tool file \
locales libacl1
sudo apt-get clean
sudo apt-get autoclean -y
sudo locale-gen en_US.UTF-8
- name: Prepare build directory
run: |
sudo mkdir -p ${BUILD_DIR}
sudo chown runner ${BUILD_DIR}
- name: Restore cache
id: ccache-restore
uses: actions/cache/restore@v4
with:
path: |
${{ env.DOWNLOAD_DIR }}
${{ env.SSTATE_DIR }}
key: cache-${{ matrix.target_machine }}-${{ env.TARGET_VERSION }}
# checkout repository
- name: Clone meta-riscv, openembedded-core, bitbake, meta-openembedded
run: |
sudo chown runner /mnt
git clone --depth 1 -b ${TARGET_VERSION} https://github.com/riscv/meta-riscv.git
git clone --depth 1 -b ${TARGET_VERSION} https://github.com/openembedded/openembedded-core.git
git clone --depth 1 -b ${TARGET_BITBAKE_VERSION} https://github.com/openembedded/bitbake.git
git clone --depth 1 -b ${TARGET_VERSION} https://github.com/openembedded/meta-openembedded.git
working-directory: /home/runner/work
# Run bitbake
- name: Bitbake MACHINE=${{ matrix.target_machine }}, TensorFlow-Lite version ${{ matrix.tensorflow_version }}
run: |
source ${WORKING_DIR}/openembedded-core/oe-init-build-env ${BUILD_DIR}
bitbake-layers add-layer ${WORKING_DIR}/meta-openembedded/meta-oe
bitbake-layers add-layer ${WORKING_DIR}/meta-openembedded/meta-python
bitbake-layers add-layer ${WORKING_DIR}/meta-tensorflow-lite/meta-tensorflow-lite
bitbake-layers add-layer ${WORKING_DIR}/meta-riscv
cat <<EOF> conf/auto.conf
FORTRAN:forcevariable = ",fortran"
BB_NUMBER_THREADS = "8"
EOF
cat conf/auto.conf
MACHINE=${{matrix.target_machine}} bitbake python3-tensorflow-lite libtensorflow-lite \
libtensorflow-lite-c python3-tensorflow-lite-example tensorflow-lite-label-image \
tensorflow-lite-minimal tensorflow-lite-benchmark libedgetpu-std
working-directory: /mnt
# Remove all files that hasn't been access in 10 days
- name: Clean SState Cache
run: |
find ${SSTATE_DIR} -type f -mtime +10 -delete
- name: Save cache
uses: actions/cache/save@v4
if: always()
with:
path: |
${{ env.DOWNLOAD_DIR }}
${{ env.SSTATE_DIR }}
key: ${{ steps.ccache-restore.outputs.cache-primary-key }}