Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update ci #462

Merged
merged 2 commits into from
Jan 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 12 additions & 20 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,60 +18,52 @@ jobs:
os: [ubuntu-latest, macos-latest]
name: Cargo test
runs-on: ${{ matrix.os }}
if: "github.repository == 'graphql-rust/graphql-client'"
if: github.repository == 'graphql-rust/graphql-client'
steps:
- name: Checkout sources
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Install toolchain
uses: actions-rs/toolchain@v1
uses: dtolnay/rust-toolchain@master
with:
profile: minimal
toolchain: ${{ matrix.rust }}
override: true
- name: Execute cargo test
run: cargo test --all --tests --examples
wasm_build:
name: Cargo build for wasm
runs-on: ubuntu-latest
if: "github.repository == 'graphql-rust/graphql-client'"
if: github.repository == 'graphql-rust/graphql-client'
steps:
- name: Checkout sources
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Install toolchain
uses: actions-rs/toolchain@v1
uses: dtolnay/rust-toolchain@stable
with:
profile: minimal
toolchain: stable
override: true
target: wasm32-unknown-unknown
- name: Execute cargo build
run: |
cargo build --manifest-path=./graphql_client/Cargo.toml --features="reqwest" --target wasm32-unknown-unknown
lint:
name: Rustfmt and Clippy
runs-on: ubuntu-latest
if: "github.repository == 'graphql-rust/graphql-client'"
if: github.repository == 'graphql-rust/graphql-client'
steps:
- name: Checkout sources
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Install toolchain
uses: actions-rs/toolchain@v1
uses: dtolnay/rust-toolchain@stable
with:
profile: minimal
toolchain: stable
override: true
components: clippy,rustfmt
- name: Execute cargo fmt
run: cargo fmt --all -- --check
- name: Execute cargo clippy
run: cargo clippy --tests --examples -- -D warnings
run: cargo clippy --all --all-targets --all-features -- -D warnings
prettier:
name: Check prettier
runs-on: ubuntu-latest
if: "github.repository == 'graphql-rust/graphql-client'"
if: github.repository == 'graphql-rust/graphql-client'
steps:
- name: Checkout sources
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Install node.js
run: sudo apt update && sudo apt-get install -y nodejs
- name: Execute prettier
Expand Down
2 changes: 1 addition & 1 deletion graphql_client_codegen/src/codegen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ fn generate_variables_struct(
variable
.r#type
.qualifiers
.get(0)
.first()
.map(|qual| !qual.is_required())
.unwrap_or(true),
query,
Expand Down
4 changes: 2 additions & 2 deletions graphql_client_codegen/src/codegen/selection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ fn calculate_selection<'a>(
})
.collect();

if let Some((selection_id, selection, _variant)) = variant_selections.get(0) {
if let Some((selection_id, selection, _variant)) = variant_selections.first() {
let mut variant_struct_name_str =
full_path_prefix(*selection_id, context.query);
variant_struct_name_str.reserve(2 + variant_name_str.len());
Expand Down Expand Up @@ -408,7 +408,7 @@ impl<'a> ExpandedField<'a> {
let optional_skip_serializing_none = if *options.skip_serializing_none()
&& self
.field_type_qualifiers
.get(0)
.first()
.map(|qualifier| !qualifier.is_required())
.unwrap_or(false)
{
Expand Down
2 changes: 1 addition & 1 deletion graphql_client_codegen/src/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ impl StoredInputFieldType {

pub(crate) fn is_optional(&self) -> bool {
self.qualifiers
.get(0)
.first()
.map(|qualifier| !qualifier.is_required())
.unwrap_or(true)
}
Expand Down