Skip to content
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

ci: add test for windows and macos #16

Merged
merged 29 commits into from
Jan 22, 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
37 changes: 21 additions & 16 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,16 @@ jobs:
fail-fast: false
matrix:
platform:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
- target: x86_64-unknown-linux-gnu
command: cargo
- os: ubuntu-latest
target: aarch64-unknown-linux-gnu
- target: aarch64-unknown-linux-gnu
command: cross
- os: ubuntu-latest
target: x86_64-unknown-linux-musl
- target: x86_64-unknown-linux-musl
command: cross
- os: ubuntu-latest
target: aarch64-unknown-linux-musl
- target: aarch64-unknown-linux-musl
command: cross

runs-on: ${{ matrix.platform.os }}
runs-on: ubuntu-latest

env:
DATABASE_URL: "postgres://postgres:postgres@localhost:5432/postgres"
Expand Down Expand Up @@ -57,7 +53,6 @@ jobs:
- name: Build and test
run: ${{ matrix.platform.command }} test --locked --target ${{ matrix.platform.target }}

# TODO: setup postgres instance for testing
build-windows:
runs-on: windows-latest

Expand All @@ -66,22 +61,32 @@ jobs:

steps:
- uses: actions/checkout@v4
- uses: ikalnytskyi/action-setup-postgres@v5
id: postgres
- name: Export GitHub Actions cache environment variables
uses: actions/github-script@v6
with:
script: |
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
- name: Install libpq
run: vcpkg install libpq[core]:x64-windows-release
- name: Build
run: cargo build --locked --target x86_64-pc-windows-msvc
run: |
vcpkg install libpq[core]:x64-windows-release
cp "C:/vcpkg/installed/x64-windows-release/lib/*" "C:/Users/runneradmin/.rustup/toolchains/stable-x86_64-pc-windows-msvc/lib/rustlib/x86_64-pc-windows-msvc/lib/"
cp "C:/vcpkg/installed/x64-windows-release/bin/*" "C:/Users/runneradmin/.rustup/toolchains/stable-x86_64-pc-windows-msvc/lib/rustlib/x86_64-pc-windows-msvc/bin/"
- name: Build and test
run: cargo test --locked --target x86_64-pc-windows-msvc
env:
DATABASE_URL: ${{ steps.postgres.outputs.connection-uri }}

# TODO: setup postgres instance for testing
build-macos:
runs-on: macos-latest

steps:
- uses: actions/checkout@v4
- name: Build
run: cargo build --locked --target x86_64-apple-darwin
- uses: ikalnytskyi/action-setup-postgres@v5
id: postgres
- name: Build and test
run: cargo test --locked --target x86_64-apple-darwin
env:
DATABASE_URL: ${{ steps.postgres.outputs.connection-uri }}
7 changes: 2 additions & 5 deletions src/utils/fs/folders.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ mod tests {
.unwrap()
.downcast_ref::<String>()
.unwrap()
.contains("No such file or directory"));
.contains("NotFound"));
}

#[tokio::test]
Expand All @@ -137,10 +137,7 @@ mod tests {
.unwrap()
.downcast_ref::<String>()
.unwrap()
.contains(&concat_string!(
&file.to_string_lossy(),
" is not a directory"
)));
.contains("is not a directory"));
}

#[tokio::test]
Expand Down