Migrate from Azure Pipelines to Github Actions (#474)
This commit migrates wasmtime's CI infrastructure from Azure Pipelines to Github Actions. Using Github Actions has a few benefits over other offerings: * Being natively integrated with Github means that there's no degree of user account configuration or access control management, it's all inherent via already existing Github permissions. * Github Actions gives 20 parallel builders instead of Azure's 10 by default, which is a nice boost to have! Overall I've found Github Actions to feel a bit cleaner than Azure Pipelines as well. Subjectively I've found the configuration to be more readable and more pleasant to work with, although they're both just as "powerful" I think. Additionally Github Actions has been pretty solid in my own personal testing for a number of other projects. The main trickiness with wasmtime's CI is the rolling `dev` release of the master branch as well as binary releases for tags. Github Actions doesn't have quite as much built in functionality as Azure Pipelines, but Github Actions does have a nice feature where you can define the code for an action locally rather than only using built-in actions. This migration adds three local actions with some associated JS code to run the action (currently it looks like it basically requires JS) * An `install-rust` action papers over the gotchas about installing Rust, allowing Rust installation to be a one-liner in the configuration. * A `binary-compatible-builds` action allows easily configuring the wheels and the binaries to be "more binary compatible" and handles things like compilation flags on OSX and Windows while handling the `centos:6` container on Linux. * The `github-release` action is the logic using the `@actions/github` JS package to orchestrate the custom way we manage rolling releases, ensuring that a new release is made for the master branch under `dev` (deleting the previous tag/release ahead of time) and then also manages tagged releases by uploading them there. I'm hoping that most of the inline actions here will largely go away. For example `install-rust` should be simply `rustup update $toolchain` once various environment issues are fixed on Github Actions runner images. Additionally `github-release` will ideally migrate to something like https://github.com/actions/create-release or similar once it has enough functionality. I'm also hoping that the maintenance in the meantime of these actions is pretty low-cost, but if it becomes an issue we can look into other solutions!
This commit is contained in:
committed by
Dan Gohman
parent
c0c7851cb6
commit
10f27197b5
18
.github/actions/install-rust/README.md
vendored
Normal file
18
.github/actions/install-rust/README.md
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
# install-rust
|
||||
|
||||
A small github action to install `rustup` and a Rust toolchain. This is
|
||||
generally expressed inline, but it was repeated enough in this repository it
|
||||
seemed worthwhile to extract.
|
||||
|
||||
Some gotchas:
|
||||
|
||||
* Can't `--self-update` on Windows due to permission errors (a bug in Github
|
||||
Actions)
|
||||
* `rustup` isn't installed on macOS (a bug in Github Actions)
|
||||
|
||||
When the above are fixed we should delete this action and just use this inline:
|
||||
|
||||
```yml
|
||||
- run: rustup update $toolchain && rustup default $toolchain
|
||||
shell: bash
|
||||
```
|
||||
12
.github/actions/install-rust/action.yml
vendored
Normal file
12
.github/actions/install-rust/action.yml
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
name: 'Install Rust toolchain'
|
||||
description: 'Install both `rustup` and a Rust toolchain'
|
||||
|
||||
inputs:
|
||||
toolchain:
|
||||
description: 'Default toolchan to install'
|
||||
required: false
|
||||
default: 'stable'
|
||||
|
||||
runs:
|
||||
using: node12
|
||||
main: 'main.js'
|
||||
17
.github/actions/install-rust/main.js
vendored
Normal file
17
.github/actions/install-rust/main.js
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
const child_process = require('child_process');
|
||||
const toolchain = process.env.INPUT_TOOLCHAIN;
|
||||
|
||||
for (var i = 0, keys = Object.keys(process.env), ii = keys.length; i < ii; i++) {
|
||||
console.log(keys[i] + '=' + process.env[keys[i]]);
|
||||
}
|
||||
|
||||
if (process.platform === 'darwin') {
|
||||
child_process.execSync(`curl https://sh.rustup.rs | sh -s -- -y --default-toolchain=none --profile=minimal`);
|
||||
const bindir = `${process.env.HOME}/.cargo/bin`;
|
||||
console.log(`::add-path::${bindir}`);
|
||||
process.env.PATH = `${process.env.PATH}:${bindir}`;
|
||||
child_process.execFileSync('rustup', ['set', 'profile', 'minimal']);
|
||||
}
|
||||
|
||||
child_process.execFileSync('rustup', ['update', toolchain, '--no-self-update']);
|
||||
child_process.execFileSync('rustup', ['default', toolchain]);
|
||||
Reference in New Issue
Block a user