Migrate CI to Github Actions.

This commit is contained in:
Sergio Benitez 2020-07-11 12:56:33 -07:00
parent f4c82d7ffe
commit 854e90d39f
4 changed files with 73 additions and 100 deletions

View File

@ -1,73 +0,0 @@
jobs:
- job: ${{ parameters.name }}
pool:
vmImage: ${{ parameters.vmImage }}
strategy:
matrix:
debug:
test_flag: ""
test_kind: Debug
rust_version: nightly
release:
test_flag: "--release"
test_kind: Release
rust_version: nightly
contrib:
test_flag: "--contrib"
test_kind: Contrib
rust_version: nightly
maxParallel: 3
steps:
# maxOS native dependency installation
- ${{ if eq(parameters.name, 'macOS') }}:
- script: |
brew install mysql-client libpq sqlite coreutils
echo "##vso[task.setvariable variable=PATH]$PATH:/usr/local/opt/mysql-client/bin"
displayName: 'Install Native Dependencies'
# Linux native dependency installation
- ${{ if eq(parameters.name, 'Linux') }}:
- script: |
sudo apt-get update
sudo apt-get install -y libmariadb-client-lgpl-dev-compat libpq-dev libsqlite3-dev
displayName: 'Install Native Dependencies'
# Windows native dependency installation
# vcpkg --triplet x64-windows install libmysql libpq sqlite3 openssl
# + vcpkg/installed/vcpkg (in particular, the status file)
- ${{ if eq(parameters.name, 'Windows') }}:
- script: |
curl -fsS -o vcpkg.7z https://rocket.rs/static/vcpkg-2019-07-05.7z
7z x vcpkg.7z -y -bb0
xcopy .\vcpkg %VCPKG_INSTALLATION_ROOT% /s /e /h /y /q
vcpkg integrate install
echo ##vso[task.setvariable variable=VCPKGRS_DYNAMIC]1
echo ##vso[task.setvariable variable=PATH]%PATH%;%VCPKG_INSTALLATION_ROOT%\installed\x64-windows\lib
echo ##vso[task.setvariable variable=VCPKG_ROOT]%VCPKG_INSTALLATION_ROOT%
displayName: "Install Native Dependencies"
# Unix Rust installation
- ${{ if ne(parameters.name, 'Windows') }}:
- script: |
curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain $(rust_version)
echo "##vso[task.setvariable variable=PATH]$PATH:$HOME/.cargo/bin"
displayName: 'Install Rust ($(rust_version))'
# Windows Rust installation
- ${{ if eq(parameters.name, 'Windows') }}:
- script: |
curl -sSf -o rustup-init.exe https://win.rustup.rs
rustup-init.exe -y --default-host x86_64-pc-windows-msvc --default-toolchain $(rust_version)
echo ##vso[task.setvariable variable=PATH]%PATH%;%USERPROFILE%\.cargo\bin
displayName: 'Install Rust ($(rust_version))'
# Sanity check version information.
- script: |
rustup default $(rust_version)
rustc -Vv && cargo -V
displayName: 'Rust/Cargo Version Information'
# Run Rocket testing script(s)
- script: bash scripts/test.sh $(test_flag)
displayName: 'Unit Tests ($(test_kind))'

View File

@ -1,26 +0,0 @@
name: Rocket
schedules:
- cron: "0 4 * * *"
displayName: Nightly 4AM UTC Build
branches:
include:
- master
- v0.4
always: true
jobs:
- template: azure-pipelines-template.yml
parameters:
name: macOS
vmImage: macOS-10.14
- template: azure-pipelines-template.yml
parameters:
name: Linux
vmImage: ubuntu-16.04
- template: azure-pipelines-template.yml
parameters:
name: Windows
vmImage: windows-2019

72
.github/workflows/test.yml vendored Normal file
View File

@ -0,0 +1,72 @@
name: Test
on: [push, pull_request]
env:
CARGO_TERM_COLOR: always
jobs:
test:
name: "${{ matrix.os.name }} ${{ matrix.test.name }}"
strategy:
matrix:
os:
- name: Linux
distro: ubuntu-latest
- name: Windows
distro: windows-latest
- name: macOS
distro: macOS-latest
toolchain:
- nightly
test:
- name: Debug
flag:
- name: Release
flag: "--release"
- name: Core
flag: "--core"
- name: Contrib
flag: "--contrib"
runs-on: ${{ matrix.os.distro }}
steps:
- name: Checkout Sources
uses: actions/checkout@v2
- name: Install Native Dependencies (macOS)
if: matrix.os.name == 'macOS'
run: |
brew install mysql-client libpq sqlite coreutils
echo "::add-path::/usr/local/opt/mysql-client/bin"
# vcpkg --triplet x64-windows install libmysql libpq sqlite3 openssl
# + vcpkg/installed/vcpkg (in particular, the status file)
- name: Install Native Dependencies (Windows)
if: matrix.os.name == 'Windows'
run: |
curl -fsS -o vcpkg.7z https://rocket.rs/static/vcpkg-2019-07-05.7z
7z x vcpkg.7z -y -bb0
xcopy .\vcpkg $env:VCPKG_INSTALLATION_ROOT /s /e /h /y /q
vcpkg integrate install
echo "::set-env name=VCPKGRS_DYNAMIC::1"
echo "::set-env name=VCPKG_ROOT::$env:VCPKG_INSTALLATION_ROOT"
echo "::add-path::$env:VCPKG_INSTALLATION_ROOT\installed\x64-windows\lib"
- name: Install Native Dependencies (Linux)
if: matrix.os.name == 'Linux'
run: |
sudo apt-get install -y libmariadb-client-lgpl-dev-compat libpq-dev libsqlite3-dev
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.toolchain }}
override: true
- name: Run Tests
run: ./scripts/test.sh ${{ matrix.test.flag }}
shell: bash

View File

@ -1,6 +1,6 @@
# Rocket
[![Build Status](https://dev.azure.com/SergioBenitez/Rocket/_apis/build/status/SergioBenitez.Rocket?branchName=master)](https://dev.azure.com/SergioBenitez/Rocket/_build/latest?definitionId=3&branchName=master)
[![Build Status](https://github.com/SergioBenitez/Rocket/workflows/Test/badge.svg)](https://github.com/SergioBenitez/Rocket/actions)
[![Rocket Homepage](https://img.shields.io/badge/web-rocket.rs-red.svg?style=flat&label=https&colorB=d33847)](https://rocket.rs)
[![Current Crates.io Version](https://img.shields.io/crates/v/rocket.svg)](https://crates.io/crates/rocket)
[![Matrix: #rocket:mozilla.org](https://img.shields.io/badge/style-%23rocket:mozilla.org-blue.svg?style=flat&label=[m])](https://chat.mozilla.org/#/room/#rocket:mozilla.org)