Trigger native lib build on PR (#444)

* trigger build native on PR and push

Signed-off-by: Sudip Roy <sudiproy1999@gmail.com>

* Add branch master

* Trigger native lib build only for PRs

* Test native lib build trigger

* Targetting the PR repo

* Add comment to trigger native lib build

* Fix syntax error

* Test with write permission

* Test with contents: write

* Test

* test

* Use gh pr checkout

* fix

* Add checkout phase

* test target repo:

* Try bot user

* clanup

* Use PAT

* Use different user

* simplify

* fix

* test

* Fix token

* revert

* Try push action

* use the same token

* fix tab

* Set ref

* Create a new PR for every master update

* fix

* fix indent

* Use native-all

---------

Signed-off-by: Sudip Roy <sudiproy1999@gmail.com>
Co-authored-by: Taro L. Saito <leo@xerial.org>
This commit is contained in:
Sudip Roy 2023-05-25 01:38:53 +05:30 committed by GitHub
parent d8c5b8e4b6
commit 10f3b32d49
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 31 additions and 21 deletions

View File

@ -2,9 +2,30 @@ name: Build Native
on: on:
workflow_dispatch: 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: jobs:
build: build:
permissions:
contents: write
pull-requests: write
name: Build native libraries name: Build native libraries
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
@ -13,25 +34,11 @@ jobs:
run: make clean-native native-all run: make clean-native native-all
env: env:
OCI_EXE: docker OCI_EXE: docker
- name: Upload native libraries - name: Create Pull Request
uses: actions/upload-artifact@v3 if: ${{ github.event_name != 'pull_request' }}
uses: peter-evans/create-pull-request@v5
with: with:
name: native-libs title: Update native libraries
path: src/main/resources/org/xerial/snappy/native/ commit-message: Updatge native libraries for ${{ github.sha }}
push: branch: update-native-libs
name: Push new native libraries to branch labels: library-update
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

View File

@ -203,6 +203,8 @@ freebsd64:
# For ARM # For ARM
native-arm: linux-arm64 linux-android-arm linux-android-aarch64 linux-arm linux-armv6 linux-armv7 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 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' ./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'

View File

@ -50,6 +50,7 @@ endif
# os=Default is meant to be generic unix/linux # 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 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) os_arch := $(OS_NAME)-$(OS_ARCH)
IBM_JDK_7 := $(findstring IBM, $(shell $(JAVA) -version 2>&1 | grep IBM | grep "JRE 1.7")) IBM_JDK_7 := $(findstring IBM, $(shell $(JAVA) -version 2>&1 | grep IBM | grep "JRE 1.7"))