ci: Publish crate to Crates.io with CI
This commit is contained in:
parent
9a2af45835
commit
616b50b4e3
|
@ -4,6 +4,8 @@ trigger:
|
||||||
tags:
|
tags:
|
||||||
include: ["*"]
|
include: ["*"]
|
||||||
|
|
||||||
|
stages:
|
||||||
|
- stage: Checks
|
||||||
jobs:
|
jobs:
|
||||||
# Check formatting
|
# Check formatting
|
||||||
- template: ci/rustfmt.yml
|
- template: ci/rustfmt.yml
|
||||||
|
@ -23,15 +25,12 @@ jobs:
|
||||||
name: cargo_check
|
name: cargo_check
|
||||||
displayName: Cargo check
|
displayName: Cargo check
|
||||||
|
|
||||||
##############
|
- stage: Test
|
||||||
# Test stage #
|
dependsOn: Checks
|
||||||
##############
|
jobs:
|
||||||
|
|
||||||
# Test stable
|
# Test stable
|
||||||
- template: ci/test.yml
|
- template: ci/test.yml
|
||||||
parameters:
|
parameters:
|
||||||
dependsOn:
|
|
||||||
- cargo_check
|
|
||||||
name: cargo_test_stable
|
name: cargo_test_stable
|
||||||
displayName: Cargo test
|
displayName: Cargo test
|
||||||
cross: true # Test on Windows and macOS
|
cross: true # Test on Windows and macOS
|
||||||
|
@ -50,22 +49,17 @@ jobs:
|
||||||
name: test_docker
|
name: test_docker
|
||||||
displayName: Docker test
|
displayName: Docker test
|
||||||
|
|
||||||
################
|
- stage: Release
|
||||||
# Release stage #
|
dependsOn:
|
||||||
################
|
- Checks
|
||||||
|
- Test
|
||||||
# Release binary
|
condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/v'))
|
||||||
|
jobs:
|
||||||
|
# Release binary on GitHub
|
||||||
- template: ci/github-release.yml
|
- template: ci/github-release.yml
|
||||||
parameters:
|
parameters:
|
||||||
name: github_release
|
name: github_release
|
||||||
dependsOn:
|
|
||||||
- rustfmt
|
|
||||||
- cargo_check
|
|
||||||
- cargo_clippy
|
|
||||||
- cargo_test_stable
|
|
||||||
- test_docker
|
|
||||||
rust_version: stable
|
rust_version: stable
|
||||||
condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/v'))
|
|
||||||
contents: |
|
contents: |
|
||||||
*
|
*
|
||||||
!*.rlib
|
!*.rlib
|
||||||
|
@ -81,3 +75,9 @@ jobs:
|
||||||
gitHubConnection: StarshipRelease
|
gitHubConnection: StarshipRelease
|
||||||
repositoryName: starship/starship
|
repositoryName: starship/starship
|
||||||
isPreRelease: false
|
isPreRelease: false
|
||||||
|
|
||||||
|
# Publish package to Crates.io
|
||||||
|
- template: ci/cargo-publish.yml
|
||||||
|
parameters:
|
||||||
|
name: cargo_publish
|
||||||
|
displayName: Publish to Crates.io
|
||||||
|
|
|
@ -9,5 +9,5 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
- template: install-rust.yml
|
- template: install-rust.yml
|
||||||
|
|
||||||
- script: cargo clippy --all
|
- script: cargo clippy -- -D warnings -D clippy::all -D clippy::nursery -D clippy::pedantic
|
||||||
displayName: Run clippy
|
displayName: Run clippy
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
parameters:
|
||||||
|
rust_version: stable
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
- job: ${{ parameters.name }}
|
||||||
|
displayName: ${{ parameters.displayName }}
|
||||||
|
pool:
|
||||||
|
vmImage: ubuntu-16.04
|
||||||
|
steps:
|
||||||
|
- template: install-rust.yml
|
||||||
|
|
||||||
|
- script: |
|
||||||
|
cargo login $(CARGO_TOKEN)
|
||||||
|
cargo publish
|
||||||
|
displayName: Publish package to Crates.io
|
|
@ -3,15 +3,12 @@ parameters:
|
||||||
github:
|
github:
|
||||||
isPreRelease: false
|
isPreRelease: false
|
||||||
repositoryName: "$(Build.Repository.Name)"
|
repositoryName: "$(Build.Repository.Name)"
|
||||||
dependsOn: []
|
|
||||||
displayName: "Release to GitHub"
|
displayName: "Release to GitHub"
|
||||||
archiveName: "$(Build.Repository.Name)"
|
archiveName: "$(Build.Repository.Name)"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
- job: ${{ parameters.name }}
|
- job: ${{ parameters.name }}
|
||||||
condition: ${{ parameters.condition }}
|
|
||||||
displayName: ${{ parameters.displayName }}
|
displayName: ${{ parameters.displayName }}
|
||||||
dependsOn: ${{ parameters.dependsOn }}
|
|
||||||
pool:
|
pool:
|
||||||
vmImage: ubuntu-16.04
|
vmImage: ubuntu-16.04
|
||||||
steps:
|
steps:
|
||||||
|
@ -63,9 +60,7 @@ jobs:
|
||||||
- ${{ each build_target in parameters.targets }}:
|
- ${{ each build_target in parameters.targets }}:
|
||||||
- ${{ if eq(build_target, 'x86_64-apple-darwin') }}:
|
- ${{ if eq(build_target, 'x86_64-apple-darwin') }}:
|
||||||
- job: ${{ parameters.name }}_macOS
|
- job: ${{ parameters.name }}_macOS
|
||||||
condition: ${{ parameters.condition }}
|
|
||||||
displayName: ${{ parameters.displayName }} (macOS)
|
displayName: ${{ parameters.displayName }} (macOS)
|
||||||
dependsOn: ${{ parameters.dependsOn }}
|
|
||||||
pool:
|
pool:
|
||||||
vmImage: macOS-10.13
|
vmImage: macOS-10.13
|
||||||
steps:
|
steps:
|
||||||
|
@ -114,9 +109,7 @@ jobs:
|
||||||
|
|
||||||
- ${{ if eq(build_target, 'x86_64-pc-windows-msvc') }}:
|
- ${{ if eq(build_target, 'x86_64-pc-windows-msvc') }}:
|
||||||
- job: ${{ parameters.name }}_msvc
|
- job: ${{ parameters.name }}_msvc
|
||||||
condition: ${{ parameters.condition }}
|
|
||||||
displayName: ${{ parameters.displayName }} (Windows)
|
displayName: ${{ parameters.displayName }} (Windows)
|
||||||
dependsOn: ${{ parameters.dependsOn }}
|
|
||||||
pool:
|
pool:
|
||||||
vmImage: vs2017-win2016
|
vmImage: vs2017-win2016
|
||||||
steps:
|
steps:
|
||||||
|
|
|
@ -149,6 +149,7 @@ impl Config for Table {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue