From aee46dd6780717206d98ad00a97204a2af2c476a Mon Sep 17 00:00:00 2001 From: Matan Kushner Date: Fri, 4 Oct 2019 15:12:48 +0900 Subject: [PATCH] ci: Update CI and migrate publish job to Actions (#455) - Replace hecrj/setup-rust-action with actions-rs tools - Add a Cargo Audit test step - Move cargo publish step from Azure Pipelines to GitHub Actions - Use cargo-publish-all to publish multiple packages at once - Automate the creation of release notes --- .github/chglog/CHANGELOG.tpl.md | 49 ++++ .github/chglog/RELEASE.tpl.md | 29 +++ .github/chglog/changelog.yml | 29 +++ .github/chglog/release.yml | 28 +++ .github/workflows/continuous-integration.yml | 100 --------- .github/workflows/workflow.yml | 222 +++++++++++++++++++ azure-pipelines.yml | 35 --- ci/cargo-publish.yml | 15 -- ci/github-release.yml | 157 ------------- ci/install-cross-rust.yml | 43 ---- ci/install-rust.yml | 35 --- 11 files changed, 357 insertions(+), 385 deletions(-) create mode 100755 .github/chglog/CHANGELOG.tpl.md create mode 100755 .github/chglog/RELEASE.tpl.md create mode 100755 .github/chglog/changelog.yml create mode 100755 .github/chglog/release.yml delete mode 100644 .github/workflows/continuous-integration.yml create mode 100644 .github/workflows/workflow.yml delete mode 100644 azure-pipelines.yml delete mode 100644 ci/cargo-publish.yml delete mode 100644 ci/github-release.yml delete mode 100644 ci/install-cross-rust.yml delete mode 100644 ci/install-rust.yml diff --git a/.github/chglog/CHANGELOG.tpl.md b/.github/chglog/CHANGELOG.tpl.md new file mode 100755 index 000000000..3346a56eb --- /dev/null +++ b/.github/chglog/CHANGELOG.tpl.md @@ -0,0 +1,49 @@ +{{ if .Versions -}} + +## [Unreleased] + +{{ if .Unreleased.CommitGroups -}} +{{ range .Unreleased.CommitGroups -}} +### {{ .Title }} +{{ range .Commits -}} +- {{ if .Scope }}**{{ .Scope }}:** {{ end }}{{ .Subject }} +{{ end }} +{{ end -}} +{{ end -}} +{{ end -}} + +{{ range .Versions }} + +## {{ if .Tag.Previous }}[{{ .Tag.Name }}]{{ else }}{{ .Tag.Name }}{{ end }} - {{ datetime "2006-01-02" .Tag.Date }} +{{ range .CommitGroups -}} +### {{ .Title }} +{{ range .Commits -}} +- {{ if .Scope }}**{{ .Scope }}:** {{ end }}{{ .Subject }} +{{ end }} +{{ end -}} + +{{- if .RevertCommits -}} +### Reverts +{{ range .RevertCommits -}} +- {{ .Revert.Header }} +{{ end }} +{{ end -}} + +{{- if .NoteGroups -}} +{{ range .NoteGroups -}} +### {{ .Title }} +{{ range .Notes }} +{{ .Body }} +{{ end }} +{{ end -}} +{{ end -}} +{{ end -}} + +{{- if .Versions }} +[Unreleased]: {{ .Info.RepositoryURL }}/compare/{{ $latest := index .Versions 0 }}{{ $latest.Tag.Name }}...HEAD +{{ range .Versions -}} +{{ if .Tag.Previous -}} +[{{ .Tag.Name }}]: {{ $.Info.RepositoryURL }}/compare/{{ .Tag.Previous.Name }}...{{ .Tag.Name }} +{{ end -}} +{{ end -}} +{{ end -}} diff --git a/.github/chglog/RELEASE.tpl.md b/.github/chglog/RELEASE.tpl.md new file mode 100755 index 000000000..465caeef5 --- /dev/null +++ b/.github/chglog/RELEASE.tpl.md @@ -0,0 +1,29 @@ +{{ range .Versions }} +## {{ if .Tag.Previous }}[{{ .Tag.Name }}]({{ $.Info.RepositoryURL }}/compare/{{ .Tag.Previous.Name }}...{{ .Tag.Name }}){{ else }}{{ .Tag.Name }}{{ end }} ({{ datetime "2006-01-02" .Tag.Date }}) + +{{ range .CommitGroups -}} +### {{ .Title }} + +{{ range .Commits -}} +* {{ if .Scope }}**{{ .Scope }}:** {{ end }}{{ .Subject }} +{{ end }} +{{ end -}} + +{{- if .RevertCommits -}} +### Reverts + +{{ range .RevertCommits -}} +* {{ .Revert.Header }} +{{ end }} +{{ end -}} + +{{- if .NoteGroups -}} +{{ range .NoteGroups -}} +### {{ .Title }} + +{{ range .Notes }} +{{ .Body }} +{{ end }} +{{ end -}} +{{ end -}} +{{ end -}} diff --git a/.github/chglog/changelog.yml b/.github/chglog/changelog.yml new file mode 100755 index 000000000..9ba3d0ebd --- /dev/null +++ b/.github/chglog/changelog.yml @@ -0,0 +1,29 @@ +style: github +template: CHANGELOG.tpl.md +info: + title: CHANGELOG + repository_url: https://github.com/starship/starship +options: + commits: + # filters: + # Type: + # - feat + # - fix + # - perf + # - refactor + commit_groups: + title_maps: + feat: Features + fix: Bug Fixes + perf: Performance Improvements + refactor: Code Refactoring + ci: Continuous Integration + header: + pattern: "^(\\w*)(?:\\(([\\w\\$\\.\\-\\*\\s]*)\\))?\\:\\s(.*)$" + pattern_maps: + - Type + - Scope + - Subject + notes: + keywords: + - BREAKING CHANGE diff --git a/.github/chglog/release.yml b/.github/chglog/release.yml new file mode 100755 index 000000000..f2608cf32 --- /dev/null +++ b/.github/chglog/release.yml @@ -0,0 +1,28 @@ +style: github +template: RELEASE.tpl.md +info: + repository_url: https://github.com/starship/starship +options: + commits: + # filters: + # Type: + # - feat + # - fix + # - perf + # - refactor + commit_groups: + title_maps: + feat: Features + fix: Bug Fixes + perf: Performance Improvements + refactor: Code Refactoring + ci: Continuous Integration + header: + pattern: "^(\\w*)(?:\\(([\\w\\$\\.\\-\\*\\s]*)\\))?\\:\\s(.*)$" + pattern_maps: + - Type + - Scope + - Subject + notes: + keywords: + - BREAKING CHANGE diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml deleted file mode 100644 index f202333a3..000000000 --- a/.github/workflows/continuous-integration.yml +++ /dev/null @@ -1,100 +0,0 @@ -name: Continuous Integration -on: [push, pull_request] -jobs: - # Run the `rustfmt` code formatter - rustfmt: - name: Rustfmt [Formatter] - runs-on: ubuntu-latest - steps: - - uses: hecrj/setup-rust-action@master - - uses: actions/checkout@master - - name: Install rustfmt - run: rustup component add rustfmt - - name: Run rustfmt - run: cargo fmt --all -- --check - - # Run the `clippy` linting tool - clippy: - name: Clippy [Linter] - runs-on: ubuntu-latest - steps: - - uses: hecrj/setup-rust-action@master - - uses: actions/checkout@master - - name: Install clippy - run: rustup component add clippy - - name: Run clippy - run: cargo clippy --all-targets --all-features -- -D clippy::all - - # Ensure that the project could be successfully compiled - cargo_check: - name: Compile - runs-on: ubuntu-latest - steps: - - uses: hecrj/setup-rust-action@master - - uses: actions/checkout@master - - run: cargo check --all - - # Run tests on Linux, and macOS - # On both Rust stable and Rust nightly - test: - name: Test Suite - needs: [rustfmt, clippy, cargo_check] - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - os: [ubuntu-latest, macOS-latest] - rust: [stable, nightly] - steps: - # Install all the required dependencies for testing - - uses: hecrj/setup-rust-action@master - with: - rust-version: ${{ matrix.rust }} - - # Install Node.js at a fixed version - - uses: actions/setup-node@master - with: - node-version: "12.0.0" - - # Install Golang at a fixed version - - uses: actions/setup-go@master - with: - go-version: "1.12.1" - - # Install Ruby at a fixed version - - uses: actions/setup-ruby@master - with: - ruby-version: "2.6.3" - - # Install Python at a fixed version - - uses: actions/setup-python@master - with: - python-version: "3.6.9" - - # Install dotnet at a fixed version - - uses: actions/setup-dotnet@master - with: - dotnet-version: "2.2.402" - - # Run the ignored tests that expect the above setup - - uses: actions/checkout@master - - name: Run all tests - run: cargo test -- -Z unstable-options --include-ignored - - # Run the tests in the Docker image - docker_test: - name: Test in Docker - needs: [rustfmt, clippy, cargo_check] - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@master - - name: Pull the pre-built Docker image - run: docker pull starshipcommand/starship-test - - name: Fix file permissions - run: chmod -R a+w . - - name: Build the Docker image - run: - docker build -f tests/Dockerfile --tag starshipcommand/starship-test --cache-from - starshipcommand/starship-test . - - name: Run tests in Docker - run: docker run --rm -v $(pwd):/src/starship starshipcommand/starship-test diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml new file mode 100644 index 000000000..b9fbce850 --- /dev/null +++ b/.github/workflows/workflow.yml @@ -0,0 +1,222 @@ +name: Workflow +on: [push, pull_request] +jobs: + # Run the `rustfmt` code formatter + rustfmt: + name: Rustfmt [Formatter] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + - uses: actions-rs/toolchain@v1 + with: + toolchain: stable + override: true + - run: rustup component add rustfmt + - uses: actions-rs/cargo@v1 + with: + command: fmt + args: --all -- --check + + # Run the `clippy` linting tool + clippy: + name: Clippy [Linter] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + - uses: actions-rs/toolchain@v1 + with: + toolchain: stable + override: true + - run: rustup component add clippy + - uses: actions-rs/clippy-check@v1 + with: + token: ${{ secrets.GITHUB_TOKEN }} + args: --all-targets --all-features -- -D clippy::all + + # Run a security audit on dependencies + cargo_audit: + name: Cargo Audit [Security] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + - uses: actions-rs/toolchain@v1 + with: + toolchain: stable + override: true + - run: cargo install --force cargo-audit + - run: cargo generate-lockfile + - uses: actions-rs/cargo@v1 + with: + command: audit + + # Ensure that the project could be successfully compiled + cargo_check: + name: Compile + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + - uses: actions-rs/toolchain@v1 + with: + toolchain: stable + override: true + - uses: actions-rs/cargo@v1 + with: + command: check + args: --all + + # Run tests on Linux, and macOS + # On both Rust stable and Rust nightly + test: + name: Test Suite + needs: [cargo_check] + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, macOS-latest] + rust: [stable, nightly] + steps: + # Checkout the branch being tested + - uses: actions/checkout@v1 + + # Install all the required dependencies for testing + - uses: actions-rs/toolchain@v1 + with: + toolchain: stable + override: true + + # Install Node.js at a fixed version + - uses: actions/setup-node@master + with: + node-version: "12.0.0" + + # Install Golang at a fixed version + - uses: actions/setup-go@master + with: + go-version: "1.12.1" + + # Install Ruby at a fixed version + - uses: actions/setup-ruby@master + with: + ruby-version: "2.6.3" + + # Install Python at a fixed version + - uses: actions/setup-python@master + with: + python-version: "3.6.9" + + # Install dotnet at a fixed version + - uses: actions/setup-dotnet@master + with: + dotnet-version: "2.2.402" + + # Run the ignored tests that expect the above setup + - name: Run all tests + uses: actions-rs/cargo@v1 + with: + command: test + args: -- -Z unstable-options --include-ignored + + # Run the tests in the Docker image + docker_test: + name: Test in Docker + needs: [cargo_check] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@master + - name: Pull the pre-built Docker image + run: docker pull starshipcommand/starship-test + - name: Fix file permissions + run: chmod -R a+w . + - name: Build the Docker image + run: + docker build -f tests/Dockerfile --tag starshipcommand/starship-test --cache-from + starshipcommand/starship-test . + - name: Run tests in Docker + run: docker run --rm -v $(pwd):/src/starship starshipcommand/starship-test + + # Publish all packages to Crates.io + cargo_publish: + if: startsWith(github.ref, 'refs/tags/v') + name: Publish Cargo Packages + needs: [test, docker_test] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + - uses: actions-rs/toolchain@v1 + with: + toolchain: stable + override: true + - run: cargo install --force cargo-publish-all + - run: cargo-publish-all --token $CRATES_IO_TOKEN --yes + + github_release: + if: startsWith(github.ref, 'refs/tags/v') + name: Create GitHub release [${{ matrix.target }}] + needs: [test, docker_test] + strategy: + fail-fast: false + matrix: + # In order to use different target names on parallel ubuntu builds, + # we use `ubuntu-latest` and `ubuntu-18.04` to include them separately + os: [ubuntu-latest, ubuntu-18.04, macOS-latest] + include: + - os: ubuntu-latest + target: x86_64-unknown-linux-gnu + bin: starship + name: starship-x86_64-unknown-linux-gnu.tar.gz + - os: ubuntu-18.04 + target: x86_64-unknown-linux-musl + bin: starship + name: starship-x86_64-unknown-linux-musl.tar.gz + - os: macOS-latest + target: x86_64-apple-darwin + bin: starship + name: starship-x86_64-apple-darwin.tar.gz + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v1 + + - name: Install Rust toolchain + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + override: true + target: ${{ matrix.target }} + + - name: Install musl tools + if: matrix.target == 'x86_64-unknown-linux-musl' + run: sudo apt-get install -y musl-tools + + - name: Build target + uses: actions-rs/cargo@v1 + with: + command: build + args: --release --target ${{ matrix.target }} + + - name: Prepare build artifacts + run: | + strip target/${{ matrix.target }}/release/${{ matrix.bin }} + cd target/${{ matrix.target }}/release + if [[ "${{ matrix.os }}" == "windows-latest" ]] + then + 7z a ../../../${{ matrix.name }} ${{ matrix.bin }} + else + tar czvf ../../../${{ matrix.name }} ${{ matrix.bin }} + fi + cd - + + - name: Generate release notes + run: | + # Temporary fix for https://github.com/actions/setup-go/issues/14 + export PATH=$PATH:$(go env GOPATH)/bin + go get -u github.com/git-chglog/git-chglog/cmd/git-chglog + git-chglog -c .github/chglog/release.yml $(git describe --tags $(git rev-list --tags --max-count=1)) > RELEASE.txt + + - name: Create GitHub release ${{ matrix.target }} + uses: softprops/action-gh-release@v1 + with: + files: ${{ matrix.name }} + body_path: RELEASE.txt + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/azure-pipelines.yml b/azure-pipelines.yml deleted file mode 100644 index f2cb6cdbf..000000000 --- a/azure-pipelines.yml +++ /dev/null @@ -1,35 +0,0 @@ -trigger: - tags: - include: ["*"] - -stages: - - stage: Release - condition: startsWith(variables['Build.SourceBranch'], 'refs/tags/v') - jobs: - # Release binary on GitHub - - template: ci/github-release.yml - parameters: - name: github_release - rust_version: stable - contents: | - * - !*.rlib - !*.d - !.* - targets: - - x86_64-unknown-linux-gnu - - x86_64-unknown-linux-musl - # Windows support temporarily disabled - # - x86_64-pc-windows-gnu - # - x86_64-pc-windows-msvc - - x86_64-apple-darwin - github: - gitHubConnection: StarshipRelease - repositoryName: starship/starship - isPreRelease: false - - # Publish package to Crates.io - - template: ci/cargo-publish.yml - parameters: - name: cargo_publish - displayName: Publish to Crates.io diff --git a/ci/cargo-publish.yml b/ci/cargo-publish.yml deleted file mode 100644 index 7d5141c84..000000000 --- a/ci/cargo-publish.yml +++ /dev/null @@ -1,15 +0,0 @@ -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 diff --git a/ci/github-release.yml b/ci/github-release.yml deleted file mode 100644 index 68167d230..000000000 --- a/ci/github-release.yml +++ /dev/null @@ -1,157 +0,0 @@ -parameters: - rust_version: stable - github: - isPreRelease: false - repositoryName: "$(Build.Repository.Name)" - displayName: "Release to GitHub" - archiveName: "$(Build.Repository.Name)" - -jobs: - - job: ${{ parameters.name }} - displayName: ${{ parameters.displayName }} - pool: - vmImage: ubuntu-16.04 - steps: - - template: install-cross-rust.yml - - - bash: | - MY_TAG="$(Build.SourceBranch)" - MY_TAG=${MY_TAG#refs/tags/} - echo $MY_TAG - echo "##vso[task.setvariable variable=build.my_tag]$MY_TAG" - DATE="$(date +%Y-%m-%d)" - echo "##vso[task.setvariable variable=build.date]$DATE" - displayName: "Create date and tag variables" - - ${{ each build_target in parameters.targets }}: - - ? ${{ if not(or(eq(build_target, 'x86_64-apple-darwin'), eq(build_target, 'x86_64-pc-windows-msvc'))) }} - : - script: | - echo Start building ${{ build_target }} - cross build --target ${{ build_target }} --release - ls -l - ls -l target/${{ build_target }}/release/* - displayName: Relase build for target ${{ build_target }} - - task: CopyFiles@2 - displayName: Copy files for target ${{ build_target }} - inputs: - sourceFolder: "$(Build.SourcesDirectory)/target/${{ build_target }}/release" - contents: ${{ parameters.contents }} - targetFolder: "$(Build.BinariesDirectory)/${{ build_target }}" - - task: ArchiveFiles@2 - displayName: Gather assets - inputs: - rootFolderOrFile: "$(Build.BinariesDirectory)/${{ build_target }}" - archiveType: "tar" - tarCompression: "gz" - archiveFile: "$(Build.ArtifactStagingDirectory)/${{ parameters.archiveName }}-$(build.my_tag)-${{ build_target }}.tar.gz" - - - task: GitHubRelease@0 - displayName: Create release - inputs: - gitHubConnection: ${{ parameters.github.gitHubConnection }} - tagSource: manual - title: "$(build.my_tag) - $(build.date)" - tag: "$(build.my_tag)" - assetUploadMode: replace - action: edit - assets: "$(Build.ArtifactStagingDirectory)/${{ parameters.archiveName }}*" - repositoryName: ${{ parameters.github.repositoryName }} - isPreRelease: ${{ parameters.github.isPreRelease }} - - - ${{ each build_target in parameters.targets }}: - - ${{ if eq(build_target, 'x86_64-apple-darwin') }}: - - job: ${{ parameters.name }}_macOS - displayName: ${{ parameters.displayName }} (macOS) - pool: - vmImage: macOS-10.13 - steps: - - template: install-rust.yml - - - bash: | - MY_TAG="$(Build.SourceBranch)" - MY_TAG=${MY_TAG#refs/tags/} - echo $MY_TAG - echo "##vso[task.setvariable variable=build.my_tag]$MY_TAG" - DATE="$(date +%Y-%m-%d)" - echo "##vso[task.setvariable variable=build.date]$DATE" - displayName: "Create date and tag variables" - - script: | - echo Start building ${{ build_target }} - cargo build --release - ls -l - ls -l target/release/* - displayName: Relase build for target ${{ build_target }} - - task: CopyFiles@2 - displayName: Copy files for target ${{ build_target }} - inputs: - sourceFolder: "$(Build.SourcesDirectory)/target/release" - contents: ${{ parameters.contents }} - targetFolder: "$(Build.BinariesDirectory)/${{ build_target }}" - - task: ArchiveFiles@2 - displayName: Gather assets - inputs: - rootFolderOrFile: "$(Build.BinariesDirectory)/${{ build_target }}" - archiveType: "tar" - tarCompression: "gz" - archiveFile: "$(Build.ArtifactStagingDirectory)/${{ parameters.archiveName }}-$(build.my_tag)-${{ build_target }}.tar.gz" - - - task: GitHubRelease@0 - displayName: Create release - inputs: - gitHubConnection: ${{ parameters.github.gitHubConnection }} - tagSource: manual - title: "$(build.my_tag) - $(build.date)" - tag: "$(build.my_tag)" - assetUploadMode: replace - action: edit - assets: "$(Build.ArtifactStagingDirectory)/${{ parameters.archiveName }}*" - repositoryName: ${{ parameters.github.repositoryName }} - isPreRelease: ${{ parameters.github.isPreRelease }} - - - ${{ if eq(build_target, 'x86_64-pc-windows-msvc') }}: - - job: ${{ parameters.name }}_msvc - displayName: ${{ parameters.displayName }} (Windows) - pool: - vmImage: vs2017-win2016 - steps: - - template: install-rust.yml - - - bash: | - MY_TAG="$(Build.SourceBranch)" - MY_TAG=${MY_TAG#refs/tags/} - echo $MY_TAG - echo "##vso[task.setvariable variable=build.my_tag]$MY_TAG" - DATE="$(date +%Y-%m-%d)" - echo "##vso[task.setvariable variable=build.date]$DATE" - displayName: "Create date and tag variables" - - script: | - echo Start building ${{ build_target }} - cargo build --release - ls -l - ls -l target/release/* - displayName: Relase build for target ${{ build_target }} - - task: CopyFiles@2 - displayName: Copy files for target ${{ build_target }} - inputs: - sourceFolder: "$(Build.SourcesDirectory)/target/release" - contents: ${{ parameters.contents }} - targetFolder: "$(Build.BinariesDirectory)/${{ build_target }}" - - task: ArchiveFiles@2 - displayName: Gather assets - inputs: - rootFolderOrFile: "$(Build.BinariesDirectory)/${{ build_target }}" - archiveType: "zip" - tarCompression: "None" - archiveFile: "$(Build.ArtifactStagingDirectory)/${{ parameters.archiveName }}-$(build.my_tag)-${{ build_target }}.zip" - - - task: GitHubRelease@0 - displayName: Create release - inputs: - gitHubConnection: ${{ parameters.github.gitHubConnection }} - tagSource: manual - title: "$(build.my_tag) - $(build.date)" - tag: "$(build.my_tag)" - assetUploadMode: replace - action: edit - assets: "$(Build.ArtifactStagingDirectory)/${{ parameters.archiveName }}*" - repositoryName: ${{ parameters.github.repositoryName }} - isPreRelease: ${{ parameters.github.isPreRelease }} diff --git a/ci/install-cross-rust.yml b/ci/install-cross-rust.yml deleted file mode 100644 index 2be33c41d..000000000 --- a/ci/install-cross-rust.yml +++ /dev/null @@ -1,43 +0,0 @@ -# defaults for any parameters that aren't specified -parameters: - rust_version: stable - -steps: - # Linux and macOS - - script: | - set -e - curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain $RUSTUP_TOOLCHAIN - echo "##vso[task.setvariable variable=PATH;]$PATH:$HOME/.cargo/bin:/usr/local/cargo/bin" - env: - RUSTUP_TOOLCHAIN: ${{parameters.rust_version}} - displayName: "Install rust (*nix)" - condition: not(eq(variables['Agent.OS'], 'Windows_NT')) - # Windows - - script: | - curl -sSf -o rustup-init.exe https://win.rustup.rs - rustup-init.exe -y --default-toolchain %RUSTUP_TOOLCHAIN% - set PATH=%PATH%;%USERPROFILE%\.cargo\bin - echo "##vso[task.setvariable variable=PATH;]%PATH%;%USERPROFILE%\.cargo\bin" - env: - RUSTUP_TOOLCHAIN: ${{parameters.rust_version}} - displayName: "Install rust (windows)" - condition: eq(variables['Agent.OS'], 'Windows_NT') - # Install additional components: - - ${{ each component in parameters.components }}: - - script: rustup component add ${{ component }} - - # TEMPORATY FIX UNTIL https://github.com/rust-embedded/cross/pull/169 is merged. - - script: | - git config --global user.email "not_necessery@dont.need" - git config --global user.name "I merge the things" - git clone https://github.com/rust-embedded/cross - cd cross - cargo install --force --path . - displayName: Install cross - # All platforms - - script: | - rustup -V - rustup component list --installed - rustc -Vv - cargo -V - displayName: Query rust and cargo versions diff --git a/ci/install-rust.yml b/ci/install-rust.yml deleted file mode 100644 index 4ee2acea2..000000000 --- a/ci/install-rust.yml +++ /dev/null @@ -1,35 +0,0 @@ -# defaults for any parameters that aren't specified -parameters: - rust_version: stable - -steps: - # Linux and macOS - - script: | - set -e - curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain $RUSTUP_TOOLCHAIN - echo "##vso[task.setvariable variable=PATH;]$PATH:$HOME/.cargo/bin:/usr/local/cargo/bin" - env: - RUSTUP_TOOLCHAIN: ${{parameters.rust_version}} - displayName: "Install rust (*nix)" - condition: not(eq(variables['Agent.OS'], 'Windows_NT')) - # Windows - - script: | - curl -sSf -o rustup-init.exe https://win.rustup.rs - rustup-init.exe -y --default-toolchain %RUSTUP_TOOLCHAIN% - set PATH=%PATH%;%USERPROFILE%\.cargo\bin - echo "##vso[task.setvariable variable=PATH;]%PATH%;%USERPROFILE%\.cargo\bin" - env: - RUSTUP_TOOLCHAIN: ${{parameters.rust_version}} - displayName: "Install rust (windows)" - condition: eq(variables['Agent.OS'], 'Windows_NT') - # Install additional components: - - ${{ each component in parameters.components }}: - - script: rustup component add ${{ component }} - - # All platforms - - script: | - rustup -V - rustup component list --installed - rustc -Vv - cargo -V - displayName: Query rust and cargo versions