Fixing CodeGenTest #222
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 | |
# Controls when the workflow will run | |
on: | |
# Triggers the workflow on push | |
push: | |
paths-ignore: | |
- "docs/**" | |
- "ci/**" | |
env: | |
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) | |
BUILD_TYPE: Release | |
BUILD_DIR: build | |
LLVM_VERSION: 11.1.0 | |
WIN_FILE: win-x64.zip | |
MACOS_FILE: macos-x86_64.tar.gz | |
LINUX_FILE: linux-x86_64.tar.gz | |
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
jobs: | |
# This workflow contains multiple "build" jobs | |
build: | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ ubuntu-latest, macos-latest, windows-latest ] | |
runs-on: ${{ matrix.os }} | |
outputs: | |
winversion: ${{ steps.version-win.outputs.version }} | |
version: ${{ steps.version.outputs.version }} | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Dependencies | |
if: matrix.os == 'ubuntu-latest' | |
run: sudo apt update && sudo apt-get -y install binutils-dev libdw-dev libdwarf-dev | |
- name: Configure | |
run: cmake -E make_directory ${{env.BUILD_DIR}} | |
- name: Set Build Type | |
shell: bash | |
if: startsWith(github.ref, 'refs/heads/release/') | |
run: echo "BUILD_TYPE=RelWithDebInfo" >> $GITHUB_ENV | |
- name: Build | |
working-directory: ${{github.workspace}}/${{env.BUILD_DIR}} | |
run: | | |
cmake .. -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_VERBOSE_MAKEFILE=ON | |
cmake --build . --config ${{env.BUILD_TYPE}} | |
- name: Test (Unix) | |
if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest' | |
working-directory: ${{github.workspace}}/${{env.BUILD_DIR}}/test | |
run: ./fly_test | |
- name: Test (Windows) | |
if: matrix.os == 'windows-latest' | |
working-directory: ${{github.workspace}}\${{env.BUILD_DIR}}\test\${{env.BUILD_TYPE}} | |
run: .\fly_test.exe --gtest_filter='-CmdTest.EmitOut' | |
- name: Read Version (Unix) | |
id: version | |
if: github.ref == 'refs/heads/main' && (matrix.os == 'ubuntu-20.04' || matrix.os == 'macos-latest') | |
run: echo "::set-output name=version::$(${{github.workspace}}/${{env.BUILD_DIR}}/src/fly --version-short)" | |
- name: Read Version (Windows) | |
id: version-win | |
if: github.ref == 'refs/heads/main' && matrix.os == 'windows-latest' | |
working-directory: ${{github.workspace}}\${{env.BUILD_DIR}}\src\${{env.BUILD_TYPE}} | |
run: | | |
echo "::set-output name=version::$(.\fly.exe --version-short)" | |
- name: Linux Packaging | |
if: github.ref == 'refs/heads/main' && matrix.os == 'ubuntu-20.04' | |
working-directory: ${{github.workspace}}/${{env.BUILD_DIR}}/src | |
run: tar -czvf ../fly-${{ steps.version.outputs.version }}-${{env.LINUX_FILE}} fly | |
- name: Windows Packaging | |
if: github.ref == 'refs/heads/main' && matrix.os == 'windows-latest' | |
working-directory: ${{github.workspace}}\${{env.BUILD_DIR}}\src\${{env.BUILD_TYPE}} | |
run: 7z a ..\..\fly-${{ steps.version-win.outputs.version }}-${{env.WIN_FILE}} fly.exe | |
- name: macOS Packaging | |
if: github.ref == 'refs/heads/main' && matrix.os == 'macos-latest' | |
working-directory: ${{github.workspace}}/${{env.BUILD_DIR}}/src | |
run: tar -czvf ../fly-${{ steps.version.outputs.version }}-${{env.MACOS_FILE}} fly | |
- uses: actions/upload-artifact@v2 | |
if: github.ref == 'refs/heads/main' && matrix.os == 'ubuntu-latest' | |
with: | |
name: linux-artifact | |
path: ${{github.workspace}}/${{env.BUILD_DIR}}/fly-${{ steps.version.outputs.version }}-${{env.LINUX_FILE}} | |
- uses: actions/upload-artifact@v2 | |
if: github.ref == 'refs/heads/main' && matrix.os == 'windows-latest' | |
with: | |
name: windows-artifact | |
path: ${{github.workspace}}/${{env.BUILD_DIR}}/fly-${{ steps.version-win.outputs.version }}-${{env.WIN_FILE}} | |
- uses: actions/upload-artifact@v2 | |
if: github.ref == 'refs/heads/main' && matrix.os == 'macos-latest' | |
with: | |
name: macos-artifact | |
path: ${{github.workspace}}/${{env.BUILD_DIR}}/fly-${{ steps.version.outputs.version }}-${{env.MACOS_FILE}} | |
release: | |
needs: [build] | |
# The type of runner that the job will run on | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
shell: bash | |
# Steps represent a sequence of tasks that will be executed as part of the job | |
steps: | |
- uses: actions/download-artifact@v2 | |
if: github.ref == 'refs/heads/main' | |
with: | |
name: linux-artifact | |
- uses: actions/download-artifact@v2 | |
if: github.ref == 'refs/heads/main' | |
with: | |
name: windows-artifact | |
- uses: actions/download-artifact@v2 | |
if: github.ref == 'refs/heads/main' | |
with: | |
name: macos-artifact | |
- name: Release | |
if: github.ref == 'refs/heads/main' | |
uses: actions/create-release@v1 | |
id: create_release | |
with: | |
draft: false | |
prerelease: true | |
release_name: Fly ${{ needs.build.outputs.version }} | |
tag_name: v${{ needs.build.outputs.version }} | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
- name: Linux Upload | |
if: github.ref == 'refs/heads/main' | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: fly-${{ needs.build.outputs.version }}-${{env.LINUX_FILE}} | |
asset_name: fly-${{ needs.build.outputs.version }}-${{env.LINUX_FILE}} | |
asset_content_type: application/gzip | |
- name: Windows Upload | |
if: github.ref == 'refs/heads/main' | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: fly-${{ needs.build.outputs.version }}-${{env.WIN_FILE}} | |
asset_name: fly-${{ needs.build.outputs.version }}-${{env.WIN_FILE}} | |
asset_content_type: application/gzip | |
- name: macOS Upload | |
if: github.ref == 'refs/heads/main' | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: fly-${{ needs.build.outputs.version }}-${{env.MACOS_FILE}} | |
asset_name: fly-${{ needs.build.outputs.version }}-${{env.MACOS_FILE}} | |
asset_content_type: application/gzip |