Skip to content

Commit e0df888

Browse files
committed
[CI] Fixed linux-arm64 CrossCompile
1 parent a78fb9d commit e0df888

File tree

1 file changed

+21
-6
lines changed

1 file changed

+21
-6
lines changed

.github/workflows/native-api-build.yaml

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,26 +43,41 @@ jobs:
4343
- os: ubuntu-latest
4444
rid: linux-arm64
4545
binary-extension: '.so'
46+
use-docker: true
4647

4748
env:
4849
RUNTIME_IDENTIFIER: ${{ matrix.rid }}
4950

5051
steps:
51-
- name: Install Linux Dependencies
52-
if: matrix.os == 'ubuntu-latest'
53-
run: sudo apt-get update && sudo apt-get install -y clang zlib1g-dev
52+
- name: Checkout code
53+
uses: actions/checkout@v4
5454

5555
- name: Setup .NET SDK
5656
uses: actions/setup-dotnet@v4
5757
with:
5858
dotnet-version: '9.0.x'
5959

60-
- name: Checkout code
61-
uses: actions/checkout@v4
60+
- name: Install Linux Dependencies
61+
if: matrix.os == 'ubuntu-latest' && matrix.use-docker != true
62+
run: |
63+
sudo apt-get update
64+
sudo apt-get install -y clang zlib1g-dev
6265
63-
- name: Publish with Native AOT
66+
- name: Setup Docker
67+
if: matrix.use-docker == true
68+
uses: docker/setup-qemu-action@v3
69+
70+
- name: Publish with Native AOT (non-Docker)
71+
if: matrix.use-docker != true
6472
run: dotnet publish Lagrange.Core.NativeAPI -c Release -r ${{ matrix.rid }}
6573

74+
- name: Publish with Native AOT (Docker for ARM64)
75+
if: matrix.use-docker == true
76+
run: |
77+
docker run --rm --platform linux/arm64 -v $(pwd):/source -w /source \
78+
mcr.microsoft.com/dotnet/sdk:9.0 \
79+
bash -c "apt-get update && apt-get install -y clang zlib1g-dev && dotnet publish Lagrange.Core.NativeAPI -c Release -r linux-arm64"
80+
6681
- name: Upload artifacts
6782
if: github.event_name != 'pull_request'
6883
uses: actions/upload-artifact@v4

0 commit comments

Comments
 (0)