unicorn/.github/workflows/Crate-publishing.yml
2021-11-10 07:51:07 +01:00

83 lines
1.9 KiB
YAML

name: Crate 📦 Distribution
on:
push:
paths-ignore:
- ".gitignore"
- "docs/**"
- "README"
- "CREDITS.TXT"
- "COPYING_GLIB"
- "COPYING.LGPL2"
- "AUTHORS.TXT"
- "CHANGELOG"
- "COPYING"
pull_request:
env:
UNICORN_VERSION: dev
jobs:
build:
runs-on: ${{ matrix.config.os }}
name: ${{ matrix.config.name }}
strategy:
fail-fast: false
matrix:
config:
- {
os: windows-latest,
arch: x64,
name: 'Windows x86_64'
}
- {
os: windows-latest,
arch: x32,
name: 'Windows x86'
}
- {
os: ubuntu-latest,
arch: x64,
name: 'Ubuntu x86_64'
}
- {
os: macos-latest,
arch: x64,
name: 'macOS x86_64'
}
steps:
- uses: actions/checkout@v2
- name: '🛠️ Set up Rust'
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
default: true
- name: '🛠️ Add msbuild to PATH'
if: contains(matrix.config.os, 'win')
uses: microsoft/setup-msbuild@v1.0.3
with:
vs-version: '16.5'
- name: '🛠️ Win build dependencies'
if: contains(matrix.config.os, 'win')
shell: bash
run: |
choco install ninja cmake
- name: '🚧 Cargo test'
if: "!startsWith(github.ref, 'refs/tags')"
env:
UNICORN_LOCAL: uc
run: |
cd bindings/rust && cargo test
- name: '📦 Cargo Publish'
if: startsWith(github.ref, 'refs/tags') && contains(matrix.config.os, 'ubuntu')
env:
TOKEN: ${{ secrets.cratesio_token }}
UNICORN_LOCAL: uc
run: |
cd bindings/rust && cargo login $TOKEN && cargo test && cargo publish