Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into add-add-onnxruntime…
Browse files Browse the repository at this point in the history
…-win-x64-gpu-without-cuda
  • Loading branch information
qryxip committed Aug 3, 2024
2 parents 32f302a + bc8e892 commit c135cc4
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 33 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/actionlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: actionlint

on:
- push
- pull_request

jobs:
actionlint:
runs-on: ubuntu-22.04

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Update ShellCheck
run: |
sudo apt-get update
sudo apt-get install -y shellcheck
shellcheck -V
- name: actionlint
run: |
bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash)
./actionlint -color
69 changes: 36 additions & 33 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ name: Build C++ Shared Library

on:
push:
branches:
# - main
release:
types:
- published
Expand Down Expand Up @@ -302,13 +300,14 @@ jobs:
rm -rf ${{ matrix.result_dir }}/${{ matrix.artifact_name }}
rm -rf ./artifact
# Set library name
if [[ ${{ matrix.artifact_name }} == onnxruntime-win-* ]]; then
ARTIFACT_NAME=${{ matrix.artifact_name }}
if [[ "$ARTIFACT_NAME" == onnxruntime-win-* ]]; then
ONNXRUNTIME_NAME=onnxruntime.dll
elif [[ ${{ matrix.artifact_name }} == onnxruntime-linux-* ]]; then
elif [[ "$ARTIFACT_NAME" == onnxruntime-linux-* ]]; then
ONNXRUNTIME_NAME=libonnxruntime.so.${{ env.ONNXRUNTIME_VERSION }}
elif [[ ${{ matrix.artifact_name }} == onnxruntime-android-* ]]; then
elif [[ "$ARTIFACT_NAME" == onnxruntime-android-* ]]; then
ONNXRUNTIME_NAME=libonnxruntime.so
elif [[ ${{ matrix.artifact_name }} == onnxruntime-osx-* ]] || [[ ${{ matrix.artifact_name }} == onnxruntime-ios-* ]]; then
elif [[ "$ARTIFACT_NAME" == onnxruntime-osx-* ]] || [[ "$ARTIFACT_NAME" == onnxruntime-ios-* ]]; then
ONNXRUNTIME_NAME=libonnxruntime.${{ env.ONNXRUNTIME_VERSION }}.dylib
else
echo "Unknown target found : ${{ matrix.artifact_name }}"
Expand Down Expand Up @@ -346,7 +345,7 @@ jobs:

- name: Generate RELEASE_NAME
run: |
echo "RELEASE_NAME=${{ matrix.artifact_name }}-${{ env.ONNXRUNTIME_VERSION }}" >> $GITHUB_ENV
echo "RELEASE_NAME=${{ matrix.artifact_name }}-${{ env.ONNXRUNTIME_VERSION }}" >> "$GITHUB_ENV"
- name: Generate specifications
run: |
Expand All @@ -370,29 +369,29 @@ jobs:
esac
done
# ONNX Runtimeが示す順番に従う
if [ "$use_cuda" = 1 ]; then
devices=/CUDA
fi
if [ "$use_dml" = 1 ]; then
devices+=/DirectML
fi
devices+=/CPU
devices=${devices:1}
specs="<tr>"
specs+="<td>$os</td>"
specs+="<td>$arch</td>"
specs+="<td>$devices</td>"
specs+="<td><a href=\"https://github.com/$GITHUB_REPOSITORY/releases/download/$ONNXRUNTIME_VERSION/$RELEASE_NAME.tgz\">$RELEASE_NAME.tgz</a></td>"
specs+='</tr>'
cat <<< "$specs" > "$RELEASE_NAME.html"
jq '
{
"os": $os,
"arch": $arch,
# ONNX Runtimeが示す順番に従う
"devices": [
("CUDA" | select($use_cuda == "1")),
("DirectML" | select($use_dml == "1")),
"CPU"
] | join("/")
}' \
-n \
--arg os "$os" \
--arg arch "$arch" \
--arg use_cuda "$use_cuda" \
--arg use_dml "$use_dml" \
> "$RELEASE_NAME.json"
- name: Upload specifications
uses: actions/upload-artifact@v4
with:
name: specs-${{ matrix.artifact_name }}
path: ${{ env.RELEASE_NAME }}.html
path: ${{ env.RELEASE_NAME }}.json

- name: Rearchive artifact
if: env.RELEASE == 'true'
Expand Down Expand Up @@ -511,12 +510,11 @@ jobs:

- name: Construct release notes
run: |
onnxruntime_version_hyphenated=$(tr . - <<< "$ONNXRUNTIME_VERSION")
release_notes=$(
cat <<EOF
## 動的ライブラリ
<table id="voicevox-onnxruntime-specs-v1format-v$onnxruntime_version_hyphenated-dylibs">
<table data-voicevox-onnxruntime-specs-format-version="1" data-voicevox-onnxruntime-specs-type="dylibs">
<thead>
<tr>
<th>OS</th>
Expand All @@ -529,10 +527,15 @@ jobs:
EOF
)
release_notes+=$'\n'
for body in specs/*.html; do
release_notes+=$' '
release_notes+=$(< "$body")
release_notes+=$'\n'
for specs_file in specs/*.json; do
specs=$(< "$specs_file")
release_name=$(basename "${specs_file%.json}")
release_notes+=$' <tr>\n'
release_notes+=" <td>$(jq .os -r <<< "$specs")</td>"$'\n'
release_notes+=" <td>$(jq .arch -r <<< "$specs")</td>"$'\n'
release_notes+=" <td>$(jq .devices -r <<< "$specs")</td>"$'\n'
release_notes+=" <td><a href=\"https://github.com/$GITHUB_REPOSITORY/releases/download/$ONNXRUNTIME_VERSION/$release_name.tgz\">$release_name.tgz</a></td>"$'\n'
release_notes+=$' </tr>\n'
done
release_notes+=$(
cat <<EOF
Expand All @@ -541,11 +544,11 @@ jobs:
## XCFramework
<table id="voicevox-onnxruntime-specs-v1format-v$onnxruntime_version_hyphenated-xcframeworks">
<table data-voicevox-onnxruntime-specs-format-version="1" data-voicevox-onnxruntime-specs-type="xcframeworks">
<thead>
<tr>
<th>OS</th>
<th>アーキテクチャ</th>
<th>アーキテクチャ</th>
<th>デバイス</th>
<th>名前</th>
</tr>
Expand Down

0 comments on commit c135cc4

Please sign in to comment.