CI: Add workflow file to build the compiler #22
Workflow file for this run
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 compiler for linux and mac | |
on: [pull_request, push, workflow_dispatch] | |
jobs: | |
build: | |
name: Build zig | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
include: | |
- target: x86_64-linux-gnu | |
os: ubuntu-latest | |
- target: aarch64-linux-gnu | |
os: ubuntu-latest | |
- target: x86_64-macos-none | |
os: macos-latest | |
- target: aarch64-macos-none | |
os: macos-latest | |
fail-fast: false | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Install coreutils | |
run: | | |
brew update && brew install coreutils | |
if: matrix.os == 'macos-latest' | |
shell: bash | |
- name: Build | |
run: ./build ${{ matrix.target }} baseline | |
shell: bash | |
- name: Create tarball | |
run: tar -C out -cjf zig-${{ matrix.target }}.tar.bz2 zig-${{ matrix.target }}-baseline | |
shell: bash | |
- name: Upload ${{ matrix.target }} tarball | |
uses: actions/upload-artifact@v3 | |
with: | |
name: zig-${{ matrix.target }}.tar.bz2 | |
path: zig-${{ matrix.target }}.tar.bz2 | |
create_release: | |
name: Create release | |
needs: build | |
runs-on: ubuntu-latest | |
if: ${{ startsWith(github.ref, 'refs/tags/solana-v') }} | |
outputs: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
steps: | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.ref }} | |
release_name: Release ${{ github.ref }} | |
draft: false | |
prerelease: false | |
upload_release: | |
name: Upload Release Assets | |
needs: create_release | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
include: | |
- target: x86_64-linux-gnu | |
- target: aarch64-linux-gnu | |
- target: x86_64-macos-none | |
- target: aarch64-macos-none | |
if: ${{ startsWith(github.ref, 'refs/tags/solana-v') }} | |
steps: | |
- name: Download tarball | |
uses: actions/download-artifact@v3 | |
with: | |
name: zig-${{ matrix.target }}.tar.bz2 | |
- name: Release tarball | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ needs.create_release.outputs.upload_url }} | |
asset_path: zig-${{ matrix.target }}.tar.bz2 | |
asset_name: zig-${{ matrix.target }}.tar.bz2 | |
asset_content_type: application/zip |