native image error #958
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
name: Build Native | |
on: | |
workflow_dispatch: | |
pull_request: | |
types: [ opened ] | |
issue_comment: | |
types: [ created ] | |
jobs: | |
check: | |
name: Check conditions | |
runs-on: ubuntu-latest | |
outputs: | |
ref: ${{ steps.output.outputs.ref }} | |
repo: ${{ steps.output.outputs.repo }} | |
steps: | |
- name: Check if PR comment trigger is present | |
if: github.event_name != 'workflow_dispatch' | |
uses: khan/pull-request-comment-trigger@v1.1.0 | |
id: check | |
with: | |
trigger: '/native' | |
reaction: rocket | |
prefix_only: true | |
env: | |
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}' | |
- name: Get PR branch | |
uses: gotson/pull-request-comment-branch@head-repo-owner-dist | |
if: steps.check.outputs.triggered == 'true' | |
id: comment-branch | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
# This will set the branch to use: | |
# - if workflow_dispatch, use the branch that was chosen when running the workflow | |
# - if it is a comment on a PR, and the trigger matches, use the PR branch | |
- name: Set job output | |
id: output | |
run: | | |
echo "::echo::on" | |
if [[ "${{ github.event_name == 'workflow_dispatch' }}" == 'true' ]] | |
then | |
echo "ref=${{ github.ref_name }}" >> $GITHUB_OUTPUT | |
echo "repo=${{ github.repository }}" >> $GITHUB_OUTPUT | |
elif [[ "${{ steps.check.outputs.triggered }}" == 'true' ]] | |
then | |
echo "ref=${{ steps.comment-branch.outputs.head_ref }}" >> $GITHUB_OUTPUT | |
echo "repo=${{ steps.comment-branch.outputs.head_owner }}/${{ steps.comment-branch.outputs.head_repo }}" >> $GITHUB_OUTPUT | |
else | |
echo "" | |
fi | |
matrix: | |
name: Build matrix | |
runs-on: ubuntu-latest | |
needs: [check] | |
if: needs.check.outputs.ref && needs.check.outputs.repo | |
outputs: | |
matrix: ${{ steps.set-matrix.outputs.matrix }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
repository: ${{ needs.check.outputs.repo }} | |
ref: ${{ needs.check.outputs.ref }} | |
- name: Build matrix from Makefile | |
id: set-matrix | |
# parse the Makefile to retrieve the list of targets in 'native-all', without 'native' | |
run: | | |
matrix=$(( | |
echo '{ "target" : [' | |
sed -n "/^native-all *: */ { s///; p }" Makefile | sed "s/^native\s//g" | sed 's/ /, /g' | xargs -n 1 echo | sed -r 's/^([^,]*)(,?)$/"\1"\2/' | |
echo " ]}" | |
) | jq -c .) | |
echo $matrix | jq . | |
echo "matrix=$matrix" >> $GITHUB_OUTPUT | |
build: | |
name: Build native libraries | |
runs-on: ubuntu-latest | |
needs: [check, matrix] | |
strategy: | |
matrix: ${{fromJson(needs.matrix.outputs.matrix)}} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
repository: ${{ needs.check.outputs.repo }} | |
ref: ${{ needs.check.outputs.ref }} | |
# Delete existing libs so we only upload the generated one into the artifact | |
- name: Delete existing native libs | |
run: rm -fr src/main/resources/org/sqlite/native | |
- name: Build native libraries | |
run: make ${{ matrix.target }} | |
env: | |
OCI_EXE: docker | |
- name: Upload native libraries | |
uses: actions/upload-artifact@v3 | |
with: | |
name: native-libs | |
path: src/main/resources/org/sqlite/native/ | |
push: | |
name: Push new native libraries to branch | |
runs-on: ubuntu-latest | |
needs: [check, build] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
repository: ${{ needs.check.outputs.repo }} | |
ref: ${{ needs.check.outputs.ref }} | |
- name: Download native libraries | |
uses: actions/download-artifact@v3 | |
with: | |
name: native-libs | |
path: src/main/resources/org/sqlite/native/ | |
- run: git status | |
- name: Commit and push | |
uses: EndBug/add-and-commit@v9 | |
with: | |
message: 'chore: update native libraries' | |
default_author: github_actions |