Merge pull request #89 from chmln/ci

New CI
This commit is contained in:
Gregory 2020-07-03 11:59:06 -04:00 committed by GitHub
commit d3aa277628
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 98 additions and 37 deletions

59
.github/workflows/publish.yml vendored Normal file
View file

@ -0,0 +1,59 @@
name: Publish
on:
push:
tags:
- '*'
jobs:
publish:
name: ${{ matrix.target }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
- os: ubuntu-latest
target: x86_64-unknown-linux-musl
- os: windows-latest
target: x86_64-pc-windows-msvc
- os: macos-latest
target: x86_64-apple-darwin
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
fetch-depth: 1
- name: Set the version
id: version
run: echo ::set-output name=VERSION::${GITHUB_REF#refs/tags/}
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
target: ${{ matrix.target }}
- name: Build
run: cargo build --release --locked
- name: Strip binary
if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest'
run: strip target/release/sd
- name: Upload binaries to release
uses: svenstaro/upload-release-action@v1-release
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: target/release/sd
asset_name: sd-${{ steps.version.outputs.VERSION }}-${{ matrix.target }}
tag: ${{ github.ref }}

39
.github/workflows/test.yml vendored Normal file
View file

@ -0,0 +1,39 @@
name: Test
on: [pull_request]
jobs:
test:
name: ${{ matrix.target }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
- os: ubuntu-latest
target: x86_64-unknown-linux-musl
- os: windows-latest
target: x86_64-pc-windows-msvc
- os: macos-latest
target: x86_64-apple-darwin
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
fetch-depth: 1
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
target: ${{ matrix.target }}
- name: Test
run: cargo test

View file

@ -1,37 +0,0 @@
trigger:
branches:
include: ['*']
tags:
include: ['*']
resources:
repositories:
- repository: rust_pipelines
type: github
name: xoac/rust-azure-pipelines
ref: refs/heads/master
endpoint: githubConnection
stages:
- stage: test
displayName: "Test"
jobs:
- template: ci/jobs/cargo-test.yaml@rust_pipelines
#condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/v'))
- stage: build
displayName: "Build"
jobs:
- template: ci/scenarios/builds.yml@rust_pipelines
dependsOn:
- test
# Deploy binaries to github only if tags start with `v` for example `v0.1.5`
- stage: deploy
displayName: "Deploy"
dependsOn:
- build
jobs:
- template: ci/scenarios/github/release.yml@rust_pipelines
parameters:
job_condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/v'))
gitHubConnection: githubConnection