mirror of
https://github.com/crate-ci/typos.git
synced 2024-12-23 08:02:15 -05:00
268 lines
8.6 KiB
YAML
268 lines
8.6 KiB
YAML
trigger:
|
|
branches:
|
|
include: ['master']
|
|
tags:
|
|
include: ['v*']
|
|
schedules:
|
|
- cron: "3 3 3 * *"
|
|
displayName: Monthly Build
|
|
branches:
|
|
include:
|
|
- master
|
|
variables:
|
|
minrust: 1.47.0
|
|
codecov_token: $(CODECOV_TOKEN_SECRET)
|
|
windows_vm: vs2017-win2016
|
|
mac_vm: macos-10.14
|
|
linux_vm: ubuntu-16.04
|
|
|
|
stages:
|
|
- stage: check
|
|
displayName: Compilation Check
|
|
jobs:
|
|
- job: cargo_check
|
|
displayName: cargo check
|
|
pool:
|
|
vmImage: ${{ variables.linux_vm }}
|
|
steps:
|
|
- template: install-rust.yml@templates
|
|
parameters:
|
|
rust: stable
|
|
- script: cargo check --all --bins --examples --tests
|
|
displayName: Default features
|
|
- job: cargo_check_bench
|
|
displayName: cargo check --benches
|
|
pool:
|
|
vmImage: ${{ variables.linux_vm }}
|
|
continueOnError: true
|
|
steps:
|
|
- template: install-rust.yml@templates
|
|
parameters:
|
|
rust: nightly
|
|
- script: cargo check --all --benches
|
|
displayName: Default features
|
|
- stage: test
|
|
displayName: Test
|
|
jobs:
|
|
- job: test
|
|
displayName: Test
|
|
strategy:
|
|
matrix:
|
|
windows:
|
|
imageName: ${{ variables.windows_vm }}
|
|
target: 'x86_64-pc-windows-msvc'
|
|
channel: stable
|
|
mac:
|
|
imageName: ${{ variables.mac_vm }}
|
|
target: 'x86_64-apple-darwin'
|
|
channel: stable
|
|
linux:
|
|
imageName: ${{ variables.linux_vm }}
|
|
target: 'x86_64-unknown-linux-gnu'
|
|
channel: stable
|
|
linux_beta:
|
|
imageName: ${{ variables.linux_vm }}
|
|
target: 'x86_64-unknown-linux-gnu'
|
|
channel: beta
|
|
linux_nightly:
|
|
imageName: ${{ variables.linux_vm }}
|
|
target: 'x86_64-unknown-linux-gnu'
|
|
channel: nightly
|
|
continueOnError: ${{ eq(variables.channel, 'nightly') }}
|
|
pool:
|
|
vmImage: $(imageName)
|
|
steps:
|
|
- template: install-rust.yml@templates
|
|
parameters:
|
|
rust: $(channel)
|
|
targets: ["$(TARGET)"]
|
|
- script: cargo test --target $(TARGET) --all
|
|
displayName: cargo test
|
|
- script: cargo doc --target $(TARGET) --no-deps --all
|
|
displayName: cargo doc
|
|
- job: msrv
|
|
displayName: "${{ format('Minimum supported Rust version: {0}', variables.minrust) }}"
|
|
dependsOn: []
|
|
pool:
|
|
vmImage: ${{ variables.linux_vm }}
|
|
steps:
|
|
- template: install-rust.yml@templates
|
|
parameters:
|
|
rust: ${{ variables.minrust }}
|
|
- script: cargo check --all
|
|
displayName: cargo check
|
|
- stage: style
|
|
displayName: Style checks
|
|
dependsOn: []
|
|
jobs:
|
|
- job: "Committed"
|
|
pool:
|
|
vmImage: ${{ variables.linux_vm }}
|
|
steps:
|
|
- checkout: self
|
|
- template: v1/azdo-step.yml@gh-install
|
|
parameters:
|
|
git: crate-ci/committed
|
|
target: 'x86_64-unknown-linux-gnu'
|
|
to: $(Build.StagingDirectory)/tools
|
|
- script: |
|
|
echo "This project uses Conventional style, see https://www.conventionalcommits.org"
|
|
$(Build.StagingDirectory)/tools/committed HEAD~..HEAD^2 --no-merge-commit -vv
|
|
displayName: Committed
|
|
condition: and(succeeded(), eq(variables['Build.Reason'], 'PullRequest'))
|
|
- job: style
|
|
displayName: Style linting
|
|
strategy:
|
|
matrix:
|
|
current:
|
|
channel: stable
|
|
next:
|
|
channel: beta
|
|
continueOnError: ${{ eq(variables.channel, 'beta') }}
|
|
pool:
|
|
vmImage: ${{ variables.linux_vm }}
|
|
steps:
|
|
- template: install-rust.yml@templates
|
|
parameters:
|
|
rust: $(channel)
|
|
components:
|
|
- rustfmt
|
|
- clippy
|
|
- script: cargo fmt --all -- --check
|
|
displayName: rustfmt
|
|
- script: cargo check --all
|
|
displayName: Warnings
|
|
env:
|
|
RUSTFLAGS: "-D warnings"
|
|
- script: cargo clippy --all -- -D warnings
|
|
displayName: clippy
|
|
- ${{ if ne('', variables.codecov_token) }}:
|
|
- stage: coverage
|
|
displayName: Code coverage
|
|
dependsOn: test
|
|
jobs:
|
|
- template: coverage.yml@templates
|
|
parameters:
|
|
token: ${{ variables.codecov_token }}
|
|
- stage: codegen
|
|
displayName: Verify Code-gen
|
|
dependsOn: ["check"]
|
|
jobs:
|
|
- job: codegen
|
|
pool:
|
|
vmImage: ${{ variables.linux_vm }}
|
|
steps:
|
|
- template: install-rust.yml@templates
|
|
- script: |
|
|
cargo run --package typos-dict-codegen -- --output crates/typos-dict/src/dict_codegen.rs --check
|
|
displayName: Verify typos-dict
|
|
- script: |
|
|
cargo run --package typos-vars-codegen -- --output crates/typos-vars/src/vars_codegen.rs --check
|
|
displayName: Verify typos-dict
|
|
- script: |
|
|
cargo run --package typos-dict-verify -- --input crates/typos-dict/assets/words.csv --output crates/typos-dict/assets/words.csv --check
|
|
displayName: Verify typos-dict
|
|
- script: |
|
|
cargo run --package codespell-codegen -- --output crates/codespell-dict/src/dict_codegen.rs --check
|
|
displayName: Verify codespell-dict
|
|
- script: |
|
|
cargo run --package misspell-codegen -- --output crates/misspell-dict/src/dict_codegen.rs --check
|
|
displayName: Verify misspell-dict
|
|
- script: |
|
|
cargo run --package wikipedia-codegen -- --output crates/wikipedia-dict/src/dict_codegen.rs --check
|
|
displayName: Verify wikipedia-dict
|
|
- script: |
|
|
cargo run --package varcon-codegen -- --output crates/varcon/src/codegen.rs --check
|
|
displayName: Verify varcon-dict
|
|
- stage: Release
|
|
dependsOn: test
|
|
condition: startsWith(variables['Build.SourceBranch'], 'refs/tags/')
|
|
jobs:
|
|
- job:
|
|
strategy:
|
|
matrix:
|
|
windows:
|
|
imageName: ${{ variables.windows_vm }}
|
|
target: 'x86_64-pc-windows-msvc'
|
|
crate_name: typos
|
|
mac:
|
|
imageName: ${{ variables.mac_vm }}
|
|
target: 'x86_64-apple-darwin'
|
|
crate_name: typos
|
|
linux:
|
|
imageName: ${{ variables.linux_vm }}
|
|
target: 'x86_64-unknown-linux-gnu'
|
|
crate_name: typos
|
|
pool:
|
|
vmImage: $(imageName)
|
|
steps:
|
|
- template: install-rust.yml@templates
|
|
- script: |
|
|
cargo rustc --target $(TARGET) --release --bin $(CRATE_NAME) -- -C lto
|
|
displayName: Build
|
|
- task: CopyFiles@2
|
|
displayName: Stage assets
|
|
condition: ne( variables['Agent.OS'], 'Windows_NT' )
|
|
inputs:
|
|
sourceFolder: '$(Build.SourcesDirectory)/target/$(TARGET)/release'
|
|
contents: $(crate_name)
|
|
targetFolder: '$(Build.BinariesDirectory)/'
|
|
- task: CopyFiles@2
|
|
displayName: Stage assets on Windows
|
|
condition: eq( variables['Agent.OS'], 'Windows_NT' )
|
|
inputs:
|
|
sourceFolder: '$(Build.SourcesDirectory)/target/$(TARGET)/release'
|
|
contents: $(crate_name).exe
|
|
targetFolder: '$(Build.BinariesDirectory)/'
|
|
- task: ArchiveFiles@2
|
|
displayName: Tarball assets
|
|
condition: ne( variables['Agent.OS'], 'Windows_NT' )
|
|
inputs:
|
|
rootFolderOrFile: '$(Build.BinariesDirectory)/$(crate_name)'
|
|
archiveType: 'tar'
|
|
tarCompression: 'gz'
|
|
archiveFile: '$(Build.ArtifactStagingDirectory)/$(crate_name)-$(Build.SourceBranchName)-$(TARGET).tar.gz'
|
|
- task: GithubRelease@0
|
|
condition: ne( variables['Agent.OS'], 'Windows_NT' )
|
|
inputs:
|
|
gitHubConnection: 'crate-ci-token'
|
|
repositoryName: 'crate-ci/typos'
|
|
action: 'edit'
|
|
target: '$(build.sourceVersion)'
|
|
tagSource: 'manual'
|
|
tag: '$(Build.SourceBranchName)'
|
|
assets: '$(Build.ArtifactStagingDirectory)/$(crate_name)-$(Build.SourceBranchName)-$(TARGET).tar.gz'
|
|
title: '$(Build.SourceBranchName)'
|
|
assetUploadMode: 'replace'
|
|
addChangeLog: true
|
|
- task: ArchiveFiles@2
|
|
displayName: Zip assets
|
|
condition: eq( variables['Agent.OS'], 'Windows_NT' )
|
|
inputs:
|
|
rootFolderOrFile: '$(Build.BinariesDirectory)/$(crate_name).exe'
|
|
archiveType: 'zip'
|
|
archiveFile: '$(Build.ArtifactStagingDirectory)/$(crate_name)-$(Build.SourceBranchName)-$(TARGET).zip'
|
|
- task: GithubRelease@0
|
|
condition: eq( variables['Agent.OS'], 'Windows_NT' )
|
|
inputs:
|
|
gitHubConnection: 'crate-ci-token'
|
|
repositoryName: 'crate-ci/typos'
|
|
action: 'edit'
|
|
target: '$(build.sourceVersion)'
|
|
tagSource: 'manual'
|
|
tag: '$(Build.SourceBranchName)'
|
|
assets: '$(Build.ArtifactStagingDirectory)/$(crate_name)-$(Build.SourceBranchName)-$(TARGET).zip'
|
|
title: '$(Build.SourceBranchName)'
|
|
assetUploadMode: 'replace'
|
|
addChangeLog: true
|
|
|
|
resources:
|
|
repositories:
|
|
- repository: templates
|
|
type: github
|
|
name: crate-ci/azure-pipelines
|
|
endpoint: crate-ci
|
|
- repository: gh-install
|
|
type: github
|
|
name: crate-ci/gh-install
|
|
endpoint: crate-ci
|