Skip to content

Commit

Permalink
Merge pull request #462 from danieleades/CI
Browse files Browse the repository at this point in the history
update ci
  • Loading branch information
tomhoule authored Jan 9, 2024
2 parents 0e6b38e + 7bf4bbd commit a7283cb
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 24 deletions.
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

0 comments on commit a7283cb

Please sign in to comment.