Merge pull request #27 from wasmerio/support-loongarch #124
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: Build | |
on: [push] | |
jobs: | |
build: | |
name: Build | |
strategy: | |
matrix: | |
target: | |
- id: 'linux-amd64' | |
os: 'ubuntu-20.04' | |
tar_extra_args: '' | |
- id: 'linux-aarch64' | |
os: "ubuntu-latest" | |
# os: ['self-hosted', 'linux', 'ARM64'] | |
- id: 'linux-riscv64' | |
os: "ubuntu-latest" | |
# os: ['self-hosted', 'linux', 'RISCV64'] | |
- id: 'darwin-amd64' | |
os: 'macos-13' | |
tar_extra_args: '' | |
- id: 'darwin-aarch64' | |
os: 'macos-latest' | |
tar_extra_args: '' | |
# When unpacking an archive on Windows, the symlinks can't be | |
# created unless the target path already exists. This causes | |
# problems when the linked file is ordered after the link | |
- id: 'windows-amd64' | |
os: 'windows-2022' | |
# When unpacking an archive on Windows, the symlinks can't be | |
# created unless the target path already exists. This causes | |
# problems when the linked file is ordered after the link | |
# inside the archive. Dereferencing the files when packing them | |
# adds an additional copy per link, but it reliably works and | |
# the additional size is not too large on Windows. | |
tar_extra_args: '--dereference' | |
llvm_version: ['18.x'] | |
llvm_repo_url: ['https://github.com/llvm/llvm-project.git'] | |
fail-fast: true | |
runs-on: ${{ matrix.target.os }} | |
steps: | |
- name: Check out the code | |
uses: actions/checkout@v3 | |
- name: Install `ninja` on Ubuntu | |
if: startsWith(matrix.target.id, 'linux-') | |
shell: bash | |
run: | | |
sudo apt-get install ninja-build -y | |
- name: Install cross-compilation tools | |
if: matrix.target.id == 'linux-aarch64' | |
shell: bash | |
run: | | |
sudo apt-get install gcc-12-aarch64-linux-gnu g++-12-aarch64-linux-gnu gcc-12-multilib binutils-aarch64-linux-gnu libgcc-12-dev-arm64-cross libstdc++6-arm64-cross -y | |
- name: Install cross-compilation tools | |
if: matrix.target.id == 'linux-riscv64' | |
shell: bash | |
run: | | |
sudo apt-get install gcc-12-riscv64-linux-gnu g++-12-riscv64-linux-gnu gcc-12-multilib binutils-riscv64-linux-gnu libgcc-12-dev-riscv64-cross libstdc++6-riscv64-cross -y | |
- name: Install `ninja` on macOS | |
if: startsWith(matrix.target.id, 'darwin-') | |
shell: bash | |
run: | | |
brew install ninja | |
#- name: Install `ninja` on Windows | |
# if: startsWith(matrix.target.id, 'windows-') | |
# shell: bash | |
# run: | | |
# choco install ninja | |
- name: Setup MSVC (Windows) | |
uses: ilammy/msvc-dev-cmd@v1 | |
if: matrix.target.id == 'windows-amd64' | |
- name: Build | |
if: matrix.target.id != 'windows-amd64' && matrix.target.id != 'linux-aarch64' && matrix.target.id != 'linux-riscv64' | |
shell: bash | |
run: | | |
./build.sh ${{ matrix.llvm_version }} ${{ matrix.llvm_repo_url }} | |
- name: Build (linux-aarch64) | |
if: matrix.target.id == 'linux-aarch64' | |
shell: bash | |
run: | | |
./build.sh ${{ matrix.llvm_version }} ${{ matrix.llvm_repo_url }} aarch64 | |
- name: Build (linux-aarch64) | |
if: matrix.target.id == 'linux-riscv64' | |
shell: bash | |
run: | | |
./build.sh ${{ matrix.llvm_version }} ${{ matrix.llvm_repo_url }} riscv64 | |
- name: Build (Windows) | |
if: matrix.target.id == 'windows-amd64' | |
#shell: | | |
# powershell -Command "& '{0}'" | |
run: | | |
./build.ps1 ${{ matrix.llvm_version }} ${{ matrix.llvm_repo_url }} | |
- name: Inspect | |
shell: bash | |
run: | | |
PATH=llvm-project/build/destdir/bin:llvm-project/build/destdir/usr/bin:$PATH llvm-config --version | |
PATH=llvm-project/build/destdir/bin:llvm-project/build/destdir/usr/bin:$PATH clang --version | |
- name: Zip | |
shell: bash | |
run: | | |
mkdir -p dist | |
tar --directory llvm-project/build/destdir --create --xz --verbose ${{ matrix.target.tar_extra_args }} --file dist/llvm.tar.xz . | |
ls -lh dist/llvm.tar.xz | |
- name: Upload Artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ matrix.target.id }}-${{ matrix.llvm_version }} | |
path: dist | |
if-no-files-found: error | |
retention-days: 1 | |
release: | |
name: Release | |
runs-on: ubuntu-latest | |
# if: startsWith(github.ref, 'refs/tags/') | |
needs: [build] | |
strategy: | |
matrix: | |
llvm_version: ['18.x'] | |
steps: | |
- name: Download the Artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
path: artifacts | |
- name: Inspect | |
shell: bash | |
run: | | |
ls -laGiR ./* | |
- name: Create Release | |
id: create_release | |
uses: ncipollo/release-action@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag: ${{ matrix.llvm_version }} | |
name: Release ${{ matrix.llvm_version }} | |
allowUpdates: true | |
draft: false | |
prerelease: false | |
- name: Upload Release Asset Linux | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: artifacts/linux-amd64-${{matrix.llvm_version}}/llvm.tar.xz | |
asset_name: llvm-linux-amd64.tar.xz | |
asset_content_type: application/gzip | |
- name: Upload Release Asset Linux (ARM64) | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: artifacts/linux-aarch64-${{matrix.llvm_version}}/llvm.tar.xz | |
asset_name: llvm-linux-aarch64.tar.xz | |
asset_content_type: application/gzip | |
- name: Upload Release Asset Linux (RISCV64) | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: artifacts/linux-riscv64-${{matrix.llvm_version}}/llvm.tar.xz | |
asset_name: llvm-linux-riscv64.tar.xz | |
asset_content_type: application/gzip | |
- name: Upload Release Asset Darwin | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: artifacts/darwin-amd64-${{matrix.llvm_version}}/llvm.tar.xz | |
asset_name: llvm-darwin-amd64.tar.xz | |
asset_content_type: application/gzip | |
- name: Upload Release Asset Darwin (aarch64) | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: artifacts/darwin-aarch64-${{matrix.llvm_version}}/llvm.tar.xz | |
asset_name: llvm-darwin-aarch64.tar.xz | |
asset_content_type: application/gzip | |
- name: Upload Release Asset Windows | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: artifacts/windows-amd64-${{matrix.llvm_version}}/llvm.tar.xz | |
asset_name: llvm-windows-amd64.tar.xz | |
asset_content_type: application/gzip |