Skip to content

Commit

Permalink
[PLATFORM-997]: Spike: Migrate a veil repo to use GitHub Actions (#71)
Browse files Browse the repository at this point in the history
  • Loading branch information
MaeIsBad authored May 4, 2023
1 parent a706930 commit dfb7331
Show file tree
Hide file tree
Showing 8 changed files with 78 additions and 188 deletions.
146 changes: 0 additions & 146 deletions .drone.yml

This file was deleted.

8 changes: 8 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,11 @@ updates:
# Check for cargo updates at 3am UTC
time: "03:00"
open-pull-requests-limit: 10

- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
# Check for cargo updates at 3am UTC
time: "03:00"
open-pull-requests-limit: 3
24 changes: 24 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: CD

on:
release:
types: [published]

env:
CARGO_TERM_COLOR: always

jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: install cargo-release
uses: taiki-e/install-action@v2
with:
tool: [email protected]
- name: login
run: cargo login "$CARGO_AUTH_KEY"
env:
CARGO_AUTH_KEY: ${{ secrets.CARGO_AUTH_KEY }}
- name: publish
run: cargo release publish --no-confirm --allow-branch "*" --workspace --all-features --execute
40 changes: 40 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: CI

on: [push, pull_request]

env:
CARGO_TERM_COLOR: always

jobs:
lint:
# Avoid duplicate jobs on PR from a branch on the same repo
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name

name: "Continuous Integration / lint"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: Swatinem/rust-cache@v2
- name: Build
run: cargo build --workspace --all-features
- name: cargo fmt
run: cargo fmt --all -- --check
- name: Clippy
run: cargo clippy --workspace --all-features -- -D warnings
- name: Build docs
run: cargo doc --document-private-items --workspace --all-features --no-deps
env:
RUSTDOCFLAGS: -Dwarnings
test:
# Avoid duplicate jobs on PR from a branch on the same repo
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name

name: "Continuous Integration / test"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: Swatinem/rust-cache@v2
- name: Run tests for no features
run: cargo test --all
- name: Run tests with toggle feature
run: cargo test --all --features toggle
34 changes: 0 additions & 34 deletions deploy/build

This file was deleted.

8 changes: 4 additions & 4 deletions src/private.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@ use std::{
};

pub enum RedactSpecialization {
/// Whether the type we're redacting is an Option<T> or not. Poor man's specialization! This is detected
/// Whether the type we're redacting is an [`Option<T>`] or not. Poor man's specialization! This is detected
/// by the proc macro reading the path to the type, so it's not perfect.
///
/// This could be improved & rid of in a number of different ways in the future:
///
/// * Once specialization is stabilized, we can use a trait to override redacting behavior for some types,
/// one of which would be Option<T>.
/// one of which would be [`Option<T>`].
///
/// * Once std::ptr::metadata and friends are stabilized, we could use it to unsafely cast the dyn Debug pointer
/// to a concrete Option<T> and redact it directly. Probably not the best idea.
/// to a concrete [`Option<T>`] and redact it directly. Probably not the best idea.
///
/// * Once trait upcasting is stabilized, we could use it to upcast the dyn Debug pointer to a dyn Any and then
/// downcast it to a concrete Option<T> and redact it directly.
/// downcast it to a concrete [`Option<T>`] and redact it directly.
Option,
}

Expand Down
4 changes: 1 addition & 3 deletions veil-macros/src/enums.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,7 @@ pub(super) fn derive_redact(
}
}
syn::Fields::Unnamed(syn::FieldsUnnamed { unnamed, .. }) => {
let args = (0..unnamed.len())
.into_iter()
.map(|i| syn::Ident::new(&format!("arg{i}"), unnamed.span()));
let args = (0..unnamed.len()).map(|i| syn::Ident::new(&format!("arg{i}"), unnamed.span()));
quote! {
( #(#args),* )
}
Expand Down
2 changes: 1 addition & 1 deletion veil-macros/src/fmt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use quote::ToTokens;
use syn::spanned::Spanned;

#[rustfmt::skip]
/// Returns whether a syn::Type is an Option<T>
/// Returns whether a [`syn::Type`] is an [`Option<T>`]
///
/// We try and match as many possible paths as possible because
/// some macros can output very verbose paths to items.
Expand Down

0 comments on commit dfb7331

Please sign in to comment.