From 91db274c9c4f91be4aad35929c85f64f87c065d1 Mon Sep 17 00:00:00 2001 From: Carl Amko Date: Wed, 26 Jul 2023 11:03:26 -0600 Subject: [PATCH] Add custom linkers for cross compile builds --- .github/workflows/release-perform.yml | 35 ++++++++++++++++++------- .github/workflows/rust-cache/action.yml | 4 +-- 2 files changed, 27 insertions(+), 12 deletions(-) diff --git a/.github/workflows/release-perform.yml b/.github/workflows/release-perform.yml index 404760c..cdf5a54 100644 --- a/.github/workflows/release-perform.yml +++ b/.github/workflows/release-perform.yml @@ -21,6 +21,8 @@ jobs: - host: ubuntu-latest target: i686-unknown-linux-gnu artifact: linux-x86 + cross: true + linker: gcc-multilib pkgFlags: "--define 'skipTests'" - host: ubuntu-latest target: x86_64-unknown-linux-gnu @@ -28,27 +30,33 @@ jobs: - host: ubuntu-latest target: aarch64-unknown-linux-gnu artifact: linux-aarch64 + cross: true + linker: gcc-aarch64-linux-gnu pkgFlags: "--define 'skipTests'" - host: ubuntu-latest target: aarch64-linux-android artifact: linux-android-aarch64 + cross: true + linker: gcc-aarch64-linux-gnu pkgFlags: "--define 'skipTests'" - host: ubuntu-latest target: armv7-linux-androideabi artifact: linux-android-armv7 + cross: true + linker: gcc-arm-linux-gnueabihf pkgFlags: "--define 'skipTests'" - host: windows-latest target: x86_64-pc-windows-msvc artifact: windows-x86_64 - host: windows-latest - target: i686-pc-windows-msvc + target: i686-pc-windows-msvc artifact: windows-x86_32 pkgFlags: "--define 'skipTests'" - host: macos-latest - target: x86_64-apple-darwin + target: x86_64-apple-darwin artifact: osx-x86_64 - host: macos-latest - target: aarch64-apple-darwin + target: aarch64-apple-darwin artifact: osx-aarch64 pkgFlags: "--define 'skipTests'" runs-on: ${{ matrix.config.host }} @@ -61,13 +69,20 @@ jobs: toolchain: stable targets: ${{ matrix.config.target }} - uses: ./.github/workflows/rust-cache - - uses: actions/setup-java@v3 + - name: Install Linker + run: | + sudo apt update + sudo apt install ${{ matrix.config.linker }} + if: ${{ matrix.config.cross }} + - name: Setup Java + uses: actions/setup-java@v3 with: - java-version: '11' - distribution: 'temurin' - - name: Run mvn package native + java-version: "11" + distribution: "temurin" + - name: Run mvn package for native run: mvn --batch-mode --projects ngrok-java-native --also-make package --activate-profiles ci-native --define 'ngrok.native.classifier=${{ matrix.config.artifact }}' --define 'ngrok.native.target=${{ matrix.config.target }}' ${{ matrix.config.pkgFlags }} - - uses: actions/upload-artifact@v3 + - name: Upload Artifacts + uses: actions/upload-artifact@v3 with: name: ngrok-java-native-${{ github.event.inputs.releaseVersion }}-${{ matrix.config.artifact }}.jar path: ngrok-java-native/target/ngrok-java-native-${{ github.event.inputs.releaseVersion }}-${{ matrix.config.artifact }}.jar @@ -87,7 +102,7 @@ jobs: java-version: | 17 11 - distribution: 'temurin' + distribution: "temurin" server-id: ossrh server-username: MAVEN_USERNAME server-password: MAVEN_PASSWORD @@ -117,7 +132,7 @@ jobs: java-version: | 17 11 - distribution: 'temurin' + distribution: "temurin" - uses: actions/download-artifact@v3 with: path: ngrok-java-native/target/ diff --git a/.github/workflows/rust-cache/action.yml b/.github/workflows/rust-cache/action.yml index 2b58e97..cc0d676 100644 --- a/.github/workflows/rust-cache/action.yml +++ b/.github/workflows/rust-cache/action.yml @@ -11,8 +11,8 @@ runs: script: | core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || ''); core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || ''); - core.exportVariable('SCCACHE_GHA_CACHE_TO', 'sccache-${{runner.os}}-${{github.ref_name}}'); - core.exportVariable('SCCACHE_GHA_CACHE_FROM', 'sccache-${{runner.os}}-main,sccache-${{runner.os}}-'); + core.exportVariable('SCCACHE_GHA_CACHE_TO', 'sccache-${{ runner.os }}-${{ github.ref_name }}'); + core.exportVariable('SCCACHE_GHA_CACHE_FROM', 'sccache-${{ runner.os }}-main,sccache-${{ runner.os }}-'); - name: cargo registry cache uses: actions/cache@v3 with: