зеркало из https://github.com/microsoft/msquic.git
Move Cargo to GH Action (#2484)
This commit is contained in:
Родитель
2f58cbe435
Коммит
714bf6cc5f
|
@ -490,19 +490,6 @@ stages:
|
|||
parameters:
|
||||
image: macOS-10.15
|
||||
|
||||
- stage: cargo
|
||||
displayName: Cargo Build & Test
|
||||
dependsOn: []
|
||||
jobs:
|
||||
- template: ./templates/cargo.yml
|
||||
parameters:
|
||||
image: windows-2019
|
||||
platform: windows
|
||||
- template: ./templates/cargo.yml
|
||||
parameters:
|
||||
image: ubuntu-latest
|
||||
platform: linux
|
||||
|
||||
#
|
||||
# Performance Tests
|
||||
#
|
||||
|
|
|
@ -1,36 +0,0 @@
|
|||
# This template contains steps to use Cargo to build MsQuic Rust library.
|
||||
|
||||
parameters:
|
||||
image: ''
|
||||
platform: ''
|
||||
|
||||
jobs:
|
||||
- job: cargo_${{ parameters.platform }}
|
||||
displayName: ${{ parameters.image }}
|
||||
pool:
|
||||
vmImage: ${{ parameters.image }}
|
||||
steps:
|
||||
- checkout: self
|
||||
- task: PowerShell@2
|
||||
displayName: Prepare Build Machine
|
||||
inputs:
|
||||
pwsh: true
|
||||
filePath: scripts/prepare-machine.ps1
|
||||
arguments: -Configuration Build -InitSubmodules -Tls openssl -FailOnError
|
||||
- ${{ if eq(parameters.platform, 'windows') }}:
|
||||
- pwsh: |
|
||||
Invoke-WebRequest -Uri "https://static.rust-lang.org/rustup/dist/x86_64-pc-windows-msvc/rustup-init.exe" -OutFile "rustup-init.exe"
|
||||
.\rustup-init.exe -y
|
||||
echo "##vso[task.prependpath]%USERPROFILE%\.cargo\bin"
|
||||
displayName: Install rust
|
||||
- ${{ if ne(parameters.platform, 'windows') }}:
|
||||
- script: |
|
||||
curl https://sh.rustup.rs -sSf | sh -s -- -y
|
||||
echo "##vso[task.prependpath]$HOME/.cargo/bin"
|
||||
displayName: Install rust
|
||||
- script: cargo build --all
|
||||
displayName: Cargo build
|
||||
- script: cargo test --all
|
||||
displayName: Cargo test
|
||||
- script: cargo publish --dry-run
|
||||
displayName: Cargo Publish (dry run)
|
|
@ -0,0 +1,49 @@
|
|||
name: Cargo
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- release/*
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
- release/*
|
||||
|
||||
permissions: read-all
|
||||
|
||||
jobs:
|
||||
cargo:
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ubuntu-latest, windows-latest]
|
||||
runs-on: ${{ matrix.os }}
|
||||
name: Cargo
|
||||
steps:
|
||||
- name: Harden Runner
|
||||
uses: step-security/harden-runner@bdb12b622a910dfdc99a31fdfe6f45a16bc287a4
|
||||
if: runner.os == 'Linux'
|
||||
with:
|
||||
egress-policy: audit
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@629c2de402a417ea7690ca6ce3f33229e27606a5
|
||||
- name: Prepare Machine
|
||||
run: scripts/prepare-machine.ps1 -Configuration Build -InitSubmodules -Tls openssl -FailOnError
|
||||
shell: pwsh
|
||||
- name: Install Perl
|
||||
if: runner.os == 'Windows'
|
||||
uses: shogo82148/actions-setup-perl@b0e06be5e74c57449d895dfe5b3792563c214e8f
|
||||
with:
|
||||
perl-version: '5.34'
|
||||
- name: Install NASM
|
||||
if: runner.os == 'Windows'
|
||||
uses: ilammy/setup-nasm@10788e307d96af7013172d66126322c70b22efb9
|
||||
- name: Install Cargo
|
||||
if: runner.os == 'Linux'
|
||||
run: curl https://sh.rustup.rs -sSf | sh -s -- -y
|
||||
- name: Cargo build
|
||||
run: cargo build --all
|
||||
- name: Cargo test
|
||||
run: cargo test --all
|
||||
- name: Cargo Publish (dry run)
|
||||
run: cargo publish --dry-run
|
|
@ -189,7 +189,7 @@ if ($IsWindows) {
|
|||
$NasmVersion = "2.15.05"
|
||||
$NasmPath = Join-Path $env:Programfiles "nasm-$NasmVersion"
|
||||
$NasmExe = Join-Path $NasmPath "nasm.exe"
|
||||
if (!(Test-Path $NasmExe)) {
|
||||
if (!(Test-Path $NasmExe) -and $env:GITHUB_PATH -eq $null) {
|
||||
New-Item -Path .\build -ItemType Directory -Force
|
||||
$NasmArch = "win64"
|
||||
if (![System.Environment]::Is64BitOperatingSystem) {
|
||||
|
@ -213,7 +213,7 @@ if ($IsWindows) {
|
|||
$JomVersion = "1_1_3"
|
||||
$JomPath = Join-Path $env:Programfiles "jom_$JomVersion"
|
||||
$JomExe = Join-Path $JomPath "jom.exe"
|
||||
if (!(Test-Path $JomExe)) {
|
||||
if (!(Test-Path $JomExe) -and $env:GITHUB_PATH -eq $null) {
|
||||
New-Item -Path .\build -ItemType Directory -Force
|
||||
try {
|
||||
Invoke-WebRequest -Uri "https://qt.mirror.constant.com/official_releases/jom/jom_$JomVersion.zip" -OutFile "build\jom.zip"
|
||||
|
|
Загрузка…
Ссылка в новой задаче