From fd3fbbc2f643c4fbd1ddc9f9ac5f78221ce114da Mon Sep 17 00:00:00 2001 From: Jamie Brynes Date: Sun, 4 Oct 2020 15:12:56 +0100 Subject: [PATCH] Initial GitHub Actions CI configuration (#49) --- .github/workflows/premerge.yml | 58 ++++++++++++++++++++++++++++++++++ .travis.yml | 3 -- libs/badge/badge.rs | 5 ++- 3 files changed, 60 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/premerge.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/premerge.yml b/.github/workflows/premerge.yml new file mode 100644 index 0000000..9c94f40 --- /dev/null +++ b/.github/workflows/premerge.yml @@ -0,0 +1,58 @@ +name: Premerge + +on: + pull_request: + branches: [main] + push: + branches: [main] + schedule: + - cron: 0 0 1 * * + +jobs: + build-and-test: + runs-on: ubuntu-latest + steps: + - name: Checkout source + uses: actions/checkout@v2 + + - name: Install Rust toolchain + uses: actions-rs/toolchain@v1 + with: + toolchain: nightly-2020-09-27 + override: true + + - name: Build check + uses: actions-rs/cargo@v1 + with: + command: check + + - name: Tests + uses: actions-rs/cargo@v1 + with: + command: test + + linting: + if: ${{ github.ref != 'main' }} + runs-on: ubuntu-latest + steps: + - name: Checkout source + uses: actions/checkout@v2 + + - name: Install Rust toolchain + uses: actions-rs/toolchain@v1 + with: + toolchain: nightly-2020-09-27 + default: true + components: rustfmt, clippy + + - name: format + uses: actions-rs/cargo@v1 + with: + command: fmt + args: --all -- --check + + - name: clippy + uses: actions-rs/clippy-check@v1 + with: + token: ${{ secrets.GITHUB_TOKEN }} + args: -- -D warnings diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 0a62904..0000000 --- a/.travis.yml +++ /dev/null @@ -1,3 +0,0 @@ -language: rust -rust: nightly -cache: cargo diff --git a/libs/badge/badge.rs b/libs/badge/badge.rs index c28310c..923aed7 100644 --- a/libs/badge/badge.rs +++ b/libs/badge/badge.rs @@ -4,8 +4,7 @@ use base64::display::Base64Display; use once_cell::sync::Lazy; use rusttype::{point, Font, Point, PositionedGlyph, Scale}; -const FONT_DATA: &'static [u8] = - include_bytes!(concat!(env!("CARGO_MANIFEST_DIR"), "/DejaVuSans.ttf")); +const FONT_DATA: &[u8] = include_bytes!(concat!(env!("CARGO_MANIFEST_DIR"), "/DejaVuSans.ttf")); const FONT_SIZE: f32 = 11.; const SCALE: Scale = Scale { x: FONT_SIZE, @@ -45,7 +44,7 @@ static DATA: Lazy = Lazy::new(|| { BadgeStaticData { font, - scale: SCALE.clone(), + scale: SCALE, offset, } });