Skip to content

Commit

Permalink
WIP CI
Browse files Browse the repository at this point in the history
  • Loading branch information
vojtechkral committed Jan 22, 2024
1 parent d9c8308 commit fa4d88d
Show file tree
Hide file tree
Showing 2 changed files with 92 additions and 1 deletion.
91 changes: 91 additions & 0 deletions .github/workflows/CI.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,16 @@ jobs:
~/.cargo/registry/cache
target
key: test-${{ runner.os }}-${{ hashFiles('Cargo.lock') }}
- name: Build
run: cargo build --locked
- name: Test
run: cargo test --locked -- --nocapture
- name: Upload linux binary
uses: actions/upload-artifact@v3
with:
name: cargo-fixture
path: target/debug/cargo-fixture
if-no-files-found: error

test-windows:
name: Test on Windows
Expand All @@ -138,9 +146,17 @@ jobs:
~/.cargo/registry/cache
target
key: test-${{ runner.os }}-${{ hashFiles('Cargo.lock') }}
- name: Build
run: cargo build --locked
- name: Test
# tests must be run in one thread otherwise they attempt to overwrite each other's exe while building
run: cargo test --locked -- --nocapture --test-threads=1
- name: Upload linux binary
uses: actions/upload-artifact@v3
with:
name: cargo-fixture-exe
path: target/debug/cargo-fixture.exe
if-no-files-found: error

msrv:
name: MSRV check
Expand Down Expand Up @@ -174,3 +190,78 @@ jobs:
with:
command: check
args: --locked

examples-linux:
name: Run examples on Linux
needs: test-linux
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v3
- name: Setup Rust toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- name: Cache dependencies
uses: actions/cache@v3
with:
path: |
~/.cargo/.crates.toml
~/.cargo/.crates2.json
~/.cargo/bin
~/.cargo/registry/index
~/.cargo/registry/cache
examples/docker/target
examples/http/target
key: examples-${{ runner.os }}-${{ hashFiles('Cargo.lock') }}
- name: Get cargo-fixture
uses: actions/download-artifact@v3
with:
name: cargo-fixture
path: ~/.cargo/bin
- name: chmod +x cargo-fixture
run: |
chmod +x ~/.cargo/bin/cargo-fixture
ls -l ~/.cargo/bin
- name: HTTP Example
working-directory: examples/http
run: cargo fixture
- name: Docker Example
working-directory: examples/docker
run: cargo fixture

examples-windows:
name: Run examples on Windows
needs: test-windows
runs-on: windows-latest
steps:
- name: Checkout sources
uses: actions/checkout@v3
- name: Setup Rust toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- name: Cache dependencies
uses: actions/cache@v3
with:
path: |
~/.cargo/.crates.toml
~/.cargo/.crates2.json
~/.cargo/bin
~/.cargo/registry/index
~/.cargo/registry/cache
examples/docker/target
examples/http/target
key: examples-${{ runner.os }}-${{ hashFiles('Cargo.lock') }}
- name: Get cargo-fixture
uses: actions/download-artifact@v3
with:
name: cargo-fixture-exe
path: ~/.cargo/bin
- name: HTTP Example
working-directory: examples/http
run: cargo fixture
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ members = [
"crates/macros",
]
exclude = [
"example",
"examples",
]

[workspace.dependencies]
Expand Down

0 comments on commit fa4d88d

Please sign in to comment.