forked from rust-skia/rust-skia
-
Notifications
You must be signed in to change notification settings - Fork 1
/
azure-pipelines-build-target.yml
90 lines (80 loc) · 4.49 KB
/
azure-pipelines-build-target.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# defaults:
parameters:
# Run test cases and examples?
runBinaries: false
# Run Clippy on on the target?
runClippy: false
# Produce and release binaries to GitHub?
releaseBinaries: 'False'
exampleArgs: ''
# Set up Android environment? Not compatible with runBinaries or runClippy!
androidEnv: false
# The features to build
features: '$(features)'
steps:
- bash: |
rustup target add ${{ parameters.target }}
displayName: 'Install Rust target ${{ parameters.target }}'
# Note: features are ignored when set in the workspace. This is a known bug in cargo (#5015), so cd into skia-safe instead.
# Also be sure that the bindings.rs file is rebuilt (#10)
# `cargo clean` needs to run to prevent running out of disk space on the Linux VM with stable-all-features-debug configurations (#323).
- bash: |
set -e
if [ "${{ parameters.androidEnv }}" == "true" ]; then
TARGET=${{ parameters.target }}
TARGET=${TARGET//-/_}
export CC_${TARGET}=${{ parameters.target }}$(androidAPILevel)-clang$(androidBinExt)
export CXX_${TARGET}=${{ parameters.target }}$(androidAPILevel)-clang++$(androidBinExt)
TARGET_UPPERCASE=`echo "${TARGET}" | tr [a-z] [A-Z]`
export CARGO_TARGET_${TARGET_UPPERCASE}_LINKER=${{ parameters.target }}$(androidAPILevel)-clang$(androidBinExt)
echo "Set CC, CXX, and CARGO_LINKER target specific environment variables for Android"
fi
cargo clean
set
(cd skia-safe && cargo build --release --features "${{ parameters.features }}" --all-targets --target ${{ parameters.target }} -vv)
export SKIA_BINARIES_TAG=$(cat "$(Build.ArtifactStagingDirectory)/skia-binaries/tag.txt")
export SKIA_BINARIES_KEY=$(cat "$(Build.ArtifactStagingDirectory)/skia-binaries/key.txt")
echo "##vso[task.setvariable variable=SKIA_BINARIES_TAG;]${SKIA_BINARIES_TAG}"
echo "##vso[task.setvariable variable=SKIA_BINARIES_KEY;]${SKIA_BINARIES_KEY}"
displayName: 'Build all targets in skia-safe for ${{ parameters.target }} with features "${{ parameters.features }}"'
- ${{ if eq(parameters.runClippy, True) }}:
- bash: |
set -e
set
(cd skia-bindings && cargo clippy --release --features "${{ parameters.features }}" --all-targets --target ${{ parameters.target }} -- -D warnings)
(cd skia-safe && cargo clippy --release --features "${{ parameters.features }}" --all-targets --target ${{ parameters.target }} -- -D warnings)
(cd skia-org && cargo clippy --release --features "${{ parameters.features }}" --all-targets --target ${{ parameters.target }} -- -D warnings)
displayName: 'Clippy skia-bindings, skia-safe, and skia-org'
- ${{ if eq(parameters.runBinaries, True) }}:
- script: cd skia-bindings && cargo test --release --features "${{ parameters.features }}" --target ${{ parameters.target }} -vv -- --test-threads=1 --nocapture
displayName: 'Test skia-bindings'
- script: cd skia-safe && cargo test --release --features "${{ parameters.features }}" --target ${{ parameters.target }} -vv -- --test-threads=1 --nocapture
displayName: 'Test skia-safe'
- ${{ if ne(parameters.exampleArgs, '') }}:
- script: cd skia-org && cargo run --release --features "${{ parameters.features }}" --target ${{ parameters.target }} "$(Build.ArtifactStagingDirectory)/skia-org" ${{ parameters.exampleArgs }}
displayName: 'Generate skia-org example images'
- task: PublishBuildArtifacts@1
inputs:
pathtoPublish: '$(Build.ArtifactStagingDirectory)/skia-org'
artifactName: 'skia-org-examples-$(platform)-$(toolchain)'
- ${{ if eq(parameters.releaseBinaries, 'True') }}:
- task: ArchiveFiles@2
displayName: 'Archive binaries (${{ parameters.target }})'
inputs:
rootFolderOrFile: '$(Build.ArtifactStagingDirectory)/skia-binaries'
archiveType: 'tar'
tarCompression: 'gz'
archiveFile: '$(Build.ArtifactStagingDirectory)/skia-binaries-$(SKIA_BINARIES_KEY).tar.gz'
- task: GithubRelease@0
displayName: 'Release to GitHub rust-skia/skia-binaries (${{ parameters.target }})'
inputs:
action: 'edit'
gitHubConnection: 'rust-skia-github-connection'
repositoryName: 'rust-skia/skia-binaries'
tagSource: 'manual'
target: 'master'
tag: '$(SKIA_BINARIES_TAG)'
assets: '$(Build.ArtifactStagingDirectory)/skia-binaries-$(SKIA_BINARIES_KEY).tar.gz'
assetUploadMode: 'replace'
isPreRelease: true
addChangeLog: false