diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml new file mode 100644 index 0000000..0b4582b --- /dev/null +++ b/.github/workflows/cd.yml @@ -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@v4 + - name: install cargo-release + uses: taiki-e/install-action@v2 + with: + tool: cargo-release@0.24 + - 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 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..aca7a9d --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,41 @@ +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 + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: Swatinem/rust-cache@v2 + - name: cargo fmt check + 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 + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: Swatinem/rust-cache@v2 + - name: Run tests + run: cargo test --all-features + + alls-green: + if: always() && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name) + runs-on: ubuntu-latest + needs: + - lint + - test + steps: + - run: ${{ !contains(needs.*.result, 'failure') }} \ No newline at end of file diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml deleted file mode 100644 index 1f47024..0000000 --- a/.github/workflows/rust.yml +++ /dev/null @@ -1,32 +0,0 @@ -name: Continuous Integration - -on: - push: - branches: [ "master" ] - pull_request: - -env: - CARGO_TERM_COLOR: always - -jobs: - format: - runs-on: ubuntu-latest - strategy: - fail-fast: true - steps: - - uses: actions/checkout@v3 - - uses: Swatinem/rust-cache@v2 - - name: cargo fmt - run: cargo fmt --all -- --check - - name: Clippy - run: cargo clippy -- -D warnings - - test: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: Swatinem/rust-cache@v2 - - name: Build - run: cargo build --verbose - - name: Run tests - run: cargo test --verbose diff --git a/positional_derive/src/lower.rs b/positional_derive/src/lower.rs index 98daec2..d53a026 100644 --- a/positional_derive/src/lower.rs +++ b/positional_derive/src/lower.rs @@ -41,7 +41,7 @@ fn extract_option_type(ty: &syn::Type) -> Option<&syn::Type> { acc.push('|'); acc }); - vec!["Option|", "std|option|Option|", "core|option|Option|"] + ["Option|", "std|option|Option|", "core|option|Option|"] .iter() .find(|s| &idents_of_path == *s) .and_then(|_| path.segments.last())