-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
067e50a
commit 0961bea
Showing
1 changed file
with
101 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
name: risc-v | ||
|
||
on: | ||
push: | ||
branches: | ||
- risc-v | ||
workflow_dispatch: | ||
inputs: | ||
version: | ||
description: "Version information(e.g., 1.17.0)" | ||
required: true | ||
|
||
permissions: | ||
contents: write | ||
|
||
env: | ||
ONNXRUNTIME_VERSION: | ||
|- # Enter release tag name or version name in workflow_dispatch. Appropriate version if not specified | ||
${{ github.event.release.tag_name || github.event.inputs.version || '1.17.0' }} | ||
|
||
jobs: | ||
risc-v: | ||
name: Build onnxruntime lib for risc-v | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ubuntu-latest] | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Cache build result for ${{ env.ONNXRUNTIME_VERSION }} | ||
id: cache-build-result | ||
uses: actions/cache@v2 | ||
with: | ||
path: onnxruntime-linux-risc-v-${{ env.ONNXRUNTIME_VERSION }} | ||
key: onnxruntime-risc-v-linux-${{ env.ONNXRUNTIME_VERSION }}-cache-v2 | ||
|
||
- name: Checkout | ||
if: steps.cache-build-result.outputs.cache-hit != 'true' | ||
uses: actions/checkout@v2 | ||
with: | ||
repository: microsoft/onnxruntime | ||
submodules: true | ||
ref: v${{ env.ONNXRUNTIME_VERSION }} | ||
|
||
- name: Download protoc | ||
if: steps.cache-build-result.outputs.cache-hit != 'true' | ||
shell: bash | ||
run: | | ||
# see ./cmake/deps.txt | ||
if [[ ${{ env.ONNXRUNTIME_VERSION }} =~ 1.14.[0-9] ]]; then | ||
wget https://github.com/protocolbuffers/protobuf/releases/download/v3.20.3/protoc-3.20.3-linux-x86_64.zip | ||
unzip protoc-3.20.3-linux-x86_64.zip | ||
elif [[ ${{ env.ONNXRUNTIME_VERSION }} =~ 1.1[567].[0-9] ]]; then | ||
wget https://github.com/protocolbuffers/protobuf/releases/download/v21.12/protoc-21.12-linux-x86_64.zip | ||
unzip protoc-21.12-linux-x86_64.zip | ||
else | ||
echo "Unsupported version ${{ env.ONNXRUNTIME_VERSION }}" | ||
exit 1 | ||
fi | ||
./bin/protoc --version | ||
- name: Set environment variable | ||
if: steps.cache-build-result.outputs.cache-hit != 'true' | ||
shell: bash | ||
run: | | ||
echo "$GITHUB_WORKSPACE/bin" >> "$GITHUB_PATH" | ||
- name: Display protoc info for ${{ env.ONNXRUNTIME_VERSION }} | ||
if: steps.cache-build-result.outputs.cache-hit != 'true' | ||
shell: bash | ||
run: | | ||
protoc --version | ||
- name: Show current directory | ||
shell: bash | ||
run: | | ||
ls -lh | ||
echo $PWD | ||
- name: Install dependencies | ||
if: steps.cache-build-result.outputs.cache-hit != 'true' | ||
shell: bash | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install python3 git-lfs | ||
python3 -m pip install cmake | ||
cmake --version | ||
- name: Build onnxruntime for risc-v | ||
if: steps.cache-build-result.outputs.cache-hit != 'true' | ||
shell: bash | ||
run: | | ||
ls -lh tools | ||
ls -lh tools/scripts | ||
python3 ./tools/scripts/build_riscv64.sh | ||
python3 ./tools/scripts/build_riscv64.sh |