Skip to content

Commit 90a7975

Browse files
committed
Cleanup
1 parent f89e3ee commit 90a7975

File tree

3 files changed

+17
-160
lines changed

3 files changed

+17
-160
lines changed

.github/workflows/coverage.yml

-71
This file was deleted.

.github/workflows/scan.yml

+13-77
Original file line numberDiff line numberDiff line change
@@ -49,65 +49,11 @@ jobs:
4949
# with:
5050
# sarif_file: trivy-results.sarif
5151

52-
llvm-cov:
53-
name: llvm-cov
54-
runs-on: ubuntu-latest
55-
steps:
56-
- name: Checkout repository
57-
uses: actions/checkout@v4
58-
59-
- name: Install dependencies
60-
run: |
61-
sudo apt update
62-
sudo apt install -y libssl-dev pkg-config clang llvm pkg-config nettle-dev
63-
64-
# Set up Rust
65-
- name: Set up Rust
66-
uses: actions-rs/toolchain@v1
67-
with:
68-
profile: minimal
69-
toolchain: nightly
70-
override: true
71-
72-
- name: Install cargo-llvm-cov
73-
uses: taiki-e/install-action@cargo-llvm-cov
74-
75-
76-
- name: Install Clippy
77-
run: rustup component add clippy
78-
79-
# Cache Cargo dependencies
80-
- name: Cache Cargo registry
81-
uses: actions/cache@v3
82-
with:
83-
path: ~/.cargo/registry
84-
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
85-
restore-keys: |
86-
${{ runner.os }}-cargo-registry-
87-
88-
- name: Cache Cargo index
89-
uses: actions/cache@v3
90-
with:
91-
path: ~/.cargo/git
92-
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
93-
restore-keys: |
94-
${{ runner.os }}-cargo-index-
95-
96-
- name: Cache target directory
97-
uses: actions/cache@v3
98-
with:
99-
path: target
100-
key: ${{ runner.os }}-cargo-target-${{ hashFiles('**/Cargo.lock') }}
101-
restore-keys: |
102-
${{ runner.os }}-cargo-target-
10352

104-
- name: Generate code coverage
105-
run: cargo llvm-cov --all-features --workspace --lcov --output-path lcov.info
106-
107-
108-
codeql:
109-
name: SonarQube
53+
coverage:
54+
name: Code Coverage
11055
runs-on: ubuntu-latest
56+
11157
steps:
11258
- name: Checkout repository
11359
uses: actions/checkout@v4
@@ -117,21 +63,15 @@ jobs:
11763
sudo apt update
11864
sudo apt install -y libssl-dev pkg-config clang llvm pkg-config nettle-dev
11965
120-
# Set up Rust
12166
- name: Set up Rust
12267
uses: actions-rs/toolchain@v1
12368
with:
124-
profile: minimal
12569
toolchain: nightly
12670
override: true
12771

128-
- name: Install cargo-llvm-cov
129-
uses: taiki-e/install-action@cargo-llvm-cov
72+
- name: Install tarpaulin
73+
run: cargo install cargo-tarpaulin
13074

131-
- name: Install Clippy
132-
run: rustup component add clippy
133-
134-
# Cache Cargo dependencies
13575
- name: Cache Cargo registry
13676
uses: actions/cache@v3
13777
with:
@@ -156,17 +96,13 @@ jobs:
15696
restore-keys: |
15797
${{ runner.os }}-cargo-target-
15898
159-
- name: Generate code coverage
160-
run: cargo llvm-cov --all-features --workspace --lcov --output-path lcov.info
161-
162-
- name: Install cargo-sonar and run Clippy
99+
- name: Run code coverage
163100
run: |
164-
cargo install cargo-sonar
165-
cargo clippy --message-format json > my-clippy-report.json
166-
cargo sonar --clippy-path my-clippy-report.json
101+
cargo tarpaulin --out Xml --timeout 240
167102
168-
- name: SonarQube Scan
169-
uses: SonarSource/sonarqube-scan-action@v4
170-
env:
171-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
172-
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
103+
# - name: Upload coverage to Codecov
104+
# uses: codecov/codecov-action@v3
105+
# with:
106+
# files: target/tarpaulin/coverage.xml
107+
# fail_ci_if_error: true
108+
# verbose: true

tests/tests.rs

+4-12
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,13 @@
99
// unused_qualifications
1010
)]
1111

12-
use base64::Engine;
13-
use pgp::ser::Serialize;
14-
use pgp::{Deserializable, Message, SignedPublicKey};
15-
use sops_gitops_github_action::{
16-
create_default_sops_config_file, create_secret_file, find_secret_files, get_key_fingerprint,
17-
get_pubkey_fingerprint, gpg_mock_private_key, import_gpg_key, public_keys_provided,
18-
read_public_key, set_message, sops_config_file_exists, update_secret_file, update_sops_config,
19-
};
20-
use std::fs;
21-
use std::fs::File;
22-
use std::io::Read;
12+
use sops_gitops_github_action::{get_pubkey_fingerprint, read_public_key, set_message};
13+
2314
use std::sync::LazyLock;
24-
use tempfile::tempdir;
2515

2616
const MOCK_KEY_FOOTPRINT: &str = "9C243A3FDC4EF1474372915F9C1B6F1F746AF12C";
17+
18+
#[allow(dead_code)]
2719
static GPG_MOCK_PUBLIC_KEY: LazyLock<String> =
2820
LazyLock::new(|| read_public_key("tests/mock-public.key.asc"));
2921

0 commit comments

Comments
 (0)