Skip to content

Commit

Permalink
refactor(CI-push): move merge_group to CI-push (#1696)
Browse files Browse the repository at this point in the history
Co-authored-by: Sampras Lopes <lsampras@pm.me>
  • Loading branch information
ShankarSinghC and lsampras committed Jul 13, 2023
1 parent 2cf8ae7 commit 08cca88
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 18 deletions.
88 changes: 72 additions & 16 deletions .github/workflows/CI-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@ on:
# - "Cargo.lock"
# - "Cargo.toml"

merge_group:
types:
- checks_requested

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
Expand Down Expand Up @@ -109,6 +105,11 @@ jobs:
else
echo "api_models_changes_exist=true" >> $GITHUB_ENV
fi
if git diff --exit-code --quiet origin/$GITHUB_BASE_REF -- crates/cards/; then
echo "cards_changes_exist=false" >> $GITHUB_ENV
else
echo "cards_changes_exist=true" >> $GITHUB_ENV
fi
if git diff --exit-code --quiet origin/$GITHUB_BASE_REF -- crates/common_enums/; then
echo "common_enums_changes_exist=false" >> $GITHUB_ENV
else
Expand All @@ -119,11 +120,21 @@ jobs:
else
echo "common_utils_changes_exist=true" >> $GITHUB_ENV
fi
if git diff --exit-code --quiet origin/$GITHUB_BASE_REF -- crates/diesel_models/; then
echo "diesel_models_changes_exist=false" >> $GITHUB_ENV
else
echo "diesel_models_changes_exist=true" >> $GITHUB_ENV
fi
if git diff --exit-code --quiet origin/$GITHUB_BASE_REF -- crates/drainer/; then
echo "drainer_changes_exist=false" >> $GITHUB_ENV
else
echo "drainer_changes_exist=true" >> $GITHUB_ENV
fi
if git diff --exit-code --quiet origin/$GITHUB_BASE_REF -- crates/external_services/; then
echo "external_services_changes_exist=false" >> $GITHUB_ENV
else
echo "external_services_changes_exist=true" >> $GITHUB_ENV
fi
if git diff --exit-code --quiet origin/$GITHUB_BASE_REF -- crates/masking/; then
echo "masking_changes_exist=false" >> $GITHUB_ENV
else
Expand All @@ -149,17 +160,22 @@ jobs:
else
echo "router_env_changes_exist=true" >> $GITHUB_ENV
fi
if git diff --exit-code --quiet origin/$GITHUB_BASE_REF -- crates/diesel_models/; then
echo "diesel_models_changes_exist=false" >> $GITHUB_ENV
if git diff --exit-code --quiet origin/$GITHUB_BASE_REF -- crates/test_utils/; then
echo "test_utils_changes_exist=false" >> $GITHUB_ENV
else
echo "diesel_models_changes_exist=true" >> $GITHUB_ENV
echo "test_utils_changes_exist=true" >> $GITHUB_ENV
fi
- name: Cargo hack api_models
if: env.api_models_changes_exist == 'true'
shell: bash
run: cargo hack check --each-feature --no-dev-deps -p api_models

- name: Cargo hack cards
if: env.cards_changes_exist == 'true'
shell: bash
run: cargo hack check --each-feature --no-dev-deps -p cards

- name: Cargo hack common_enums
if: env.common_enums_changes_exist == 'true'
shell: bash
Expand All @@ -170,11 +186,21 @@ jobs:
shell: bash
run: cargo hack check --each-feature --no-dev-deps -p common_utils

- name: Cargo hack diesel_models
if: env.diesel_models_changes_exist == 'true'
shell: bash
run: cargo hack check --each-feature --no-dev-deps -p diesel_models

- name: Cargo hack drainer
if: env.drainer_changes_exist == 'true'
shell: bash
run: cargo hack check --each-feature --no-dev-deps -p drainer

- name: Cargo hack external_services
if: env.external_services_changes_exist == 'true'
shell: bash
run: cargo hack check --each-feature --no-dev-deps -p external_services

- name: Cargo hack masking
if: env.masking_changes_exist == 'true'
shell: bash
Expand All @@ -200,10 +226,10 @@ jobs:
shell: bash
run: cargo hack check --each-feature --no-dev-deps -p router_env

- name: Cargo hack diesel_models
if: env.diesel_models_changes_exist == 'true'
- name: Cargo hack test_utils
if: env.test_utils_changes_exist == 'true'
shell: bash
run: cargo hack check --each-feature --no-dev-deps -p diesel_models
run: cargo hack check --each-feature --no-dev-deps -p test_utils

# cargo-deny:
# name: Run cargo-deny
Expand Down Expand Up @@ -293,6 +319,11 @@ jobs:
else
echo "api_models_changes_exist=true" >> $GITHUB_ENV
fi
if git diff --exit-code --quiet origin/$GITHUB_BASE_REF -- crates/cards/; then
echo "cards_changes_exist=false" >> $GITHUB_ENV
else
echo "cards_changes_exist=true" >> $GITHUB_ENV
fi
if git diff --exit-code --quiet origin/$GITHUB_BASE_REF -- crates/common_enums/; then
echo "common_enums_changes_exist=false" >> $GITHUB_ENV
else
Expand All @@ -303,11 +334,21 @@ jobs:
else
echo "common_utils_changes_exist=true" >> $GITHUB_ENV
fi
if git diff --exit-code --quiet origin/$GITHUB_BASE_REF -- crates/diesel_models/; then
echo "diesel_models_changes_exist=false" >> $GITHUB_ENV
else
echo "diesel_models_changes_exist=true" >> $GITHUB_ENV
fi
if git diff --exit-code --quiet origin/$GITHUB_BASE_REF -- crates/drainer/; then
echo "drainer_changes_exist=false" >> $GITHUB_ENV
else
echo "drainer_changes_exist=true" >> $GITHUB_ENV
fi
if git diff --exit-code --quiet origin/$GITHUB_BASE_REF -- crates/external_services/; then
echo "external_services_changes_exist=false" >> $GITHUB_ENV
else
echo "external_services_changes_exist=true" >> $GITHUB_ENV
fi
if git diff --exit-code --quiet origin/$GITHUB_BASE_REF -- crates/masking/; then
echo "masking_changes_exist=false" >> $GITHUB_ENV
else
Expand All @@ -333,17 +374,22 @@ jobs:
else
echo "router_env_changes_exist=true" >> $GITHUB_ENV
fi
if git diff --exit-code --quiet origin/$GITHUB_BASE_REF -- crates/diesel_models/; then
echo "diesel_models_changes_exist=false" >> $GITHUB_ENV
if git diff --exit-code --quiet origin/$GITHUB_BASE_REF -- crates/test_utils/; then
echo "test_utils_changes_exist=false" >> $GITHUB_ENV
else
echo "diesel_models_changes_exist=true" >> $GITHUB_ENV
echo "test_utils_changes_exist=true" >> $GITHUB_ENV
fi
- name: Cargo hack api_models
if: env.api_models_changes_exist == 'true'
shell: bash
run: cargo hack check --each-feature --no-dev-deps -p api_models

- name: Cargo hack cards
if: env.cards_changes_exist == 'true'
shell: bash
run: cargo hack check --each-feature --no-dev-deps -p cards

- name: Cargo hack common_enums
if: env.common_enums_changes_exist == 'true'
shell: bash
Expand All @@ -354,11 +400,21 @@ jobs:
shell: bash
run: cargo hack check --each-feature --no-dev-deps -p common_utils

- name: Cargo hack diesel_models
if: env.diesel_models_changes_exist == 'true'
shell: bash
run: cargo hack check --each-feature --no-dev-deps -p diesel_models

- name: Cargo hack drainer
if: env.drainer_changes_exist == 'true'
shell: bash
run: cargo hack check --each-feature --no-dev-deps -p drainer

- name: Cargo hack external_services
if: env.external_services_changes_exist == 'true'
shell: bash
run: cargo hack check --each-feature --no-dev-deps -p external_services

- name: Cargo hack masking
if: env.masking_changes_exist == 'true'
shell: bash
Expand All @@ -384,10 +440,10 @@ jobs:
shell: bash
run: cargo hack check --each-feature --no-dev-deps -p router_env

- name: Cargo hack diesel_models
if: env.diesel_models_changes_exist == 'true'
- name: Cargo hack test_utils
if: env.test_utils_changes_exist == 'true'
shell: bash
run: cargo hack check --each-feature --no-dev-deps -p diesel_models
run: cargo hack check --each-feature --no-dev-deps -p test_utils

typos:
name: Spell check
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/CI-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ on:
# - "Cargo.lock"
# - "Cargo.toml"

merge_group:
types:
- checks_requested

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
Expand Down
3 changes: 1 addition & 2 deletions crates/cards/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,11 @@ readme = "README.md"
license.workspace = true

[features]
default = ["serde"]

[dependencies]
error-stack = "0.3.1"
luhn = "1.0.1"
serde = { version = "1.0.163", features = ["derive"], optional = true }
serde = { version = "1.0.163", features = ["derive"] }
thiserror = "1.0.40"
time = "0.3.21"

Expand Down

0 comments on commit 08cca88

Please sign in to comment.