Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
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
22 changes: 20 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
os: [ubuntu-latest, windows-latest, macOS-latest]

# Test against the oldest supported version.
# Test against beta Rust to get early warning of any problems that might occur with the upcoming Rust release.
Expand All @@ -51,13 +51,31 @@ jobs:
# Test with no features and all features.
args: ["--no-default-features", "--all-features"]
steps:
- if: runner.os == 'Windows'
name: Set git to use LF
run: |
git config --global core.autocrlf false
git config --global core.eol lf
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Rust
uses: hecrj/setup-rust-action@v2
with:
rust-version: ${{ matrix.rust }}
- if: matrix.rust == 'stable' && matrix.args == '--all-features'
- if: runner.os == 'Windows'
name: Set VCPKG root
run: echo "VCPKG_ROOT=$env:VCPKG_INSTALLATION_ROOT" | Out-File -FilePath $env:GITHUB_ENV -Append
- if: runner.os == 'Windows'
name: Cache vcpkg
id: cache-vckpg
uses: actions/cache@v4
with:
path: C:/vcpkg
key: ${{ runner.os }}-vcpkg
- if: runner.os == 'Windows' && steps.cache-vckpg.outputs.cache-hit != 'true'
name: Install OpenSSL for Windows
run: vcpkg install openssl:x64-windows-static-md
- if: matrix.rust == 'stable' && matrix.args == '--all-features' && matrix.os == 'ubuntu-latest'
run: cargo clippy ${{ matrix.args }} -- -D warnings
- run: cargo build ${{ matrix.args }} --locked
- run: cargo test ${{ matrix.args }} -- --test-threads=1 2>&1
Expand Down
2 changes: 2 additions & 0 deletions src/commons/ext_serde.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use bytes::Bytes;
use log::LevelFilter;
use rpki::repository::resources::{AsBlocks, IpBlocks};
use serde::{de, Deserialize, Deserializer, Serialize, Serializer};
#[cfg(unix)]
use syslog::Facility;


Expand Down Expand Up @@ -182,6 +183,7 @@ where

//------------ Facility ------------------------------------------------------

#[cfg(unix)]
pub fn de_facility<'de, D>(d: D) -> Result<Facility, D::Error>
where
D: Deserializer<'de>,
Expand Down
11 changes: 7 additions & 4 deletions src/commons/file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,9 @@ fn derive_uri(
None => format!("rsync://{rel_string}"),
};

#[cfg(not(unix))]
let uri_string = uri_string.replace("\\", "/");

let uri = uri::Rsync::from_str(&uri_string)
.map_err(|_| Error::UnsupportedFileName(uri_string))?;
Ok(uri)
Expand Down Expand Up @@ -568,19 +571,19 @@ mod tests {
fn should_scan_disk() {
test::test_under_tmp(|base_dir| {
let file_1 = CurrentFile::new(
test::rsync("rsync://host:10873/module/alice/file1.txt"),
test::rsync("rsync://host/module/alice/file1.txt"),
&Bytes::from("content 1"),
);
let file_2 = CurrentFile::new(
test::rsync("rsync://host:10873/module/alice/file2.txt"),
test::rsync("rsync://host/module/alice/file2.txt"),
&Bytes::from("content 2"),
);
let file_3 = CurrentFile::new(
test::rsync("rsync://host:10873/module/alice/sub/file1.txt"),
test::rsync("rsync://host/module/alice/sub/file1.txt"),
&Bytes::from("content sub file"),
);
let file_4 = CurrentFile::new(
test::rsync("rsync://host:10873/module/bob/file.txt"),
test::rsync("rsync://host/module/bob/file.txt"),
&Bytes::from("content"),
);

Expand Down
7 changes: 7 additions & 0 deletions src/commons/storage/backends/disk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,13 @@ impl Store {
let path = PathBuf::from(format!(
"{}{}", uri.host_str().unwrap_or_default(), uri.path()
));

#[cfg(windows)]
let path = path.to_string_lossy()
.strip_prefix('/')
.map(|s| PathBuf::from(s))
.unwrap_or(path);

let root = path.join(namespace.as_str());
let tmp = path.join(TMP_FILE_DIR);
let mut locks = path.join(LOCK_FILE_DIR);
Expand Down
6 changes: 5 additions & 1 deletion src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1740,13 +1740,17 @@ impl Config {
match self.log_type {
LogType::File => self.file_logger(),
LogType::Stderr => self.stderr_logger(),
#[cfg(unix)]
LogType::Syslog => {
let facility = Facility::from_str(&self.syslog_facility)
.map_err(|_| {
ConfigError::other("Invalid syslog_facility")
})?;
self.syslog_logger(facility)
}
},
#[cfg(not(unix))]
LogType::Syslog =>
Err(ConfigError::other("syslog not support on non-unix")),
}
}

Expand Down
3 changes: 2 additions & 1 deletion src/upgrades/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1554,8 +1554,9 @@ mod tests {
"test-resources/status_store/migration-0.9.5/";
let temp_dir = tempdir().unwrap();
copy_folder(source_dir_path_str, &temp_dir);
let temp_dir_str = &temp_dir.path().display();
let source_dir_url = Url::parse(
&format!("local://{}", &temp_dir.path().to_str().unwrap()))
&format!("local://{}", temp_dir_str))
.unwrap();

let source_store =
Expand Down
7 changes: 6 additions & 1 deletion tests/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,14 @@ impl TestConfig {

pub fn file_storage() -> Self {
let data_dir = TempDir::new().unwrap();
let uri = data_dir.path().to_string_lossy();

#[cfg(windows)]
let uri = format!("/{}", uri.replace("\\", "/"));

Self::new(
Url::parse(
&format!("local://{}/data/", data_dir.path().display())
&format!("local://{}/data/", uri)
).unwrap() ,
data_dir,
)
Expand Down
3 changes: 2 additions & 1 deletion tests/functional_old_data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,9 @@ async fn functional_old_data() {

let signer_config =
include_str!("../test-resources/migrations/v0_14_5_signer/ta.conf");
let path = tempdir.path().join("ta").to_str().unwrap().replace("\\", "/");
let signer_config = signer_config.replace("%TEMPDIR%",
tempdir.path().join("ta").to_str().unwrap());
&format!("local:///{}", path.strip_prefix('/').unwrap_or(&path)));
let signer_config = krill::tasigner::Config::parse_str(
&signer_config
).unwrap();
Expand Down
Loading