Skip to content

Commit

Permalink
Implement CI/CD with GHA
Browse files Browse the repository at this point in the history
  • Loading branch information
cottinisimone committed Nov 28, 2023
1 parent 33150a0 commit a27d459
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 33 deletions.
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@v4
- 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
41 changes: 41 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -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') }}
32 changes: 0 additions & 32 deletions .github/workflows/rust.yml

This file was deleted.

2 changes: 1 addition & 1 deletion positional_derive/src/lower.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down

0 comments on commit a27d459

Please sign in to comment.