-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
27 changed files
with
454 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[alias] | ||
xtask = "run --package xtask --" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
integration/snapshots/*.snap filter=lfs diff=lfs merge=lfs -text |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,67 +38,24 @@ jobs: | |
export VERSIONS=$(echo $RAW_VERSIONS | jq -scR 'rtrimstr("\n")|split(" ")|.') | ||
echo "versions=$VERSIONS" >> "$GITHUB_OUTPUT" | ||
rustfmt: | ||
checks: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- uses: actions-rs/toolchain@v1 | ||
id: toolchain | ||
with: | ||
toolchain: ${{ env.RUST_NIGHTLY_TOOLCHAIN }} | ||
profile: minimal | ||
override: true | ||
components: rustfmt | ||
|
||
- name: Run cargo fmt | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
command: fmt | ||
args: --all -- --check | ||
|
||
clippy: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
include: | ||
- toolchain: stable | ||
# fail on stable warnings | ||
args: "-D warnings" | ||
- toolchain: beta | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
submodules: true | ||
|
||
- uses: actions-rs/[email protected] | ||
id: toolchain | ||
with: | ||
toolchain: ${{ matrix.toolchain }} | ||
profile: minimal | ||
override: true | ||
components: clippy | ||
|
||
- uses: camshaft/rust-cache@v1 | ||
|
||
- name: Cache node_modules | ||
uses: actions/[email protected] | ||
continue-on-error: true | ||
with: | ||
path: duvet/www/node_modules | ||
key: node-modules-${{ runner.os }}-${{ hashFiles('duvet/www/package-lock.json') }} | ||
- name: Install rustfmt toolchain | ||
run: | | ||
rustup toolchain install ${{ env.RUST_NIGHTLY_TOOLCHAIN }} --profile minimal --component rustfmt | ||
rustup override set ${{ env.RUST_NIGHTLY_TOOLCHAIN }} | ||
- name: Build script.js | ||
- name: Install clippy toolchain | ||
run: | | ||
make duvet/www/public/script.js | ||
rustup toolchain install stable --profile minimal --component clippy | ||
rustup override set stable | ||
# TODO translate json reports to in-action warnings | ||
- name: Run cargo clippy | ||
uses: actions-rs/[email protected] | ||
with: | ||
command: clippy | ||
args: --all-features --all-targets -- -A clippy::uninlined_format_args ${{ matrix.args }} | ||
- name: Run checks | ||
run: | | ||
cargo xtask checks --rustfmt-toolchain ${{ env.RUST_NIGHTLY_TOOLCHAIN }} | ||
udeps: | ||
runs-on: ubuntu-latest | ||
|
@@ -107,12 +64,11 @@ jobs: | |
with: | ||
submodules: true | ||
|
||
- uses: actions-rs/toolchain@v1.0.7 | ||
- name: Install toolchain | ||
id: toolchain | ||
with: | ||
toolchain: ${{ env.RUST_NIGHTLY_TOOLCHAIN }} | ||
profile: minimal | ||
override: true | ||
run: | | ||
rustup toolchain install ${{ env.RUST_NIGHTLY_TOOLCHAIN }} --profile minimal | ||
rustup override set ${{ env.RUST_NIGHTLY_TOOLCHAIN }} | ||
- uses: camshaft/rust-cache@v1 | ||
|
||
|
@@ -129,7 +85,7 @@ jobs: | |
|
||
- name: Build script.js | ||
run: | | ||
make duvet/www/public/script.js | ||
cargo xtask build | ||
- name: Run cargo udeps | ||
run: cargo udeps --workspace --all-targets | ||
|
@@ -148,11 +104,11 @@ jobs: | |
with: | ||
lfs: true | ||
|
||
- uses: actions-rs/toolchain@v1 | ||
- name: Install toolchain | ||
id: toolchain | ||
with: | ||
toolchain: ${{ matrix.rust }} | ||
override: true | ||
run: | | ||
rustup toolchain install ${{ matrix.rust }} | ||
rustup override set ${{ matrix.rust }} | ||
- uses: camshaft/rust-cache@v1 | ||
with: | ||
|
@@ -165,14 +121,9 @@ jobs: | |
path: duvet/www/node_modules | ||
key: node-modules-${{ runner.os }}-${{ hashFiles('duvet/www/package-lock.json') }} | ||
|
||
- name: Build script.js | ||
- name: Run tests | ||
run: | | ||
make duvet/www/public/script.js | ||
- name: Run cargo test | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
command: test | ||
cargo xtask test | ||
action: # make sure the action works on a clean machine without building | ||
runs-on: ubuntu-latest | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,4 @@ | |
Cargo.lock | ||
target | ||
.history | ||
*.snap.new |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ members = [ | |
"duvet", | ||
"duvet-core", | ||
"duvet-macros", | ||
"xtask", | ||
] | ||
resolver = "2" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
integration/aws-cryptographic-material-providers-library.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
name = "aws-cryptographic-material-providers-library" | ||
repo = "https://github.com/aws/aws-cryptographic-material-providers-library" | ||
version = "v1.7.0" | ||
cmd = [ | ||
"make duvet" | ||
] | ||
html_report = "specification_compliance_report.html" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
name = "aws-database-encryption-sdk-dynamodb" | ||
repo = "https://github.com/aws/aws-database-encryption-sdk-dynamodb" | ||
version = "v3.7.0" | ||
cmd = [ | ||
"make duvet" | ||
] | ||
html_report = "specification_compliance_report.html" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
name = "aws-encryption-sdk-dafny" | ||
repo = "https://github.com/aws/aws-encryption-sdk-dafny" | ||
version = "v4.1.0" | ||
cmd = [ | ||
"make duvet" | ||
] | ||
html_report = "specification_compliance_report.html" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
name = "h3" | ||
repo = "https://github.com/hyperium/h3" | ||
version = "c6b92cbca902a62850b72269384fcbc32d30cb96" | ||
cmd = [ | ||
"bash ci/compliance/extract.sh", | ||
"bash ci/compliance/report.sh", | ||
] | ||
html_report = "ci/compliance/report.html" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
name = "s2n-quic" | ||
repo = "https://github.com/aws/s2n-quic" | ||
version = "005f9461612df4f882b91844fa978a5ee603e9f8" | ||
cmd = ["bash scripts/compliance"] | ||
html_report = "target/compliance/report.html" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
name = "s2n-tls" | ||
repo = "https://github.com/aws/s2n-tls" | ||
version = "v1.5.5" | ||
cmd = ["bash compliance/generate_report.sh"] | ||
html_report = "compliance/report.html" |
3 changes: 3 additions & 0 deletions
3
integration/snapshots/aws-cryptographic-material-providers-library.snap
Git LFS file not shown
3 changes: 3 additions & 0 deletions
3
integration/snapshots/aws-database-encryption-sdk-dynamodb.snap
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
[package] | ||
name = "xtask" | ||
edition = "2021" | ||
publish = false | ||
|
||
[dependencies] | ||
anyhow = "1" | ||
clap = { version = "4", features = ["derive"] } | ||
insta = { version = "1", features = ["json"] } | ||
serde = { version = "1", features = ["derive"] } | ||
serde_json = "1" | ||
toml = "0.8" | ||
xshell = "0.2" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
use crate::Result; | ||
use clap::Parser; | ||
use xshell::Shell; | ||
|
||
#[derive(Debug, Parser)] | ||
pub enum Args { | ||
Build(crate::build::Build), | ||
Changelog(crate::changelog::Changelog), | ||
Checks(crate::checks::Checks), | ||
Publish(crate::publish::Publish), | ||
Test(crate::tests::Tests), | ||
} | ||
|
||
impl Args { | ||
pub fn run(&self, sh: &Shell) -> Result { | ||
match self { | ||
Args::Build(args) => args.run(sh).map(|_| ()), | ||
Args::Changelog(args) => args.run(sh), | ||
Args::Checks(args) => args.run(sh), | ||
Args::Publish(args) => args.run(sh), | ||
Args::Test(args) => args.run(sh), | ||
} | ||
} | ||
} | ||
|
||
pub trait FlagExt { | ||
fn is_enabled(&self, default: bool) -> bool; | ||
} | ||
|
||
impl FlagExt for Option<bool> { | ||
fn is_enabled(&self, default: bool) -> bool { | ||
match self { | ||
Some(v) => *v, | ||
None => default, | ||
} | ||
} | ||
} | ||
|
||
/// Allows for argument flexibility | ||
/// * `duvet` -> default | ||
/// * `duvet --foo` -> true | ||
/// * `duvet --foo=true` -> true | ||
/// * `duvet --foo=false` -> false | ||
impl FlagExt for Option<Option<bool>> { | ||
fn is_enabled(&self, default: bool) -> bool { | ||
match self { | ||
Some(Some(v)) => *v, | ||
Some(None) => true, | ||
None => default, | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
use crate::{args::FlagExt as _, Result}; | ||
use clap::Parser; | ||
use std::path::PathBuf; | ||
use xshell::{cmd, Shell}; | ||
|
||
#[derive(Debug, Default, Parser)] | ||
pub struct Build { | ||
#[clap(long)] | ||
pub release: Option<Option<bool>>, | ||
} | ||
|
||
impl Build { | ||
pub fn run(&self, sh: &Shell) -> Result<PathBuf> { | ||
{ | ||
let _dir = sh.push_dir("duvet/www"); | ||
cmd!(sh, "make").run()?; | ||
} | ||
|
||
let mut args = vec![]; | ||
|
||
let is_release = self.release.is_enabled(true); | ||
|
||
if is_release { | ||
args.push("--release".to_string()); | ||
} | ||
|
||
cmd!(sh, "cargo build -p duvet {args...}").run()?; | ||
|
||
let path = if is_release { | ||
sh.current_dir().join("target/release/duvet") | ||
} else { | ||
sh.current_dir().join("target/debug/duvet") | ||
}; | ||
|
||
Ok(path) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
use crate::Result; | ||
use clap::Parser; | ||
use xshell::{cmd, Shell}; | ||
|
||
#[derive(Debug, Default, Parser)] | ||
pub struct Changelog {} | ||
|
||
impl Changelog { | ||
pub fn run(&self, sh: &Shell) -> Result { | ||
cmd!( | ||
sh, | ||
"npx conventional-changelog-cli -p conventionalcommits -i CHANGELOG.md -s" | ||
) | ||
.run()?; | ||
|
||
Ok(()) | ||
} | ||
} |
Oops, something went wrong.