-
-
Notifications
You must be signed in to change notification settings - Fork 139
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #452 from mzeitlin11/codegen_revamp
Codegen revamp
- Loading branch information
Showing
1,717 changed files
with
193,798 additions
and
188,770 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
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,55 +3,75 @@ on: | |
push: | ||
branches: | ||
- master | ||
- next | ||
pull_request: | ||
branches: | ||
- master | ||
- next | ||
|
||
env: | ||
RUSTFLAGS: -Dwarnings | ||
rust_min: 1.73 | ||
|
||
jobs: | ||
format: | ||
runs-on: ubuntu-20.04 | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions-rs/toolchain@v1 | ||
- name: Checkout sources | ||
uses: actions/checkout@v3 | ||
|
||
- name: Install toolchain | ||
uses: dtolnay/rust-toolchain@nightly | ||
with: | ||
profile: minimal | ||
toolchain: nightly | ||
components: rustfmt | ||
- uses: davidB/rust-cargo-make@v1 | ||
- name: regenerate openapi | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
command: make | ||
args: check | ||
|
||
verify-codegen: | ||
runs-on: ubuntu-20.04 | ||
- name: Check formatting for workspace | ||
run: cargo fmt --all -- --check | ||
|
||
verify-codegen-crate: | ||
runs-on: ubuntu-latest | ||
defaults: | ||
run: | ||
working-directory: openapi | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions-rs/toolchain@v1 | ||
- name: Checkout sources | ||
uses: actions/checkout@v3 | ||
|
||
- name: Install nightly toolchain | ||
uses: dtolnay/rust-toolchain@nightly | ||
with: | ||
profile: minimal | ||
toolchain: nightly | ||
components: rustfmt | ||
- uses: davidB/rust-cargo-make@v1 | ||
- name: regenerate openapi | ||
uses: actions-rs/cargo@v1 | ||
|
||
- name: Check formatting | ||
run: cargo +nightly fmt -- --check | ||
|
||
- name: Install toolchain | ||
uses: dtolnay/rust-toolchain@stable | ||
with: | ||
command: make | ||
args: openapi-install | ||
- name: ensure generated files unchanged | ||
components: clippy | ||
|
||
- name: Run clippy | ||
run: cargo clippy | ||
|
||
- name: Run codegen | ||
run: cargo run --release -- --fetch current | ||
|
||
- name: Ensure generated files unchanged | ||
uses: tj-actions/[email protected] | ||
id: verify-changed-files | ||
with: | ||
files: | | ||
**/*.rs | ||
- name: report changed files | ||
- name: Report changed files | ||
if: steps.verify-changed-files.outputs.files_changed == 'true' | ||
run: | | ||
echo "Some files changed after code generation: ${{ steps.verify-changed-files.outputs.changed_files }}" | ||
exit 1 | ||
clippy: | ||
runs-on: ubuntu-20.04 | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
runtime: | ||
|
@@ -65,29 +85,22 @@ jobs: | |
blocking-rustls-webpki, | ||
] | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions-rs/toolchain@v1 | ||
- name: Checkout sources | ||
uses: actions/checkout@v3 | ||
|
||
- name: Install Rust | ||
uses: dtolnay/rust-toolchain@stable | ||
with: | ||
profile: minimal | ||
toolchain: stable | ||
toolchain: ${{ env.rust_min }} | ||
components: clippy | ||
- uses: actions/cache@v2 | ||
with: | ||
path: | | ||
~/.cargo/registry | ||
~/.cargo/git | ||
target | ||
key: ${{ runner.os }}-clippy-${{ matrix.runtime }}-${{ hashFiles('**/Cargo.lock') }} | ||
- uses: actions-rs/cargo@v1 | ||
with: | ||
command: clippy | ||
args: > | ||
--no-default-features | ||
--features runtime-${{ matrix.runtime }} | ||
|
||
- uses: Swatinem/rust-cache@v2 | ||
|
||
- name: Run clippy | ||
run: cargo clippy --features "runtime-${{ matrix.runtime }} full" | ||
|
||
test: | ||
runs-on: ubuntu-20.04 | ||
env: | ||
RUSTFLAGS: -D warnings | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
runtime: | ||
|
@@ -107,31 +120,54 @@ jobs: | |
- 12111:12111 | ||
- 12112:12112 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions-rs/toolchain@v1 | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Install Rust | ||
uses: dtolnay/rust-toolchain@stable | ||
with: | ||
profile: minimal | ||
toolchain: "1.68.0" | ||
override: true | ||
- uses: actions/cache@v2 | ||
toolchain: ${{ env.rust_min }} | ||
|
||
- uses: Swatinem/rust-cache@v2 | ||
|
||
- uses: taiki-e/install-action@cargo-llvm-cov | ||
- name: Test and gather coverage | ||
run: cargo llvm-cov --lcov --output-path lcov.info --features runtime-${{ matrix.runtime }} | ||
- name: Upload to codecov.io | ||
uses: codecov/[email protected] | ||
with: | ||
token: ${{secrets.CODECOV_TOKEN}} | ||
files: lcov.info | ||
- name: Archive code coverage results | ||
uses: actions/upload-artifact@v1 | ||
with: | ||
path: | | ||
~/.cargo/registry | ||
~/.cargo/git | ||
target | ||
key: ${{ runner.os }}-test-${{ matrix.runtime }}-${{ hashFiles('**/Cargo.lock') }} | ||
- name: Test | ||
run: cargo test --features runtime-${{ matrix.runtime }} | ||
# - uses: taiki-e/install-action@cargo-llvm-cov | ||
# - name: Test and gather coverage | ||
# run: cargo llvm-cov --lcov --output-path lcov.info --features runtime-${{ matrix.runtime }} | ||
# - name: Upload to codecov.io | ||
# uses: codecov/[email protected] | ||
# with: | ||
# token: ${{secrets.CODECOV_TOKEN}} | ||
# files: lcov.info | ||
# - name: Archive code coverage results | ||
# uses: actions/upload-artifact@v1 | ||
# with: | ||
# name: code-coverage-report | ||
# path: lcov.info | ||
name: code-coverage-report | ||
path: lcov.info | ||
|
||
docs: | ||
name: Docs | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Install Rust | ||
uses: dtolnay/rust-toolchain@stable | ||
|
||
- uses: Swatinem/rust-cache@v2 | ||
|
||
- name: Build Documentation | ||
run: cargo doc --lib --no-deps --features "runtime-tokio-hyper full" | ||
|
||
# Examples tested separately so that we can use crates which don't match our MSRV | ||
examples: | ||
name: Check Examples | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Install Rust | ||
uses: dtolnay/rust-toolchain@stable | ||
|
||
- uses: Swatinem/rust-cache@v2 | ||
|
||
- name: Check examples | ||
run: cargo clippy --features "runtime-tokio-hyper-rustls" --workspace |
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 |
---|---|---|
|
@@ -7,55 +7,24 @@ jobs: | |
update-openapi: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Install minimal nightly with rustfmt | ||
uses: actions-rs/toolchain@v1 | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Install Rust with rustfmt | ||
uses: dtolnay/rust-toolchain@nightly | ||
with: | ||
profile: minimal | ||
toolchain: nightly | ||
components: rustfmt | ||
- uses: davidB/rust-cargo-make@v1 | ||
- name: regenerate openapi | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
command: make | ||
args: openapi-install-latest | ||
- name: verify | ||
id: verify | ||
# currently waiting for https://github.com/actions-rs/cargo/pull/206 | ||
# so we use this in the mean time | ||
uses: arlyon/[email protected] | ||
with: | ||
command: make | ||
args: verify | ||
- name: duplicates | ||
id: duplicates | ||
# currently waiting for https://github.com/actions-rs/cargo/pull/206 | ||
# so we use this in the mean time | ||
uses: arlyon/[email protected] | ||
with: | ||
command: make | ||
args: duplicates | ||
|
||
- name: Run Codegen | ||
run: cargo run --release -- --fetch latest | ||
|
||
- name: create pull request | ||
uses: peter-evans/create-pull-request@v3 | ||
with: | ||
token: ${{ secrets.REPO_SCOPED_TOKEN }} | ||
commit-message: "feat: generate latest changes from OpenApi spec" | ||
commit-message: Generate latest changes from OpenApi spec | ||
title: Generate latest changes from OpenApi spec | ||
body: | | ||
This is an automated PR that tries to build the latest changes generated from the [Stripe OpenApi spec](https://github.com/stripe/openapi). | ||
Here are the missing exports: | ||
``` | ||
${{ steps.verify.outputs.stdout }} | ||
``` | ||
Here are the duplicate exports: | ||
``` | ||
${{ steps.duplicates.outputs.stdout }} | ||
``` | ||
branch: openapi | ||
branch-suffix: timestamp | ||
reviewers: arlyon | ||
|
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 |
---|---|---|
|
@@ -5,6 +5,7 @@ Cargo.lock | |
|
||
# Test artifacts | ||
stripe-mock/ | ||
lcov.info | ||
|
||
# IDE artifacts | ||
.DS_Store | ||
|
Oops, something went wrong.