CI #149
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: | |
pull_request: | |
branches: [ bflat-main, bflat-release/7.0, bflat-release/8.0 ] | |
workflow_dispatch: | |
inputs: | |
version: | |
description: 'Encoded version (e.g. 7.0.0-preview.7.22375.6)' | |
required: true | |
buildid: | |
description: 'Build ID (e.g. 20220725.6)' | |
required: true | |
jobs: | |
build_and_test: | |
strategy: | |
matrix: | |
include: | |
- os: linux-glibc | |
container: mcr.microsoft.com/dotnet-buildtools/prereqs:cbl-mariner-2.0-cross-arm64 | |
arch: arm64 | |
vm: ubuntu-latest | |
crossrootfs: /crossrootfs/arm64 | |
rid: linux-arm64 | |
- os: linux-glibc | |
container: mcr.microsoft.com/dotnet-buildtools/prereqs:cbl-mariner-2.0-cross-amd64 | |
arch: x64 | |
vm: ubuntu-latest | |
crossrootfs: /crossrootfs/x64 | |
rid: linux-x64 | |
- os: linux-bionic | |
container: mcr.microsoft.com/dotnet-buildtools/prereqs:cbl-mariner-2.0-cross-android-amd64 | |
arch: arm64 | |
vm: ubuntu-latest | |
rid: linux-bionic-arm64 | |
- os: windows | |
arch: x64 | |
vm: windows-latest | |
- os: windows | |
arch: arm64 | |
vm: windows-latest | |
runs-on: ${{ matrix.vm }} | |
name: Build and test ${{ matrix.os }} ${{ matrix.arch }} | |
container: ${{ matrix.container }} | |
steps: | |
- uses: actions/checkout@v1 | |
- name: Build the product (Linux) | |
env: | |
ROOTFS_DIR: ${{ matrix.crossrootfs }} | |
run: ./build.sh clr.nativeaotlibs+clr.nativeaotruntime+clr.alljits+clr.tools+libs.native+libs.sfx -c Release -arch ${{ matrix.arch }} /p:CrossBuild=true -ci /p:OfficialBuildId="${{ github.event.inputs.buildid }}" /p:GenerateDocumentationFile=false | |
if: ${{ matrix.vm == 'ubuntu-latest' && matrix.os != 'linux-bionic' }} | |
- name: Build the product (Linux Bionic) | |
run: ./build.sh clr.nativeaotlibs+clr.nativeaotruntime+libs.native+libs.sfx -c Release -os ${{ matrix.os }} -arch ${{ matrix.arch }} -ci /p:OfficialBuildId="${{ github.event.inputs.buildid }}" /p:GenerateDocumentationFile=false | |
if: ${{ matrix.vm == 'ubuntu-latest' && matrix.os == 'linux-bionic' }} | |
- name: Build the product (Windows) | |
shell: cmd | |
run: build.cmd clr.nativeaotlibs+clr.nativeaotruntime+clr.alljits+clr.tools+libs.native+libs.sfx -c Release -arch ${{ matrix.arch }} -ci /p:OfficialBuildId="${{ github.event.inputs.buildid }}" /p:GenerateDocumentationFile=false | |
if: ${{ matrix.vm == 'windows-latest' }} | |
- name: Package compiler | |
if: ${{ matrix.os == 'linux-glibc' && matrix.arch == 'x64' && github.event.inputs.version != '' }} | |
run: ./dotnet.sh pack bflat/pack/ILCompiler.Compiler.nuproj -p:Version=${{ github.event.inputs.version }} -p:IntermediateOutputPath=$GITHUB_WORKSPACE/artifacts/bin/coreclr/linux.x64.Release/ilc/ -p:RepositoryUrl=https://github.com/bflattened/runtime | |
- name: Archive compiler package | |
if: ${{ matrix.os == 'linux-glibc' && matrix.arch == 'x64' && github.event.inputs.version != '' }} | |
uses: actions/upload-artifact@v2 | |
with: | |
name: nuget | |
path: bflat/pack/bin/Release/BFlat.Compiler.${{ github.event.inputs.version }}.nupkg | |
- name: ZIP native compiler (Linux) | |
run: | | |
mkdir artifacts/bflat-compiler-native | |
cp -t artifacts/bflat-compiler-native artifacts/bin/coreclr/linux.${{ matrix.arch }}.Release/ilc/libclrjit_* artifacts/bin/coreclr/linux.${{ matrix.arch }}.Release/ilc/libjitinterface_* artifacts/bin/coreclr/linux.${{ matrix.arch }}.Release/ilc/libobjwriter* | |
cp -t artifacts/bflat-compiler-native THIRD-PARTY-NOTICES.TXT artifacts/bin/coreclr/linux.${{ matrix.arch }}.Release/build/WindowsAPIs.txt | |
./dotnet.sh run --project bflat/zip/zip.csproj -- artifacts/bflat-compiler-native-${{ matrix.os }}-${{ matrix.arch }}.zip artifacts/bflat-compiler-native | |
if: ${{ matrix.vm == 'ubuntu-latest' && matrix.os != 'linux-bionic' }} | |
- name: ZIP native compiler (Windows) | |
run: | | |
mkdir artifacts\bflat-compiler-native | |
copy artifacts\bin\coreclr\Windows.${{ matrix.arch }}.Release\ilc\clrjit_* artifacts\bflat-compiler-native\ | |
copy artifacts\bin\coreclr\Windows.${{ matrix.arch }}.Release\ilc\jitinterface_* artifacts\bflat-compiler-native\ | |
copy artifacts\bin\coreclr\Windows.${{ matrix.arch }}.Release\ilc\objwriter* artifacts\bflat-compiler-native\ | |
copy THIRD-PARTY-NOTICES.TXT artifacts\bflat-compiler-native\ | |
copy artifacts\bin\coreclr\Windows.${{ matrix.arch }}.Release\build\WindowsAPIs.txt artifacts\bflat-compiler-native\ | |
pushd artifacts\bflat-compiler-native\ | |
Compress-Archive * $Env:GITHUB_WORKSPACE\artifacts\bflat-compiler-native-${{ matrix.os }}-${{ matrix.arch }}.zip | |
popd | |
if: ${{ matrix.vm == 'windows-latest' }} | |
- name: Archive native compiler artifacts | |
uses: actions/upload-artifact@v2 | |
with: | |
name: native-compiler | |
path: artifacts/bflat-compiler-native-${{ matrix.os }}-${{ matrix.arch }}.zip | |
if: ${{ matrix.os != 'linux-bionic' }} | |
- name: ZIP libs (Linux) | |
run: | | |
mkdir artifacts/bflat-libs | |
cp -t artifacts/bflat-libs artifacts/bin/microsoft.netcore.app.runtime.${{ matrix.rid }}/Release/runtimes/${{ matrix.rid }}/lib/net8.0/* | |
cp -t artifacts/bflat-libs artifacts/bin/microsoft.netcore.app.runtime.${{ matrix.rid }}/Release/runtimes/${{ matrix.rid }}/native/*.Native.*a | |
cp -t artifacts/bflat-libs artifacts/bin/coreclr/linux.${{ matrix.arch }}.Release/aotsdk/* | |
./dotnet.sh run --project bflat/zip/zip.csproj -- artifacts/bflat-libs-${{ matrix.os }}-${{ matrix.arch }}.zip artifacts/bflat-libs | |
if: ${{ matrix.vm == 'ubuntu-latest' }} | |
- name: ZIP libs (Windows) | |
run: | | |
mkdir artifacts\bflat-libs | |
copy artifacts\bin\microsoft.netcore.app.runtime.win-${{ matrix.arch }}\Release\runtimes\win-${{ matrix.arch }}\lib\net8.0\* artifacts\bflat-libs\ | |
copy artifacts\bin\coreclr\Windows.${{ matrix.arch }}.Release\aotsdk\* artifacts\bflat-libs\ | |
pushd artifacts\bflat-libs\ | |
Compress-Archive * $Env:GITHUB_WORKSPACE\artifacts\bflat-libs-${{ matrix.os }}-${{ matrix.arch }}.zip | |
popd | |
if: ${{ matrix.vm == 'windows-latest' }} | |
- name: Archive libs | |
uses: actions/upload-artifact@v2 | |
with: | |
name: libs | |
path: artifacts/bflat-libs-${{ matrix.os }}-${{ matrix.arch }}.zip | |
- name: ZIP refs | |
if: ${{ matrix.os == 'linux-glibc' && matrix.arch == 'x64' }} | |
run: | | |
mkdir artifacts/bflat-refs | |
cp -t artifacts/bflat-refs artifacts/bin/microsoft.netcore.app.ref/ref/net8.0/*.dll | |
./dotnet.sh run --project bflat/zip/zip.csproj -- artifacts/bflat-refs.zip artifacts/bflat-refs | |
- name: Archive refs | |
if: ${{ matrix.os == 'linux-glibc' && matrix.arch == 'x64' }} | |
uses: actions/upload-artifact@v2 | |
with: | |
name: refs | |
path: artifacts/bflat-refs.zip | |
- name: Free up disk space for test run (Windows) | |
shell: cmd | |
run: | | |
rmdir /S /Q artifacts\bflat-libs | |
rmdir /S /Q artifacts\bflat-compiler-native | |
rmdir /S /Q artifacts\obj\coreclr | |
del artifacts\bflat-libs-${{ matrix.os }}-${{ matrix.arch }}.zip | |
del artifacts\bflat-compiler-native-${{ matrix.os }}-${{ matrix.arch }}.zip | |
if: ${{ matrix.vm == 'windows-latest' && github.event.inputs.version == '' && matrix.arch != 'arm64' }} | |
- name: Build tests (Linux) | |
run: ./src/tests/build.sh nativeaot release ${{ matrix.arch }} 'tree nativeaot/SmokeTests' | |
if: ${{ matrix.vm == 'ubuntu-latest' && github.event.inputs.version == '' && matrix.arch != 'arm64' }} | |
- name: Build tests (Windows) | |
shell: cmd | |
run: src\tests\build.cmd nativeaot release ${{ matrix.arch }} tree nativeaot\SmokeTests | |
if: ${{ matrix.vm == 'windows-latest' && github.event.inputs.version == '' && matrix.arch != 'arm64' }} | |
- name: Run tests (Linux) | |
run: ./src/tests/run.sh --runnativeaottests release ${{ matrix.arch }} | |
if: ${{ matrix.vm == 'ubuntu-latest' && github.event.inputs.version == '' && matrix.arch != 'arm64' }} | |
- name: Run tests (Windows) | |
shell: cmd | |
run: src\tests\run.cmd runnativeaottests release ${{ matrix.arch }} | |
if: ${{ matrix.vm == 'windows-latest' && github.event.inputs.version == '' && matrix.arch != 'arm64' }} | |
publish: | |
needs: build_and_test | |
runs-on: ubuntu-latest | |
name: Publish release and NuGet | |
if: ${{ github.event.inputs.version != '' && github.actor == 'MichalStrehovsky' }} | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v2 | |
- name: Create tag | |
run: | | |
git tag v${{ github.event.inputs.version }} | |
git push origin v${{ github.event.inputs.version }} | |
- name: Download all artifacts | |
uses: actions/download-artifact@v2 | |
- name: Publish compiler package | |
run: ./dotnet.sh nuget push nuget/BFlat.Compiler.${{ github.event.inputs.version }}.nupkg -s https://nuget.pkg.github.com/bflattened/index.json --api-key ${{ secrets.GITHUB_TOKEN }} | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: v${{ github.event.inputs.version }} | |
release_name: v${{ github.event.inputs.version }} | |
draft: false | |
prerelease: false | |
- name: Upload refs | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: refs/bflat-refs.zip | |
asset_name: bflat-refs.zip | |
asset_content_type: application/zip | |
- name: Upload native compiler (windows-x64) | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: native-compiler/bflat-compiler-native-windows-x64.zip | |
asset_name: bflat-compiler-native-windows-x64.zip | |
asset_content_type: application/zip | |
- name: Upload native compiler (linux-glibc-x64) | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: native-compiler/bflat-compiler-native-linux-glibc-x64.zip | |
asset_name: bflat-compiler-native-linux-glibc-x64.zip | |
asset_content_type: application/zip | |
- name: Upload libs (windows-x64) | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: libs/bflat-libs-windows-x64.zip | |
asset_name: bflat-libs-windows-x64.zip | |
asset_content_type: application/zip | |
- name: Upload libs (linux-glibc-x64) | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: libs/bflat-libs-linux-glibc-x64.zip | |
asset_name: bflat-libs-linux-glibc-x64.zip | |
asset_content_type: application/zip | |
- name: Upload native compiler (windows-arm64) | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: native-compiler/bflat-compiler-native-windows-arm64.zip | |
asset_name: bflat-compiler-native-windows-arm64.zip | |
asset_content_type: application/zip | |
- name: Upload native compiler (linux-glibc-arm64) | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: native-compiler/bflat-compiler-native-linux-glibc-arm64.zip | |
asset_name: bflat-compiler-native-linux-glibc-arm64.zip | |
asset_content_type: application/zip | |
- name: Upload libs (windows-arm64) | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: libs/bflat-libs-windows-arm64.zip | |
asset_name: bflat-libs-windows-arm64.zip | |
asset_content_type: application/zip | |
- name: Upload libs (linux-glibc-arm64) | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: libs/bflat-libs-linux-glibc-arm64.zip | |
asset_name: bflat-libs-linux-glibc-arm64.zip | |
asset_content_type: application/zip | |
- name: Upload libs (linux-bionic-arm64) | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: libs/bflat-libs-linux-bionic-arm64.zip | |
asset_name: bflat-libs-linux-bionic-arm64.zip | |
asset_content_type: application/zip |