Skip to content

mock REST API calls in tests #21

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

Merged
merged 5 commits into from
Aug 26, 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
2 changes: 1 addition & 1 deletion .github/workflows/binary-builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ jobs:
env:
GH_TOKEN: ${{ github.token }}
run: |
files=$(ls dist/cpp-linter*
files=$(ls dist/cpp-linter*)
gh release create ${{ github.ref_name }} --generate-notes $files
- run: cargo publish
working-directory: cpp-linter-lib
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/build-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
uses: actions/cache@v4
with:
path: ~/.cargo
key: ${{ runner.os }}-cargo-${{ hashFiles('Cargo.lock') }}
key: ${{ runner.os }}-docs-cargo-${{ hashFiles('Cargo.lock') }}
- run: cargo fetch

build-mdbook:
Expand All @@ -30,7 +30,7 @@ jobs:
uses: actions/cache/restore@v4
with:
path: ~/.cargo
key: ${{ runner.os }}-cargo-${{ hashFiles('Cargo.lock') }}
key: ${{ runner.os }}-docs-cargo-${{ hashFiles('Cargo.lock') }}
- name: Install mdbook
uses: taiki-e/install-action@v2
with:
Expand Down Expand Up @@ -62,7 +62,7 @@ jobs:
uses: actions/cache/restore@v4
with:
path: ~/.cargo
key: ${{ runner.os }}-cargo-${{ hashFiles('Cargo.lock') }}
key: ${{ runner.os }}-docs-cargo-${{ hashFiles('Cargo.lock') }}
- run: cargo doc --no-deps --manifest-path cpp-linter-lib/Cargo.toml
- name: upload rustdoc build as artifact
uses: actions/upload-artifact@v4
Expand Down
6 changes: 2 additions & 4 deletions .github/workflows/python-packaging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,6 @@ jobs:
- uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Increment version
if: startsWith(github.ref, 'refs/tags/')
run: python .github/workflows/replace_version_spec.py --new-version=${{ github.ref_name }}
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
Expand Down Expand Up @@ -153,7 +150,8 @@ jobs:
- name: Publish to PyPI
uses: PyO3/maturin-action@v1
env:
MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
MATURIN_PYPI_TOKEN: ${{ contains(github.ref_name, 'rc') && secrets.TEST_PYPI_API_TOKEN || secrets.PYPI_API_TOKEN }}
MATURIN_REPOSITORY: ${{ contains(github.ref_name, 'rc') && 'test-pypi' || 'pypi' }}
with:
command: upload
args: --non-interactive --skip-existing dist/*
24 changes: 12 additions & 12 deletions .github/workflows/run-dev-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,19 @@ env:

jobs:
cache-deps:
runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: ['windows-latest', ubuntu-latest]
os: [windows-latest, ubuntu-latest]
steps:
- run: rustup update --no-self-update
- uses: actions/checkout@v4
- name: Cache .cargo locked resources
uses: actions/cache@v4
with:
path: ~/.cargo
key: ${{ runner.os }}-cargo-${{ hashFiles('Cargo.lock') }}
key: ${{ runner.os }}-test-cargo-${{ hashFiles('Cargo.lock') }}
- run: cargo fetch

test:
Expand Down Expand Up @@ -76,16 +76,16 @@ jobs:
with:
python-version: 3.x

# - name: Install workflow deps
# run: python3 -m pip install meson
- name: Install workflow deps
run: python3 -m pip install meson

# # https://github.com/ninja-build/ninja/wiki/Pre-built-Ninja-packages
# - name: Install ninja (Linux)
# if: runner.os == 'Linux'
# run: sudo apt-get install ninja-build
# - name: Install ninja (Windows)
# if: runner.os == 'Windows'
# run: choco install ninja
- name: Install ninja (Linux)
if: runner.os == 'Linux'
run: sudo apt-get install ninja-build
- name: Install ninja (Windows)
if: runner.os == 'Windows'
run: choco install ninja

- name: Install Linux clang dependencies
if: runner.os == 'Linux'
Expand All @@ -111,7 +111,7 @@ jobs:
uses: actions/cache/restore@v4
with:
path: ~/.cargo
key: ${{ runner.os }}-cargo-${{ hashFiles('Cargo.lock') }}
key: ${{ runner.os }}-test-cargo-${{ hashFiles('Cargo.lock') }}

- name: Collect Coverage
working-directory: cpp-linter-lib
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ repos:
rev: v4.6.0
hooks:
- id: trailing-whitespace
exclude: cpp-linter-lib/tests/capture_tools_output/cpp-linter/cpp-linter/test_git_lib.patch
exclude: cpp-linter-lib/tests/.*\.(?:patch|diff)
- id: end-of-file-fixer
- id: check-docstring-first
- id: check-added-large-files
Expand Down
92 changes: 92 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions cpp-linter-lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ documentation.workspace = true
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
chrono = "0.4.38"
clap = "4.5.16"
futures = "0.3.30"
git2 = "0.19.0"
lenient_semver = "0.4.2"
log = "0.4.22"
Expand All @@ -26,6 +28,7 @@ tokio-stream = "0.1.15"
which = "6.0.3"

[dev-dependencies]
mockito = "1.5.0"
tempfile = "3.9.0"

[features]
Expand All @@ -34,3 +37,5 @@ openssl-vendored = ["dep:openssl", "dep:openssl-probe"]
[[bin]]
name = "cpp-linter"
path = "src/main.rs"
test = false
bench = false
34 changes: 0 additions & 34 deletions cpp-linter-lib/examples/gh_rest_api.rs

This file was deleted.

Loading