Merge pull request #9 from shota3506/setup-workspace-in-ci #13
This file contains hidden or 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
| name: Build | |
| on: | |
| push: | |
| branches: [ "main" ] | |
| pull_request: | |
| branches: [ "main" ] | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| env: | |
| ONNXRUNTIME_VERSION: "1.23.0" | |
| ONNXRUNTIME_GENAI_VERSION: "0.11.0" | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/setup-go@v6 | |
| with: | |
| go-version-file: 'go.mod' | |
| - name: Install staticcheck | |
| run: go install honnef.co/go/tools/cmd/[email protected] | |
| - name: Setup go.work | |
| run: make setup-workspace | |
| - name: Build | |
| run: go build -v github.com/shota3506/onnxruntime-purego/... | |
| - name: Lint | |
| run: make lint | |
| - name: Cache ONNX Runtime | |
| id: cache-onnxruntime | |
| uses: actions/cache@v4 | |
| with: | |
| path: lib/libonnxruntime.so* | |
| key: onnxruntime-linux-x64-${{ env.ONNXRUNTIME_VERSION }} | |
| - name: Download ONNX Runtime | |
| if: steps.cache-onnxruntime.outputs.cache-hit != 'true' | |
| run: | | |
| ./download.sh ${{ env.ONNXRUNTIME_VERSION }} | |
| mkdir -p lib | |
| cp libs/${{ env.ONNXRUNTIME_VERSION }}/lib/libonnxruntime.so* lib/ | |
| rm -rf libs/${{ env.ONNXRUNTIME_VERSION }} | |
| - name: Cache ONNX Runtime GenAI | |
| id: cache-genai | |
| uses: actions/cache@v4 | |
| with: | |
| path: lib/libonnxruntime-genai.so | |
| key: genai-linux-x64-${{ env.ONNXRUNTIME_GENAI_VERSION }} | |
| - name: Download ONNX Runtime GenAI | |
| if: steps.cache-genai.outputs.cache-hit != 'true' | |
| run: | | |
| ./download_genai.sh ${{ env.ONNXRUNTIME_GENAI_VERSION }} | |
| mkdir -p lib | |
| cp libs/genai/${{ env.ONNXRUNTIME_GENAI_VERSION }}/lib/libonnxruntime-genai.so lib/ | |
| rm -rf libs/genai/${{ env.ONNXRUNTIME_GENAI_VERSION }} | |
| - name: Test | |
| run: go test -v ./... | |
| env: | |
| LD_LIBRARY_PATH: ${{ github.workspace }}/lib |