typos/azure-pipelines.yml

308 lines
9.9 KiB
YAML
Raw Normal View History

2019-10-25 09:32:34 -04:00
trigger:
branches:
include: ['master']
tags:
include: ['v*']
2021-02-04 22:46:38 -05:00
pr:
branches:
include:
- master
paths:
exclude:
- "*.md"
- "docs/*"
- "LICENSE-*"
2019-10-25 09:32:34 -04:00
schedules:
- cron: "3 3 3 * *"
displayName: Monthly Build
branches:
include:
- master
2020-07-04 21:41:32 -04:00
variables:
2021-06-28 14:26:41 -04:00
minrust: 1.53.0
2020-07-04 21:41:32 -04:00
codecov_token: $(CODECOV_TOKEN_SECRET)
windows_vm: vs2017-win2016
mac_vm: macos-10.14
linux_vm: ubuntu-16.04
2019-10-25 09:32:34 -04:00
stages:
2020-07-04 21:41:32 -04:00
- 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
2021-02-04 22:46:38 -05:00
- script: cargo check --workspace --locked
displayName: Check that Cargo.lock is satisfiable
- script: cargo check --workspace --all-targets
2020-07-04 21:41:32 -04:00
displayName: Default features
- script: cargo check --all-targets --no-default-features
displayName: No features
- script: cargo check --all-targets --all-features
displayName: All features
2020-01-01 16:52:12 -05:00
- stage: test
2020-07-04 21:41:32 -04:00
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
2021-02-04 22:46:38 -05:00
# Check for upcoming platform-specific compiler breakages
windows_beta:
imageName: ${{ variables.windows_vm }}
target: 'x86_64-pc-windows-msvc'
channel: beta
mac_beta:
imageName: ${{ variables.mac_vm }}
target: 'x86_64-apple-darwin'
channel: beta
2020-07-04 21:41:32 -04:00
linux_beta:
imageName: ${{ variables.linux_vm }}
target: 'x86_64-unknown-linux-gnu'
channel: beta
2021-02-04 22:46:38 -05:00
# Check for compiler breakages
2020-07-04 21:41:32 -04:00
linux_nightly:
imageName: ${{ variables.linux_vm }}
target: 'x86_64-unknown-linux-gnu'
channel: nightly
2021-02-04 22:46:38 -05:00
continueOnError: $[ne(variables.channel, 'stable')]
2020-07-04 21:41:32 -04:00
pool:
vmImage: $(imageName)
steps:
- template: install-rust.yml@templates
parameters:
rust: $(channel)
targets: ["$(TARGET)"]
2021-02-04 22:46:38 -05:00
- script: cargo test --target $(TARGET) --workspace
2020-07-04 21:41:32 -04:00
displayName: cargo test
2021-02-04 22:46:38 -05:00
- script: cargo doc --target $(TARGET) --workspace --no-deps
2020-07-04 21:41:32 -04:00
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 }}
2021-02-04 22:46:38 -05:00
- script: cargo check --all --bins --examples --tests
2020-07-04 21:41:32 -04:00
displayName: cargo check
- stage: style
displayName: Style checks
2020-01-01 17:00:17 -05:00
dependsOn: []
jobs:
2020-07-04 21:41:32 -04:00
- job: "Committed"
2021-02-04 22:46:38 -05:00
displayName: Linting commit history
2020-07-04 21:41:32 -04:00
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: |
2021-02-04 22:46:38 -05:00
echo "Linting commits:"
git log --graph --oneline HEAD~..HEAD^2
echo "Against 'committed.toml':"
$(Build.StagingDirectory)/tools/committed --dump-config -
echo ""
echo "If this fails, don't sweat it. We're trying to encourage clear communication and not hinder contributions."
echo "If it is a reasonable issue and you lack time or feel uncomfortable fixing it yourself,"
echo "let us know and we can mentor or fix it."
2020-07-04 21:41:32 -04:00
$(Build.StagingDirectory)/tools/committed HEAD~..HEAD^2 --no-merge-commit -vv
2021-02-04 22:46:38 -05:00
displayName: Lint commit history
2020-07-04 21:41:32 -04:00
condition: and(succeeded(), eq(variables['Build.Reason'], 'PullRequest'))
- job: style
2021-02-04 22:46:38 -05:00
displayName: Style checking
pool:
vmImage: ${{ variables.linux_vm }}
steps:
- template: install-rust.yml@templates
parameters:
rust: stable
components:
- rustfmt
- script: cargo fmt --all -- --check
displayName: rustfmt
- job: lint
displayName: Linting
2020-07-04 21:41:32 -04:00
strategy:
matrix:
current:
2021-02-04 22:46:38 -05:00
channel: ${{ variables.minrust }}
2020-07-04 21:41:32 -04:00
next:
2021-02-04 22:46:38 -05:00
channel: stable
continueOnError: $[eq(variables.channel, 'stable')]
2020-07-04 21:41:32 -04:00
pool:
vmImage: ${{ variables.linux_vm }}
steps:
- template: install-rust.yml@templates
parameters:
rust: $(channel)
components:
- clippy
2021-02-04 22:46:38 -05:00
- script: cargo check --workspace --all-targets --all-features
2020-07-04 21:41:32 -04:00
displayName: Warnings
env:
RUSTFLAGS: "-D warnings"
2021-02-04 22:46:38 -05:00
- script: cargo clippy --workspace --all-features --all-targets -- -D warnings
2020-07-04 21:41:32 -04:00
displayName: clippy
- ${{ if ne('', variables.codecov_token) }}:
- stage: coverage
displayName: Code coverage
dependsOn: test
jobs:
2021-02-04 22:46:38 -05:00
- template: coverage.yml@templates
parameters:
token: ${{ variables.codecov_token }}
2019-10-25 09:41:36 -04:00
- stage: codegen
displayName: Verify Code-gen
2020-07-04 21:41:32 -04:00
dependsOn: ["check"]
2019-10-25 09:41:36 -04:00
jobs:
- job: codegen
pool:
2020-07-04 21:41:32 -04:00
vmImage: ${{ variables.linux_vm }}
2019-10-25 09:41:36 -04:00
steps:
2020-01-01 17:04:35 -05:00
- template: install-rust.yml@templates
2021-06-28 14:26:41 -04:00
parameters:
rust: ${{ variables.minrust }}
components:
- rustfmt
2019-10-25 09:41:36 -04:00
- 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
2021-05-15 20:03:10 -04:00
displayName: Verify typos-vars
- script: |
cargo run --package typos-dict-verify -- --input crates/typos-dict/assets/words.csv --output crates/typos-dict/assets/words.csv --check
2021-05-15 20:03:10 -04:00
displayName: Verify typos-dict-verify
2019-10-28 12:01:22 -04:00
- script: |
cargo run --package codespell-codegen -- --output crates/codespell-dict/src/dict_codegen.rs --check
2019-10-28 12:01:22 -04:00
displayName: Verify codespell-dict
- script: |
cargo run --package misspell-codegen -- --output crates/misspell-dict/src/dict_codegen.rs --check
displayName: Verify misspell-dict
2019-10-28 15:39:59 -04:00
- script: |
cargo run --package wikipedia-codegen -- --output crates/wikipedia-dict/src/dict_codegen.rs --check
2019-10-28 15:39:59 -04:00
displayName: Verify wikipedia-dict
2020-04-07 20:50:06 -04:00
- script: |
cargo run --package varcon-codegen -- --output crates/varcon/src/codegen.rs --check
displayName: Verify varcon-dict
2021-02-04 22:46:38 -05:00
- stage: release
displayName: Release
dependsOn: []
2019-10-25 09:37:41 -04:00
condition: startsWith(variables['Build.SourceBranch'], 'refs/tags/')
jobs:
- job:
strategy:
matrix:
windows:
2020-07-04 21:41:32 -04:00
imageName: ${{ variables.windows_vm }}
2019-10-25 09:37:41 -04:00
target: 'x86_64-pc-windows-msvc'
crate_name: typos
mac:
2020-07-04 21:41:32 -04:00
imageName: ${{ variables.mac_vm }}
2019-10-25 09:37:41 -04:00
target: 'x86_64-apple-darwin'
crate_name: typos
linux:
2020-07-04 21:41:32 -04:00
imageName: ${{ variables.linux_vm }}
2019-10-25 09:37:41 -04:00
target: 'x86_64-unknown-linux-gnu'
crate_name: typos
pool:
vmImage: $(imageName)
steps:
2020-01-01 17:03:19 -05:00
- template: install-rust.yml@templates
2021-02-04 22:46:38 -05:00
parameters:
rust: stable
targets: ["$(TARGET)"]
2019-10-25 09:37:41 -04:00
- script: |
2021-02-04 22:46:38 -05:00
cargo build --target $(TARGET) --release --bin $(CRATE_NAME)
2019-10-25 09:37:41 -04:00
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
2019-10-25 09:32:34 -04:00
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