Update actions workflows

This commit is contained in:
Raphaël Thériault 2020-08-11 23:09:14 -04:00
parent 4bbf268196
commit 5143d47a88
5 changed files with 165 additions and 113 deletions

15
.github/workflows/audit.yml vendored Normal file
View File

@ -0,0 +1,15 @@
name: Security audit
on:
push:
paths:
- '**/Cargo.toml'
- '**/Cargo.lock'
jobs:
audit:
name: Security audit
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions-rs/audit-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}

89
.github/workflows/build.yml vendored Normal file
View File

@ -0,0 +1,89 @@
name: Build
on:
push:
branches:
- master
jobs:
build:
name: Build
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-musl
bin: target/release/filite
- os: windows-latest
target: x86_64-pc-windows-msvc
bin: target/release/filite.exe
- os: macOS-latest
target: x86_64-apple-darwin
bin: target/release/filite
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
target: ${{ matrix.target }}
override: true
- uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-build-${{ hashFiles('**/Cargo.lock') }}
- name: Build binary
uses: actions-rs/cargo@v1
with:
command: build
args: --release
- name: Strip binary
if: runner.os != 'Windows'
run: strip ${{ matrix.bin }}
- name: Upload binary
uses: actions/upload-artifact@v2
with:
name: filite-${{ matrix.target }}
path: ${{ matrix.bin }}
build-armv7:
name: Build (ARMv7)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
target: armv7-unknown-linux-musleabihf
override: true
- uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: build-armv7-${{ hashFiles('**/Cargo.lock') }}
- name: Build binary
uses: actions-rs/cargo@v1
with:
use-cross: true
command: build
args: --release --target armv7-unknown-linux-musleabihf
- name: Upload binary
uses: actions/upload-artifact@v2
with:
name: filite-armv7-unknown-linux-musleabihf
path: target/armv7-unknown-linux-musleabihf/release/filite

View File

@ -1,112 +0,0 @@
name: CI
on: [push, pull_request]
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
include:
- os: ubuntu-latest
bin-path: target/release/filite
- os: windows-latest
bin-path: target/release/filite.exe
- os: macOS-latest
bin-path: target/release/filite
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- uses: actions/cache@v1
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
- uses: actions/cache@v1
with:
path: ~/.cargo/git
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
- uses: actions/cache@v1
with:
path: target
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
- name: Build project
uses: actions-rs/cargo@v1
with:
command: build
args: --release
- name: Strip binary
if: runner.os != 'Windows'
run: strip ${{ matrix.bin-path }}
- name: Upload binary
uses: actions/upload-artifact@v1
with:
name: ${{ runner.os }}
path: ${{ matrix.bin-path }}
build-pi:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: armv7-unknown-linux-musleabihf
override: true
- uses: actions/cache@v1
with:
path: ~/.cargo/registry
key: pi-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
- uses: actions/cache@v1
with:
path: ~/.cargo/git
key: pi-cargo-index-${{ hashFiles('**/Cargo.lock') }}
- uses: actions/cache@v1
with:
path: target
key: pi-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
- name: Build project
uses: actions-rs/cargo@v1
with:
use-cross: true
command: build
args: --release --target armv7-unknown-linux-musleabihf
- name: Upload binary
uses: actions/upload-artifact@v1
with:
name: Pi
path: target/armv7-unknown-linux-musleabihf/release/filite
checks:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
components: clippy, rustfmt
override: true
- uses: actions/cache@v1
with:
path: ~/.cargo/registry
key: checks-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
- uses: actions/cache@v1
with:
path: ~/.cargo/git
key: checks-cargo-index-${{ hashFiles('**/Cargo.lock') }}
- uses: actions/cache@v1
with:
path: target
key: checks-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
- name: Run tests
uses: actions-rs/cargo@v1
with:
command: test
- name: Check for clippy warnings
uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Check formatting
uses: actions-rs/cargo@v1
with:
command: fmt
args: -- --check

60
.github/workflows/tests.yml vendored Normal file
View File

@ -0,0 +1,60 @@
name: Tests
on: [push, pull_request]
jobs:
tests:
name: Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
- uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: tests-${{ hashFiles('**/Cargo.lock') }}
- name: Run test suite
uses: actions-rs/cargo@v1
with:
command: test
checks:
name: Checks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
components: clippy, rustfmt
- uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: checks-${{ hashFiles('**/Cargo.lock') }}
- name: Check for clippy warnings
uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: -- -D warnings
- name: Check formatting
uses: actions-rs/cargo@v1
with:
command: fmt
args: -- --check

View File

@ -4,7 +4,7 @@
A flexible and standalone pastebin, URL shortener and file-sharing service that hosts **fi**les, redirects **li**nks and stores **te**xts.
[![GitHub Actions](https://github.com/raftario/filite/workflows/Build/badge.svg)](https://github.com/raftario/filite/actions?workflowID=Build)
[![GitHub Actions](https://img.shields.io/github/workflow/status/raftario/filite/Tests)](https://github.com/raftario/filite/actions?workflowID=Tests)
[![Crates.io](https://img.shields.io/crates/v/filite.svg)](https://crates.io/crates/filite)
[Live Example](https://filite.raphaeltheriault.com) (file upload disabled and rate limited)