Update Github CI configuration
This commit is contained in:
@@ -1,22 +0,0 @@
|
|||||||
name: 'cargo tarpaulin'
|
|
||||||
description: 'Gather Rust code coverage information with Tarpaulin'
|
|
||||||
inputs:
|
|
||||||
version:
|
|
||||||
description: 'The version of cargo-tarpaulin to install'
|
|
||||||
required: true
|
|
||||||
default: '0.19.0'
|
|
||||||
|
|
||||||
args:
|
|
||||||
required: false
|
|
||||||
description: 'Extra command line arguments passed to cargo-tarpaulin'
|
|
||||||
|
|
||||||
out-type:
|
|
||||||
description: 'Output format of coverage report [possible values: Json, Toml, Stdout, Xml, Html, Lcov]'
|
|
||||||
required: false
|
|
||||||
default: 'Xml'
|
|
||||||
|
|
||||||
runs:
|
|
||||||
using: 'composite'
|
|
||||||
steps:
|
|
||||||
- run: ${{ github.action_path }}/cargo-tarpaulin.sh ${{ inputs.out-type }} ${{ inputs.version }} ${{ inputs.args }}
|
|
||||||
shell: bash
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
sudo apt-get update -y
|
|
||||||
sudo apt-get install -y --no-install-recommends openssl taskwarrior
|
|
||||||
|
|
||||||
out_type="$1"
|
|
||||||
version="$2"
|
|
||||||
args="$3"
|
|
||||||
tar_file="cargo-tarpaulin-${version}-travis.tar.gz"
|
|
||||||
|
|
||||||
wget "https://github.com/xd009642/tarpaulin/releases/download/${version}/${tar_file}"
|
|
||||||
tar zxvf "$tar_file"
|
|
||||||
chmod +x cargo-tarpaulin
|
|
||||||
|
|
||||||
exec env RUST_LOG=debug ./cargo-tarpaulin tarpaulin --ignore-tests -o "$out_type" $args
|
|
||||||
10
.github/workflows/audit.yml
vendored
10
.github/workflows/audit.yml
vendored
@@ -10,7 +10,15 @@ jobs:
|
|||||||
security_audit:
|
security_audit:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v1
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
- name: Install Rust
|
||||||
|
uses: actions-rs/toolchain@v1
|
||||||
|
with:
|
||||||
|
toolchain: stable
|
||||||
|
profile: minimal
|
||||||
|
override: true
|
||||||
|
- uses: Swatinem/rust-cache@v1
|
||||||
- uses: actions-rs/audit-check@v1
|
- uses: actions-rs/audit-check@v1
|
||||||
with:
|
with:
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|||||||
118
.github/workflows/ci.yml
vendored
118
.github/workflows/ci.yml
vendored
@@ -1,57 +1,91 @@
|
|||||||
on: [push]
|
|
||||||
|
|
||||||
name: CI
|
name: CI
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
pull_request:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
format:
|
test:
|
||||||
name: rustfmt
|
name: Test Suite
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- name: Checkout repository
|
||||||
- uses: actions-rs/toolchain@v1
|
uses: actions/checkout@v3
|
||||||
with:
|
- name: Install Rust toolchain
|
||||||
toolchain: nightly
|
uses: actions-rs/toolchain@v1
|
||||||
components: rustfmt
|
|
||||||
override: true
|
|
||||||
- uses: LoliGothick/rustfmt-check@v0.2
|
|
||||||
with:
|
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
flags: --all
|
|
||||||
options: --manifest-path=Cargo.toml
|
|
||||||
|
|
||||||
build_and_test:
|
|
||||||
name: Build & test
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
|
|
||||||
- uses: actions-rs/toolchain@v1
|
|
||||||
with:
|
with:
|
||||||
toolchain: stable
|
toolchain: stable
|
||||||
components: clippy
|
profile: minimal
|
||||||
|
override: true
|
||||||
|
- uses: Swatinem/rust-cache@v1
|
||||||
- uses: actions-rs/cargo@v1
|
- uses: actions-rs/cargo@v1
|
||||||
with:
|
with:
|
||||||
command: build
|
command: test
|
||||||
args: --release --all-features
|
args: --all-features --workspace
|
||||||
|
|
||||||
- uses: actions-rs/clippy-check@v1
|
rustfmt:
|
||||||
|
name: Rustfmt
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
- name: Install Rust toolchain
|
||||||
|
uses: actions-rs/toolchain@v1
|
||||||
with:
|
with:
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
toolchain: stable
|
||||||
args: --tests -- -D warnings
|
profile: minimal
|
||||||
|
override: true
|
||||||
|
components: rustfmt
|
||||||
|
- uses: Swatinem/rust-cache@v1
|
||||||
|
- name: Check formatting
|
||||||
|
uses: actions-rs/cargo@v1
|
||||||
|
with:
|
||||||
|
command: fmt
|
||||||
|
args: --all -- --check
|
||||||
|
|
||||||
|
clippy:
|
||||||
|
name: Clippy
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
- name: Install Rust toolchain
|
||||||
|
uses: actions-rs/toolchain@v1
|
||||||
|
with:
|
||||||
|
toolchain: stable
|
||||||
|
profile: minimal
|
||||||
|
override: true
|
||||||
|
components: clippy
|
||||||
|
- uses: Swatinem/rust-cache@v1
|
||||||
|
- name: Clippy check
|
||||||
|
uses: actions-rs/cargo@v1
|
||||||
|
with:
|
||||||
|
command: clippy
|
||||||
|
args: --all-targets --all-features --workspace -- -D warnings
|
||||||
|
|
||||||
|
coverage:
|
||||||
|
name: Code coverage
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
- name: Install Rust toolchain
|
||||||
|
uses: actions-rs/toolchain@v1
|
||||||
|
with:
|
||||||
|
toolchain: stable
|
||||||
|
profile: minimal
|
||||||
|
override: true
|
||||||
|
- uses: Swatinem/rust-cache@v1
|
||||||
- name: Run cargo-tarpaulin
|
- name: Run cargo-tarpaulin
|
||||||
uses: ./.github/actions/cargo-tarpaulin-action/
|
uses: actions-rs/tarpaulin@v0.1
|
||||||
with:
|
with:
|
||||||
args: '-- --test-threads 1'
|
args: '--all-features --workspace --ignore-tests --out Lcov'
|
||||||
|
- name: Upload to Coveralls
|
||||||
- name: Upload to codecov.io
|
# upload only if push
|
||||||
uses: codecov/codecov-action@v1.0.2
|
if: ${{ github.event_name == 'push' }}
|
||||||
|
uses: coverallsapp/github-action@master
|
||||||
with:
|
with:
|
||||||
token: ${{secrets.CODECOV_TOKEN}}
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
path-to-lcov: './lcov.info'
|
||||||
- name: Archive code coverage results
|
|
||||||
uses: actions/upload-artifact@v1
|
|
||||||
with:
|
|
||||||
name: code-coverage-report
|
|
||||||
path: cobertura.xml
|
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ impl Settings {
|
|||||||
let config_file_required = file.is_some();
|
let config_file_required = file.is_some();
|
||||||
let config_path = env::var("CONFIG_PATH").unwrap_or_else(|_| "config".into());
|
let config_path = env::var("CONFIG_PATH").unwrap_or_else(|_| "config".into());
|
||||||
let config_file = file.unwrap_or_else(|| {
|
let config_file = file.unwrap_or_else(|| {
|
||||||
env::var("CONFIG_FILE").unwrap_or_else(|_| format!("{}/dev", &config_path).into())
|
env::var("CONFIG_FILE").unwrap_or_else(|_| format!("{}/dev", &config_path))
|
||||||
});
|
});
|
||||||
|
|
||||||
let default_config_file = format!("{}/default", config_path);
|
let default_config_file = format!("{}/default", config_path);
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ pub fn run(listener: TcpListener, settings: &Settings) -> Result<Server, std::io
|
|||||||
"Mounting static files on {}",
|
"Mounting static files on {}",
|
||||||
if path.is_empty() { "/" } else { &path }
|
if path.is_empty() { "/" } else { &path }
|
||||||
);
|
);
|
||||||
let static_scope = fs::Files::new(&path, &static_dir)
|
let static_scope = fs::Files::new(path, &static_dir)
|
||||||
.use_last_modified(true)
|
.use_last_modified(true)
|
||||||
.index_file("index.html");
|
.index_file("index.html");
|
||||||
app = app.service(static_scope);
|
app = app.service(static_scope);
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ fn setup_server(settings: &Settings) -> String {
|
|||||||
let listener = TcpListener::bind("127.0.0.1:0").expect("Failed to bind random port");
|
let listener = TcpListener::bind("127.0.0.1:0").expect("Failed to bind random port");
|
||||||
let port = listener.local_addr().unwrap().port();
|
let port = listener.local_addr().unwrap().port();
|
||||||
|
|
||||||
let server = contextswitch_api::run(listener, &settings).expect("Failed to bind address");
|
let server = contextswitch_api::run(listener, settings).expect("Failed to bind address");
|
||||||
let _ = tokio::spawn(server);
|
let _ = tokio::spawn(server);
|
||||||
format!("http://127.0.0.1:{}", port)
|
format!("http://127.0.0.1:{}", port)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user