Initial GitHub Actions CI configuration (#49)

This commit is contained in:
Jamie Brynes 2020-10-04 15:12:56 +01:00 committed by GitHub
parent 12bb5c609d
commit fd3fbbc2f6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 60 additions and 6 deletions

58
.github/workflows/premerge.yml vendored Normal file
View file

@ -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

View file

@ -1,3 +0,0 @@
language: rust
rust: nightly
cache: cargo

View file

@ -4,8 +4,7 @@ use base64::display::Base64Display;
use once_cell::sync::Lazy; use once_cell::sync::Lazy;
use rusttype::{point, Font, Point, PositionedGlyph, Scale}; use rusttype::{point, Font, Point, PositionedGlyph, Scale};
const FONT_DATA: &'static [u8] = const FONT_DATA: &[u8] = include_bytes!(concat!(env!("CARGO_MANIFEST_DIR"), "/DejaVuSans.ttf"));
include_bytes!(concat!(env!("CARGO_MANIFEST_DIR"), "/DejaVuSans.ttf"));
const FONT_SIZE: f32 = 11.; const FONT_SIZE: f32 = 11.;
const SCALE: Scale = Scale { const SCALE: Scale = Scale {
x: FONT_SIZE, x: FONT_SIZE,
@ -45,7 +44,7 @@ static DATA: Lazy<BadgeStaticData> = Lazy::new(|| {
BadgeStaticData { BadgeStaticData {
font, font,
scale: SCALE.clone(), scale: SCALE,
offset, offset,
} }
}); });