name: Release
on:
push:
branches:
- master
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-latest, windows-latest, ubuntu-latest]
steps:
- name: Check out Compiler
uses: actions/checkout@v2
- name: Check out Standard Library
run: git submodule update --init
- name: Set up the Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
override: true
- name: Cache cargo registry
uses: actions/cache@v1
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo index
uses: actions/cache@v1
with:
path: ~/.cargo/git
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo build
uses: actions/cache@v1
with:
path: target
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
- name: Run library tests
uses: actions-rs/cargo@v1
with:
command: test
args: --features=test-library --lib
- name: Run bin tests
uses: actions-rs/cargo@v1
with:
command: test
args: --features=test-library,build-bin-loa --bin loa
- name: Build the binaries
uses: actions-rs/cargo@v1
with:
command: build
args: --release --features build-bin-loa,build-bin-vm
- name: Publish to crates.io
uses: actions-rs/cargo@v1
continue-on-error: true
with:
command: publish
args: --token ${{ secrets.CRATES_IO_TOKEN }}
- name: Get version
id: version
uses: ./.github/actions/version
- name: Package (Unix)
if: runner.os != 'Windows'
run: |
mkdir sdk
mkdir sdk/docs
cp -r src/bin/docs/public sdk/docs/html
cp -r std sdk/std
rm -rf sdk/std/.git
mkdir sdk/bin
cp target/release/loa target/release/loavm sdk/bin/
mkdir sdk/log
touch sdk/log/loa.log
- name: Package (Windows)
if: runner.os == 'Windows'
run: |
New-Item -ItemType "directory" -Path "sdk"
New-Item -ItemType "directory" -Path "sdk\docs"
Copy-Item -Path "src\bin\docs\public" -Destination "sdk\docs\html" -Recurse
Copy-Item -Path "std" -Destination "sdk\std" -Recurse
Remove-Item -LiteralPath "sdk\std\.git" -Force -Recurse -ErrorAction SilentlyContinue
New-Item -ItemType "directory" -Path "sdk\bin"
Copy-Item -Path @("target\release\loa.exe", "target\release\loavm.exe") -Destination "sdk\bin"
New-Item -ItemType "directory" -Path "sdk\log"
New-Item -ItemType "file" -Path "sdk\log" -Name "loa.log"
- name: Pack tarball
run: tar -czf ${{ runner.os }}-${{ github.sha }}.tar.gz sdk
- name: Upload tarball
uses: actions/upload-artifact@v1
with:
name: ${{ runner.os }}-${{ github.sha }}
path: ${{ runner.os }}-${{ github.sha }}.tar.gz
release:
runs-on: ubuntu-latest
needs: build
steps:
- name: Check out Compiler
uses: actions/checkout@v2
- name: Check out Standard Library
run: git submodule update --init
- name: Get version
id: version
uses: ./.github/actions/version
- name: Publish Standard Library
uses: ./.github/actions/publish-std
with:
version: ${{ steps.version.outputs.version }}
credentials: ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS }}
- name: Notify WebAssembly repository
uses: peter-evans/repository-dispatch@v1
with:
token: ${{ secrets.NOTIFICATIONS_TOKEN }}
repository: loalang/wasm
event-type: compiler-release
client-payload: >
{
"version": "${{ steps.version.outputs.version }}"
}
- name: Download MacOS
uses: actions/download-artifact@v1
with:
name: macOS-${{ github.sha }}
path: dist
- name: Download Linux
uses: actions/download-artifact@v1
with:
name: Linux-${{ github.sha }}
path: dist
- name: Download Windows
uses: actions/download-artifact@v1
with:
name: Windows-${{ github.sha }}
path: dist
- name: Publish MacOS
uses: actions-hub/gcloud@master
env:
PROJECT_ID: loalang
APPLICATION_CREDENTIALS: ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS }}
CLI: gsutil
with:
args: cp dist/macOS-${{ github.sha }}.tar.gz gs://cdn.loalang.xyz/${{ steps.version.outputs.version }}-x86_64-macos.tar.gz
- name: Publish Linux
uses: actions-hub/gcloud@master
env:
PROJECT_ID: loalang
APPLICATION_CREDENTIALS: ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS }}
CLI: gsutil
with:
args: cp dist/Linux-${{ github.sha }}.tar.gz gs://cdn.loalang.xyz/${{ steps.version.outputs.version }}-x86_64-linux.tar.gz
- name: Publish Windows
uses: actions-hub/gcloud@master
env:
PROJECT_ID: loalang
APPLICATION_CREDENTIALS: ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS }}
CLI: gsutil
with:
args: cp dist/Windows-${{ github.sha }}.tar.gz gs://cdn.loalang.xyz/${{ steps.version.outputs.version }}-x86_64-windows.tar.gz
- name: Calculate Checksums
run: |
echo ::set-env name=MAC_CHECKSUM::$(sha256sum dist/macOS-${{ github.sha }}.tar.gz | awk '{print $1}')
echo ::set-env name=LINUX_CHECKSUM::$(sha256sum dist/Linux-${{ github.sha }}.tar.gz | awk '{print $1}')
echo ::set-env name=WINDOWS_CHECKSUM::$(sha256sum dist/Windows-${{ github.sha }}.tar.gz | awk '{print $1}')
- name: Notify Homebrew Formula
uses: peter-evans/repository-dispatch@v1
with:
token: ${{ secrets.NOTIFICATIONS_TOKEN }}
repository: loalang/homebrew-loalang
event-type: compiler-release
client-payload: >
{
"version": "${{ steps.version.outputs.version }}",
"checksum": {
"mac": "${{ env.MAC_CHECKSUM }}",
"linux": "${{ env.LINUX_CHECKSUM }}"
}
}