{
"name": "All",
"on": [
"push",
"pull_request"
],
"jobs": {
"test": {
"strategy": {
"matrix": {
"include": [
{
"os": "ubuntu-latest",
"target": "x86_64-unknown-linux-gnu"
},
{
"os": "macOS-11",
"target": "x86_64-apple-darwin"
},
{
"os": "windows-latest",
"target": "x86_64-pc-windows-msvc"
}
]
}
},
"runs-on": "${{ matrix.os }}",
"steps": [
{
"name": "Setup | Checkout",
"uses": "actions/checkout@v2"
},
{
"name": "Setup | Install Dependencies",
"if": "matrix.os == 'ubuntu-latest'",
"env": {
"DEBIAN_FRONTEND": "noninteractive"
},
"run": "sudo apt-get update && sudo apt-get install --no-install-recommends -y build-essential pkg-config libasound2-dev"
},
{
"name": "Setup | Rust",
"uses": "actions-rs/toolchain@v1.0.7",
"with": {
"toolchain": "stable",
"override": true,
"profile": "minimal",
"target": "${{ matrix.target }}"
}
},
{
"name": "Check | Tests",
"uses": "actions-rs/cargo@v1.0.3",
"with": {
"command": "test",
"args": "--target ${{ matrix.target }}"
}
}
]
},
"build": {
"name": "Build Release Binaries",
"needs": "test",
"if": "github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')",
"continue-on-error": true,
"strategy": {
"fail-fast": false,
"matrix": {
"include": [
{
"target": "x86_64-unknown-linux-gnu",
"name": "midnote-x86_64-linux.tar.gz",
"os": "ubuntu-latest"
},
{
"target": "x86_64-pc-windows-msvc",
"name": "midnote-x86_64-windows.zip",
"os": "windows-latest"
},
{
"target": "x86_64-apple-darwin",
"name": "midnote-x86_64-osx.tar.gz",
"os": "macos-11"
},
{
"target": "aarch64-apple-darwin",
"name": "midnote-aarch64-osx.tar.gz",
"os": "macos-11"
},
{
"target": "i686-pc-windows-msvc",
"name": "midnote-i686-windows.zip",
"os": "windows-latest"
},
{
"target": "aarch64-unknown-linux-gnu",
"name": "midnote-aarch64-linux.tar.gz",
"os": "ubuntu-latest"
},
{
"target": "armv7-unknown-linux-gnueabihf",
"name": "midnote-armv7-linux.tar.gz",
"os": "ubuntu-latest"
}
]
}
},
"runs-on": "${{ matrix.os }}",
"steps": [
{
"name": "Setup | Checkout",
"uses": "actions/checkout@v2"
},
{
"name": "Setup | Cache Cargo",
"uses": "actions/cache@v2.1.6",
"with": {
"path": "~/.cargo/registry\n~/.cargo/git\n",
"key": "${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}"
}
},
{
"name": "Setup | Install Dependencies",
"if": "matrix.target == 'x86_64-unknown-linux-gnu'",
"env": {
"DEBIAN_FRONTEND": "noninteractive"
},
"run": "sudo apt-get update && sudo apt-get install --no-install-recommends -y build-essential pkg-config libasound2-dev"
},
{
"name": "Setup | Rust",
"uses": "actions-rs/toolchain@v1.0.7",
"with": {
"toolchain": "stable",
"override": true,
"profile": "minimal",
"target": "${{ matrix.target }}"
}
},
{
"name": "Build | Build",
"uses": "actions-rs/cargo@v1.0.3",
"with": {
"command": "build",
"args": "--release --target ${{ matrix.target }}",
"use-cross": "${{ matrix.os == 'ubuntu-latest' && matrix.target != 'x86_64-unknown-linux-gnu' }}"
}
},
{
"name": "PostBuild | Prepare",
"if": "matrix.os != 'windows-latest'",
"run": "cd target/${{ matrix.target }}/release\nstrip midnote || true\ntar czvf ../../../${{ matrix.name }} midnote\ncd -"
},
{
"if": "matrix.os == 'windows-latest'",
"name": "PostBuild | Prepare",
"run": "cd target/${{ matrix.target }}/release\n7z a ../../../${{ matrix.name }} midnote.exe\ncd -"
},
{
"name": "Deploy | Upload Artifacts",
"uses": "actions/upload-artifact@v2",
"with": {
"name": "${{ matrix.name }}",
"path": "${{ matrix.name }}"
}
}
]
},
"release": {
"name": "Create GitHub Release",
"needs": "build",
"if": "github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')",
"runs-on": "ubuntu-latest",
"steps": [
{
"name": "Setup | Checkout",
"uses": "actions/checkout@v2.3.4",
"with": {
"fetch-depth": 0
}
},
{
"name": "Setup | go",
"uses": "actions/setup-go@v2",
"with": {
"go-version": "^1.15.7"
}
},
{
"name": "Setup | Artifacts",
"uses": "actions/download-artifact@v2"
},
{
"name": "Setup | Release notes",
"run": "GO111MODULE=on go install github.com/git-chglog/git-chglog/cmd/git-chglog@0.9.1\ngit-chglog -c .github/chglog/release.yml $(git describe --tags) > RELEASE.md\n"
},
{
"name": "Deploy | Publish",
"uses": "softprops/action-gh-release@v1",
"with": {
"files": "midnote-*/midnote-*",
"body_path": "RELEASE.md"
}
}
]
},
"publish": {
"name": "Publish to crates.io",
"if": "github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')",
"needs": "test",
"runs-on": "windows-latest",
"steps": [
{
"name": "Setup | Checkout",
"uses": "actions/checkout@v2.3.4"
},
{
"name": "Setup | Rust",
"uses": "actions-rs/toolchain@v1.0.7",
"with": {
"toolchain": "stable",
"override": true,
"profile": "minimal"
}
},
{
"name": "Deploy | Publish",
"uses": "actions-rs/cargo@v1.0.3",
"with": {
"command": "publish",
"args": "--token ${{ secrets.CRATES_IO_TOKEN }} --allow-dirty"
}
}
]
}
}
}