diff --git a/.github/workflows/build-native.yml b/.github/workflows/build-native.yml index 40839a9..2e54e3a 100644 --- a/.github/workflows/build-native.yml +++ b/.github/workflows/build-native.yml @@ -2,9 +2,30 @@ name: Build Native on: workflow_dispatch: + push: + branches: + - master + - main + paths: + - 'src/main/resources/org/xerial/snappy/VERSION' + - 'Makefile' + - 'Makefile.common' + - '**/*.h' + - '**/*.cpp' + - .github/workflows/build-native.yml + pull_request: + paths: + - 'src/main/resources/org/xerial/snappy/VERSION' + - 'Makefile' + - 'Makefile.common' + - '**/*.h' + - '**/*.cpp' jobs: build: + permissions: + contents: write + pull-requests: write name: Build native libraries runs-on: ubuntu-latest steps: @@ -13,25 +34,11 @@ jobs: run: make clean-native native-all env: OCI_EXE: docker - - name: Upload native libraries - uses: actions/upload-artifact@v3 + - name: Create Pull Request + if: ${{ github.event_name != 'pull_request' }} + uses: peter-evans/create-pull-request@v5 with: - name: native-libs - path: src/main/resources/org/xerial/snappy/native/ - push: - name: Push new native libraries to branch - runs-on: ubuntu-latest - needs: [build] - steps: - - uses: actions/checkout@v3 - - name: Download native libraries - uses: actions/download-artifact@v3 - with: - name: native-libs - path: src/main/resources/org/xerial/snappy/native/ - - run: git status - - name: Commit and push - uses: EndBug/add-and-commit@v9 - with: - message: 'Update native libraries' - default_author: github_actions + title: Update native libraries + commit-message: Updatge native libraries for ${{ github.sha }} + branch: update-native-libs + labels: library-update diff --git a/Makefile b/Makefile index 2d2ed08..adba9ca 100644 --- a/Makefile +++ b/Makefile @@ -203,6 +203,8 @@ freebsd64: # For ARM native-arm: linux-arm64 linux-android-arm linux-android-aarch64 linux-arm linux-armv6 linux-armv7 + +# TODO: CROSS_PREFIX can be replaced with ${CROSS_ROOT}/bin/${CROSS_TRIPLE}- in Makefile.common linux-arm: jni-header ./docker/dockcross-armv5 -a $(DOCKER_RUN_OPTS) bash -c 'make clean-native native CROSS_PREFIX=/usr/xcc/armv5-unknown-linux-gnueabi/bin//armv5-unknown-linux-gnueabi- OS_NAME=Linux OS_ARCH=arm' diff --git a/Makefile.common b/Makefile.common index 69bed02..8c060e3 100755 --- a/Makefile.common +++ b/Makefile.common @@ -50,6 +50,7 @@ endif # os=Default is meant to be generic unix/linux +# To support new CPU architecture, add a new target name here known_os_archs := Linux-x86 Linux-x86_64 Linux-arm Linux-armv6 Linux-armv7 Linux-android-arm Linux-android-aarch64 Linux-aarch64 Linux-ppc Linux-ppc64 Linux-ppc64le Linux-s390 Linux-s390x Mac-x86 Mac-x86_64 Mac-aarch64 FreeBSD-x86_64 Windows-x86 Windows-x86_64 SunOS-x86 SunOS-sparc SunOS-x86_64 AIX-ppc AIX-ppc64 Linux-riscv Linux-riscv64 os_arch := $(OS_NAME)-$(OS_ARCH) IBM_JDK_7 := $(findstring IBM, $(shell $(JAVA) -version 2>&1 | grep IBM | grep "JRE 1.7"))