Skip to content

Commit

Permalink
Make light CI version
Browse files Browse the repository at this point in the history
  • Loading branch information
Flix committed Aug 17, 2024
1 parent e5301cf commit 753ad89
Show file tree
Hide file tree
Showing 3 changed files with 113 additions and 6 deletions.
50 changes: 44 additions & 6 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ jobs:
shell: bash
run: cargo +nightly fmt -- --check

check:
name: Clippy and Tests
lints:
name: Lints
runs-on: ubuntu-latest

steps:
Expand All @@ -45,10 +45,48 @@ jobs:
- name: Caching
uses: Swatinem/rust-cache@v2

- name: Run CI tests
- name: Run clippy for all feature sets.
shell: bash
run: cargo make ci-tests
# Uses a light variant right now to save resources.. Locally, there is a better version.
# Sadly, cannot use --all-features.
run: cargo make --makefile Makefile-light-ci.toml clippy

- name: Clippy for all required feature sets
tests:
strategy:
matrix:
selected_features:
- name: "STU3"
feat_arg: "--no-default-features --features stu3,client"
compose_profiles: "hapi-stu3"
- name: "R4B"
feat_arg: "--no-default-features --features r4b,client"
compose_profiles: "hapi-r4b,medplum-r4"
- name: "R5"
feat_arg: "--no-default-features --features r5,client"
compose_profiles: "hapi-r5"

name: "Tests (${{ matrix.selected_features.name }})"
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Install/update Rust
shell: bash
run: rustup show # Uses rust-toolchain.toml file to install the correct version and components.

- uses: taiki-e/install-action@v2
with:
tool: cargo-make,cargo-nextest

- name: Caching
uses: Swatinem/rust-cache@v2

- name: "Run tests for this feature set: ${{ matrix.selected_features.name }}"
shell: bash
run: cargo make clippy
# Uses a light variant right now to save resources.. Locally, there is a better version.
# Sadly, cannot use --all-features.
run: |
cargo make --makefile Makefile-light-ci.toml docker-ci-up --env COMPOSE_PROFILES=${{ matrix.selected_features.compose_profiles}}
cargo make --makefile Makefile-light-ci.toml test --env FEATURE_SELECTION=${{ matrix.selected_features.feat_arg }}
cargo make --makefile Makefile-light-ci.toml docker-ci-down --env COMPOSE_PROFILES=${{ matrix.selected_features.compose_profiles}}
68 changes: 68 additions & 0 deletions Makefile-light-ci.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
extend = "Makefile.toml"

[env]
FEATURE_SELECTION = "--no-default-features --features r5,client"
COMPOSE_PROFILES = "hapi-r5"


[tasks.ensure-ci]
description = "Ensure this is only run in CI. Use the normal Makefile for local use!"
condition.env_false = ["CARGO_MAKE_CI"]
script = [
"echo Not running in CI, please use the normal Makefile!",
"exit 1"
]


[tasks.clippy-r4b-r5-no-builders]
private = true
install_crate = false
command = "cargo"
args = ["clippy", "-p", "fhir-sdk", "--all-targets", "--no-default-features", "--features", "r4b,r5", "--", "-D", "warnings"]

[tasks.clippy-r4b-r5-client]
private = true
install_crate = false
command = "cargo"
args = ["clippy", "-p", "fhir-sdk", "--all-targets", "--no-default-features", "--features", "r4b,r5,client", "--", "-D", "warnings"]

[tasks.clippy]
description = "Runs clippy with all various feature sets."
dependencies = [
"ensure-ci",
"clippy-default",
"clippy-stu3-no-builders",
"clippy-stu3-client",
"clippy-r4b-no-builders",
"clippy-r4b-client",
"clippy-r5-no-builders",
"clippy-r5-client",
"clippy-r4b-r5-no-builders",
"clippy-r4b-r5-client",
]


[tasks.test-nextest]
private = true
command = "cargo"
args = ["nextest", "run", "--workspace", "@@split(FEATURE_SELECTION, )"]

[tasks.test-docs]
private = true
command = "cargo"
args = ["test", "--workspace", "--doc", "@@split(FEATURE_SELECTION, )"]

[tasks.test]
description = "Runs all tests for the given feature set."
dependencies = ["ensure-ci", "test-nextest", "test-docs"]


[tasks.docker-ci-up]
cwd = "./docker/"
command = "docker"
args = ["compose", "up", "-d"]

[tasks.docker-ci-down]
cwd = "./docker/"
command = "docker"
args = ["compose", "down", "-v"]
1 change: 1 addition & 0 deletions Makefile.toml
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ dependencies = ["formatting", "ci-tests", "clippy"]
[tasks.generate]
description = "Run the code generator for fhir-model to produce all FHIR code."
install_crate = false
condition = { files_modified = { input = ["./crates/generate/**/*"], output = ["./target/**/generate"] } }
command = "cargo"
args = ["run", "-p", "generate"]
dependencies = ["install-rust-toolchain"]
Expand Down

0 comments on commit 753ad89

Please sign in to comment.