Migrate CI to GitHub Actions

This commit migrates from Azure Pipelines to Github Actions for CI for
cranelift. The CI configuration was relatively straightforward, and the
intention here is not to change what's actually being done on CI, just
change where it's being done. The previous CI configuration had build
targets for producing releases, but these weren't actually applicable
for cranelift itself (mostly just copied from wasmtime), so they've been
folded into the main "test everything" matrix which now includes
`--release` mode items.

See cranestation/wasmtime#474 for some more context as well in terms of
benefits of Github Actions vs Azure Pipelines.
This commit is contained in:
Alex Crichton
2019-11-05 10:48:09 -08:00
committed by Andrew Brown
parent a49483408c
commit f0e90df9ac
4 changed files with 136 additions and 283 deletions

View File

@@ -1,66 +0,0 @@
steps:
- checkout: self
submodules: true
- template: azure-install-rust.yml
- bash: echo "##vso[task.setvariable variable=RUSTC_VERSION;]`rustc --version`"
displayName: Set rustc version string for caching
- bash: cargo build --release
displayName: Cargo build
# Test what we're about to release in release mode itself.
- bash: cargo test --release --all
displayName: Cargo test
env:
RUST_BACKTRACE: 1
- bash: |
echo "##vso[task.setvariable variable=tagName;]`echo $BUILD_SOURCEBRANCH | sed -e 's|refs/tags/||'`"
displayName: Set tag name
condition: startsWith(variables['Build.SourceBranch'], 'refs/tags/')
- bash: |
echo "##vso[task.setvariable variable=tagName;]dev"
displayName: Set tag name to "dev"
condition: not(startsWith(variables['Build.SourceBranch'], 'refs/tags/'))
- bash: echo "##vso[task.setvariable variable=basename;]cranelift-$(tagName)-x86_64-windows"
displayName: Configure basename var
condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT'))
- bash: echo "##vso[task.setvariable variable=basename;]cranelift-$(tagName)-x86_64-macos"
displayName: Configure basename var
condition: and(succeeded(), eq(variables['Agent.OS'], 'Darwin'))
- bash: echo "##vso[task.setvariable variable=basename;]cranelift-$(tagName)-x86_64-linux"
displayName: Configure basename var
condition: and(succeeded(), eq( variables['Agent.OS'], 'Linux' ))
- bash: |
set -e
mkdir -p $BUILD_BINARIESDIRECTORY/$BASENAME
if [ "$AGENT_OS" = "Windows_NT" ]; then
ext=.exe
fi
cp LICENSE README.md target/release/clif-util$ext $BUILD_BINARIESDIRECTORY/$BASENAME
displayName: Copy binaries
- task: ArchiveFiles@2
inputs:
rootFolderOrFile: $(Build.BinariesDirectory)/$(basename)
archiveType: 'zip'
archiveFile: '$(Build.ArtifactStagingDirectory)/$(basename).zip'
displayName: Archive files (Win)
condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT'))
- task: ArchiveFiles@2
inputs:
rootFolderOrFile: $(Build.BinariesDirectory)/$(basename)
archiveType: 'tar'
tarCompression: 'xz'
archiveFile: '$(Build.ArtifactStagingDirectory)/$(basename).tar.xz'
displayName: Archive files (Unix)
condition: and(succeeded(), ne(variables['Agent.OS'], 'Windows_NT'))
- task: PublishPipelineArtifact@1
inputs:
path: $(Build.ArtifactStagingDirectory)/
artifactName: 'bundle-$(Agent.OS)'

View File

@@ -1,33 +0,0 @@
steps:
# Rustup is currently installed on Windows and Linux, but not macOS.
# It is installed in /usr/local/cargo/bin/ or C:\Program Files\Rust\.cargo\bin\
# This steps ensures that rustup is installed, mainly for macOS, or if the
# azure image changes in the future.
- bash: |
set -ex
if [ -x "`command -v rustup`" ]; then
echo `command -v rustup` `rustup -V` already installed
rustup self update
else
if [ "$AGENT_OS" = "Windows_NT" ]; then
curl -sSf -o rustup-init.exe https://win.rustup.rs
./rustup-init.exe -y --default-toolchain $TOOLCHAIN
echo "##vso[task.prependpath]$USERPROFILE/.cargo/bin"
else
curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain $TOOLCHAIN
echo "##vso[task.prependpath]$HOME/.cargo/bin"
fi
fi
displayName: Install rustup
- bash: |
set -ex
rustup update $TOOLCHAIN
rustup default $TOOLCHAIN
displayName: Install rust
- bash: |
set -ex
rustc -Vv
cargo -V
displayName: Query rust and cargo versions