From 854e90d39f2ee5f325bc668b5b2ab8954cdbf5e4 Mon Sep 17 00:00:00 2001 From: Sergio Benitez Date: Sat, 11 Jul 2020 12:56:33 -0700 Subject: [PATCH] Migrate CI to Github Actions. --- .github/azure-pipelines-template.yml | 73 ---------------------------- .github/azure-pipelines.yml | 26 ---------- .github/workflows/test.yml | 72 +++++++++++++++++++++++++++ README.md | 2 +- 4 files changed, 73 insertions(+), 100 deletions(-) delete mode 100644 .github/azure-pipelines-template.yml delete mode 100644 .github/azure-pipelines.yml create mode 100644 .github/workflows/test.yml diff --git a/.github/azure-pipelines-template.yml b/.github/azure-pipelines-template.yml deleted file mode 100644 index 005e8f8e..00000000 --- a/.github/azure-pipelines-template.yml +++ /dev/null @@ -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))' diff --git a/.github/azure-pipelines.yml b/.github/azure-pipelines.yml deleted file mode 100644 index 793944b3..00000000 --- a/.github/azure-pipelines.yml +++ /dev/null @@ -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 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 00000000..41d16851 --- /dev/null +++ b/.github/workflows/test.yml @@ -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 diff --git a/README.md b/README.md index cb5d1f0e..f41f5cd4 100644 --- a/README.md +++ b/README.md @@ -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)