Cross-compile for mips64 and i386 #377
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: CI | |
on: [push, pull_request] | |
jobs: | |
linux: | |
strategy: | |
fail-fast: false | |
matrix: | |
include: [ | |
{ os: ubuntu-latest, target: linux/amd64 } | |
] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-java@v3 | |
with: | |
java-version: 11 | |
distribution: zulu | |
- name: Install sbt-java-module-info | |
run: pushd ./sbt-java-module-info; ./sbt publishLocal; popd | |
- name: Compile | |
run: ./sbt compile | |
- name: Env | |
run: echo "nativeJniVersion=`cat version`" >> $GITHUB_ENV | |
- name: Inspect | |
run: ldd target/classes/${{ matrix.target }}/libzstd-jni-${nativeJniVersion}.so | |
- name: Test | |
run: ./sbt jacoco | |
- name: Upload coverage | |
uses: codecov/codecov-action@v3 | |
- name: Deploy | |
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master'}} | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
AWS_DEFAULT_REGION: "us-east-1" | |
run: aws s3 cp --recursive target/classes/${{ matrix.target }} s3://zstd-jni/github/${{ matrix.target }} | |
macos: | |
strategy: | |
fail-fast: false | |
matrix: | |
include: [ | |
{ os: macos-11.0, host_arch: x86_64, macos_target: x86_64-apple-macos10.12, target_arch: x86_64 }, | |
{ os: macos-11.0, host_arch: x86_64, macos_target: arm64-apple-macos11, target_arch: aarch64 } | |
] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-java@v3 | |
with: | |
java-version: 11 | |
distribution: zulu | |
- uses: maxim-lobanov/setup-xcode@v1 | |
with: | |
xcode-version: latest | |
- name: Install sbt-java-module-info | |
run: pushd ./sbt-java-module-info; ./sbt publishLocal; popd | |
- name: Compile | |
env: | |
CC: cc -target ${{ matrix.macos_target }} | |
run: ./sbt compile | |
- name: Env | |
run: echo "nativeJniVersion=`cat version`" >> $GITHUB_ENV | |
- name: Inspect | |
if: matrix.target_arch == 'x86_64' | |
run: otool -L target/classes/darwin/${{ matrix.target_arch }}/libzstd-jni-${nativeJniVersion}.dylib | |
- name: Symbols | |
if: matrix.target_arch == 'x86_64' | |
run: nm -m target/classes/darwin/${{ matrix.target_arch }}/libzstd-jni-${nativeJniVersion}.dylib | |
- name: Test | |
if: matrix.target_arch == 'x86_64' | |
run: ./sbt jacoco | |
- name: Upload coverage | |
if: matrix.target_arch == 'x86_64' | |
uses: codecov/codecov-action@v3 | |
- name: Deploy | |
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master'}} | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
AWS_DEFAULT_REGION: "us-east-1" | |
run: aws s3 cp --recursive target/classes/darwin/${{ matrix.host_arch }} s3://zstd-jni/github/darwin/${{ matrix.target_arch }} | |
windows: | |
strategy: | |
fail-fast: false | |
matrix: | |
include: [ | |
{ msystem: MINGW64, arch: x86_64, java_arch: x64, target: 'win\amd64', s3_path: win/amd64 }, | |
{ msystem: MINGW32, arch: i686, java_arch: x86, target: 'win\x86', s3_path: win/x86 } | |
] | |
runs-on: windows-latest | |
defaults: | |
run: | |
shell: msys2 {0} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: msys2/setup-msys2@v2 | |
with: | |
msystem: ${{ matrix.msystem }} | |
install: git base-devel mingw-w64-${{ matrix.arch }}-toolchain | |
path-type: inherit | |
update: true | |
- uses: actions/setup-java@v3 | |
with: | |
java-version: 11 | |
distribution: zulu | |
architecture: ${{ matrix.java_arch }} | |
- name: Check Java version | |
run: java -version | |
- name: Install sbt-java-module-info | |
run: cd ./sbt-java-module-info; ./sbt publishLocal | |
- name: Compile | |
run: ./sbt compile | |
- name: Test | |
run: ./sbt jacoco | |
- name: Upload coverage | |
uses: codecov/codecov-action@v3 | |
- name: Deploy | |
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master'}} | |
shell: cmd | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
AWS_DEFAULT_REGION: "us-east-1" | |
run: 'aws s3 cp --recursive target\classes\${{ matrix.target }} s3://zstd-jni/github/${{ matrix.s3_path }}' | |
windows-cross: | |
runs-on: windows-latest | |
defaults: | |
run: | |
shell: msys2 {0} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: msys2/setup-msys2@v2 | |
with: | |
msystem: mingw64 | |
install: git base-devel mingw-w64-cross-clang | |
path-type: inherit | |
update: true | |
- name: Compile | |
run: /opt/aarch64-w64-mingw32/bin/aarch64-w64-mingw32-clang -shared -flto -D_JNI_IMPLEMENTATION_ -Wl,--kill-at -O3 -DZSTD_LEGACY_SUPPORT=4 -DZSTD_MULTITHREAD=1 -I./src/windows/include -I./jni -I./src/main/native -I./src/main/native/common -I./src/main/native/legacy -std=c99 -o libzstd-jni-$(cat version).dll ./src/main/native/*.c ./src/main/native/legacy/*.c ./src/main/native/common/*.c ./src/main/native/compress/*.c ./src/main/native/decompress/*.[cS] ./src/main/native/dictBuilder/*.c | |
- name: Deploy | |
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master'}} | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
AWS_DEFAULT_REGION: "us-east-1" | |
run: aws s3 cp libzstd-jni-$(cat version).dll s3://zstd-jni/github/win/aarch64/libzstd-jni-$(cat version).dll |