diff --git a/.github/workflows/test.yml b/.github/workflows/ci.yml similarity index 58% rename from .github/workflows/test.yml rename to .github/workflows/ci.yml index 41d16851..736e7392 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/ci.yml @@ -1,4 +1,4 @@ -name: Test +name: CI on: [push, pull_request] @@ -7,28 +7,39 @@ env: jobs: test: - name: "${{ matrix.os.name }} ${{ matrix.test.name }}" + name: "${{ matrix.os.name }} ${{ matrix.test.name }} (${{ matrix.toolchain }})" strategy: + fail-fast: false matrix: os: - - name: Linux - distro: ubuntu-latest - - name: Windows - distro: windows-latest - - name: macOS - distro: macOS-latest - toolchain: - - nightly + - { name: Linux, distro: ubuntu-latest } + - { name: Windows, distro: windows-latest } + - { name: macOS, distro: macOS-latest } test: - - name: Debug - flag: - - name: Release - flag: "--release" - - name: Core - flag: "--core" - - name: Contrib - flag: "--contrib" + - { name: Debug, flag: } + - { name: Contrib, flag: "--contrib" } + toolchain: [stable] + allow-failures: [false] + include: + - toolchain: stable + os: { name: Linux, distro: ubuntu-latest } + test: { name: Core, flag: "--core" } + allow-failures: false + - toolchain: stable + os: { name: Linux, distro: ubuntu-latest } + test: { name: Release, flag: "--release" } + allow-failures: false + - toolchain: nightly + os: { name: Linux, distro: ubuntu-latest } + test: { name: Debug, flag: } + allow-failures: true + - toolchain: nightly + os: { name: Linux, distro: ubuntu-latest } + test: { name: Contrib, flag: "--contrib" } + allow-failures: true + + continue-on-error: ${{ matrix.allow-failures }} runs-on: ${{ matrix.os.distro }} diff --git a/README.md b/README.md index 111e8f78..b44d3648 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Rocket -[![Build Status](https://github.com/SergioBenitez/Rocket/workflows/Test/badge.svg)](https://github.com/SergioBenitez/Rocket/actions) +[![Build Status](https://github.com/SergioBenitez/Rocket/workflows/CI/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) diff --git a/contrib/codegen/Cargo.toml b/contrib/codegen/Cargo.toml index 51bea643..fcdddd82 100644 --- a/contrib/codegen/Cargo.toml +++ b/contrib/codegen/Cargo.toml @@ -9,7 +9,6 @@ repository = "https://github.com/SergioBenitez/Rocket" readme = "../../README.md" keywords = ["rocket", "contrib", "code", "generation", "proc-macro"] license = "MIT OR Apache-2.0" -build = "build.rs" edition = "2018" [features] @@ -22,10 +21,6 @@ proc-macro = true quote = "1.0" devise = { git = "https://github.com/SergioBenitez/Devise.git", rev = "1e42a2691" } -[build-dependencies] -yansi = "0.5" -version_check = "0.9.1" - [dev-dependencies] rocket = { version = "0.5.0-dev", path = "../../core/lib" } rocket_contrib = { version = "0.5.0-dev", path = "../lib", features = ["diesel_sqlite_pool"] } diff --git a/contrib/codegen/build.rs b/contrib/codegen/build.rs deleted file mode 100644 index ea7cb833..00000000 --- a/contrib/codegen/build.rs +++ /dev/null @@ -1,40 +0,0 @@ -//! Ensures Rocket isn't compiled with an incompatible version of Rust. - -extern crate yansi; -extern crate version_check; - -use yansi::{Paint, Color::{Red, Yellow, Blue}}; - -// Specifies the minimum nightly version needed to compile Rocket. -const MIN_DATE: &'static str = "2020-05-20"; -const MIN_VERSION: &'static str = "1.45.0-nightly"; - -macro_rules! err { - ($version:expr, $date:expr, $msg:expr) => ( - eprintln!("{} {}", Red.paint("Error:").bold(), Paint::new($msg).bold()); - eprintln!("Installed version: {}", Yellow.paint(format!("{} ({})", $version, $date))); - eprintln!("Minimum required: {}", Yellow.paint(format!("{} ({})", MIN_VERSION, MIN_DATE))); - ) -} - -fn main() { - if let Some((version, channel, date)) = version_check::triple() { - if !channel.supports_features() { - err!(version, date, "Rocket requires a 'dev' or 'nightly' version of rustc."); - - eprint!("{}", Blue.paint("See the getting started guide (")); - eprint!("https://rocket.rs/v0.5/guide/getting-started/"); - eprintln!("{}", Blue.paint(") for more information.")); - - panic!("Aborting compilation due to incompatible compiler.") - } - - if !version.at_least(MIN_VERSION) || !date.at_least(MIN_DATE) { - err!(version, date, "Rocket requires a more recent version of rustc."); - panic!("Aborting compilation due to incompatible compiler.") - } - } else { - println!("cargo:warning={}", "Rocket was unable to check rustc compiler compatibility."); - println!("cargo:warning={}", "Build may fail due to incompatible rustc version."); - } -} diff --git a/core/codegen/Cargo.toml b/core/codegen/Cargo.toml index 7c5dd0f0..5211dcdc 100644 --- a/core/codegen/Cargo.toml +++ b/core/codegen/Cargo.toml @@ -9,7 +9,6 @@ repository = "https://github.com/SergioBenitez/Rocket" readme = "../../README.md" keywords = ["rocket", "web", "framework", "code", "generation"] license = "MIT OR Apache-2.0" -build = "build.rs" edition = "2018" [lib] @@ -22,10 +21,6 @@ rocket_http = { version = "0.5.0-dev", path = "../http/" } devise = { git = "https://github.com/SergioBenitez/Devise.git", rev = "1e42a2691" } glob = "0.3" -[build-dependencies] -yansi = "0.5" -version_check = "0.9.1" - [dev-dependencies] rocket = { version = "0.5.0-dev", path = "../lib" } version_check = "0.9" diff --git a/core/codegen/build.rs b/core/codegen/build.rs deleted file mode 100644 index d44a1b92..00000000 --- a/core/codegen/build.rs +++ /dev/null @@ -1,37 +0,0 @@ -//! Ensures Rocket isn't compiled with an incompatible version of Rust. - -use yansi::{Paint, Color::{Red, Yellow, Blue}}; - -// Specifies the minimum nightly version needed to compile Rocket. -const MIN_DATE: &'static str = "2020-05-20"; -const MIN_VERSION: &'static str = "1.45.0-nightly"; - -macro_rules! err { - ($version:expr, $date:expr, $msg:expr) => ( - eprintln!("{} {}", Red.paint("Error:").bold(), Paint::new($msg).bold()); - eprintln!("Installed version: {}", Yellow.paint(format!("{} ({})", $version, $date))); - eprintln!("Minimum required: {}", Yellow.paint(format!("{} ({})", MIN_VERSION, MIN_DATE))); - ) -} - -fn main() { - if let Some((version, channel, date)) = version_check::triple() { - if !channel.supports_features() { - err!(version, date, "Rocket (codegen) requires a 'dev' or 'nightly' version of rustc."); - - eprint!("{}", Blue.paint("See the getting started guide (")); - eprint!("https://rocket.rs/v0.5/guide/getting-started/"); - eprintln!("{}", Blue.paint(") for more information.")); - - panic!("Aborting compilation due to incompatible compiler.") - } - - if !version.at_least(MIN_VERSION) || !date.at_least(MIN_DATE) { - err!(version, date, "Rocket (codegen) requires a more recent version of rustc."); - panic!("Aborting compilation due to incompatible compiler.") - } - } else { - println!("cargo:warning={}", "Rocket was unable to check rustc compiler compatibility."); - println!("cargo:warning={}", "Build may fail due to incompatible rustc version."); - } -} diff --git a/core/lib/build.rs b/core/lib/build.rs index 5c70dd71..e3f8605d 100644 --- a/core/lib/build.rs +++ b/core/lib/build.rs @@ -1,34 +1,21 @@ //! Ensures Rocket isn't compiled with an incompatible version of Rust. -use yansi::{Paint, Color::{Red, Yellow, Blue}}; +use yansi::{Paint, Color::{Red, Yellow}}; -// Specifies the minimum nightly version needed to compile Rocket. - -const MIN_DATE: &'static str = "2020-05-20"; -const MIN_VERSION: &'static str = "1.45.0-nightly"; +const MIN_VERSION: &'static str = "1.45.0"; macro_rules! err { - ($version:expr, $date:expr, $msg:expr) => ( + ($version:expr, $msg:expr) => ( eprintln!("{} {}", Red.paint("Error:").bold(), Paint::new($msg).bold()); - eprintln!("Installed version: {}", Yellow.paint(format!("{} ({})", $version, $date))); - eprintln!("Minimum required: {}", Yellow.paint(format!("{} ({})", MIN_VERSION, MIN_DATE))); + eprintln!("Installed version: {}", Yellow.paint(format!("{}", $version))); + eprintln!("Minimum required: {}", Yellow.paint(format!("{}", MIN_VERSION))); ) } fn main() { - if let Some((version, channel, date)) = version_check::triple() { - if !channel.supports_features() { - err!(version, date, "Rocket (core) requires a 'dev' or 'nightly' version of rustc."); - - eprint!("{}", Blue.paint("See the getting started guide (")); - eprint!("https://rocket.rs/v0.5/guide/getting-started/"); - eprintln!("{}", Blue.paint(") for more information.")); - - panic!("Aborting compilation due to incompatible compiler.") - } - - if !version.at_least(MIN_VERSION) || !date.at_least(MIN_DATE) { - err!(version, date, "Rocket (core) requires a more recent version of rustc."); + if let Some(version) = version_check::Version::read() { + if !version.at_least(MIN_VERSION) { + err!(version, "Rocket requires a more recent version of rustc."); panic!("Aborting compilation due to incompatible compiler.") } } else {