Skip to content
Open
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
104 changes: 65 additions & 39 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,16 @@ on:
- '!gh-pages'
pull_request:

# rust 1.68
env:
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse

jobs:
build:
if: false
runs-on: windows-latest
env:
RUST_BACKTRACE: 1
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
MINGW_URL: https://ci-mirrors.rust-lang.org/rustc
MIRIFLAGS: -Zmiri-disable-isolation
strategy:
Expand All @@ -26,9 +30,9 @@ jobs:
archive: i686-6.3.0-release-posix-dwarf-rt_v5-rev2.7z
mingw_dir: mingw32
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- run: |
rustup toolchain install stable-${{ matrix.target }}
rustup toolchain install --no-self-update stable-${{ matrix.target }}
rustup default stable-${{ matrix.target }}
- name: Check out MinGW toolchain
run: |
Expand All @@ -39,6 +43,7 @@ jobs:
echo "C:\mingw\${{ matrix.mingw_dir }}\bin" >> $GITHUB_PATH
shell: bash
if: matrix.mingw_dir
- run: cargo fetch
- run: cargo build
- run: cargo build --features nightly
- run: cargo build --all-targets
Expand All @@ -64,16 +69,16 @@ jobs:
shell: cmd

msrv:
if: false
runs-on: windows-latest
# needs: [build]
env:
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
# add_of_mut! requires for soundness
MSRV: 1.56.0
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- run: |
rustup toolchain install ${{ env.MSRV }}
rustup toolchain install --no-self-update ${{ env.MSRV }}
rustup default ${{ env.MSRV }}
- run: |
rustup run stable cargo generate-lockfile
Expand All @@ -82,82 +87,103 @@ jobs:
cargo build --locked

rustfmt:
if: false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- run: cargo fmt -- --check

rustdoc:
runs-on: windows-latest
env:
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
if: github.event_name != 'pull_request' && github.event.ref == 'refs/heads/master'
needs: [build]
steps:
- name: Before checking out source and change \n -> \r\n
run: |
git config --global core.autocrlf false
git config --global core.eol lf
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- run: |
rustup toolchain install nightly
rustup toolchain install --no-self-update nightly
rustup default nightly
- run: cargo doc --all --no-deps # --document-private-items
- run: echo '<meta http-equiv=refresh content=0;url=junction/index.html>' > target/doc/index.html
- name: Commit docs to gh-pages branch
working-directory: target/doc
run: |
# Bypassing Jekyll on GitHub Pages
touch .nojekyll
REV=$(git rev-parse --short HEAD)
git init
git config user.name "Actions"
git config user.email ""
git add -A .
# git add --renormalize .
git commit -qm "Documentation for ${{github.repository}}@${REV}"
shell: bash
- name: Push gh-pages to GitHub
working-directory: target/doc
run: |
git remote add upstream https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}
git push -q upstream HEAD:gh-pages --force
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: target/doc
retention-days: 1

deploy:
if: github.event_name != 'pull_request' && github.event.ref == 'refs/heads/master'
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
permissions:
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source
needs: [rustdoc]
runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
uses: actions/deploy-pages@v4

clippy:
runs-on: windows-latest
needs: [build]
env:
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- run: |
rustup toolchain install nightly -c clippy
rustup toolchain install --no-self-update nightly -c clippy
rustup default nightly
- run: cargo clippy --all-targets --all-features -- -Dwarnings -A clippy::assertions-on-constants

mirai:
# if: false
runs-on: windows-latest
env:
MSRV: nightly-2023-09-10
steps:
- uses: actions/checkout@v4
with:
path: junction
- uses: actions/checkout@v4
with:
repository: facebookexperimental/MIRAI
path: mirai
- name: rustup
run: |
rustup set auto-self-update disable
rustup toolchain install ${{ env.MSRV }} -c rustc-dev
rustup default ${{ env.MSRV }}
- name: setup
working-directory: mirai
shell: bash
run: |
cargo fetch
cargo install --locked --path ./checker
- name: mirai check
working-directory: junction
run: |
cargo mirai --all-targets # for crate compilation

# Use static analyzer Rudra <https://github.com/sslab-gatech/Rudra>.
# FIXME: Disable for now since it's very costly to run.
rudra:
if: false
runs-on: ubuntu-latest
env:
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
MSRV: nightly-2021-08-20
WIN_TARGET: x86_64-pc-windows-gnu
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
path: junction
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
repository: sslab-gatech/Rudra
path: Rudra
- name: setup
shell: bash
run: |
# Toolchain setup
rustup toolchain install ${{ env.MSRV }} -c rustc-dev -c miri
rustup toolchain install --no-self-update ${{ env.MSRV }} -c rustc-dev -c miri
rustup default ${{ env.MSRV }}
rustup target add ${{ env.WIN_TARGET }}

Expand Down
5 changes: 2 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ name = "junction"
version = "1.1.0" # Also update `html_root_url` in lib.rs
authors = ["Lzu Tao <[email protected]>"]
categories = ["api-bindings", "os::windows-apis"]
documentation = "https://docs.rs/junction/*/x86_64-pc-windows-msvc/junction/"
edition = "2018" # edition 2021 released in 1.56.0
edition = "2021"
rust-version = "1.56"
exclude = [
"/.github",
Expand All @@ -13,7 +12,7 @@ exclude = [
keywords = ["junction", "symlink"]
license = "MIT"
readme = "README.md"
repository = "https://github.com/lzutao/junction"
repository = "https://github.com/tesuji/junction"
description = "library for working with NTFS junctions"

[features]
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Quoted from [Computer Hope](https://www.computerhope.com/jargon/j/junction.htm):
All the code in this repository is released under the MIT License,
for more information, please read COPYRIGHT file.

[actions-badge]: https://github.com/lzutao/junction/workflows/Rust/badge.svg?branchName=master
[actions-badge]: https://github.com/lzutao/junction/workflows/Rust/badge.svg?branchName=main
[actions-url]: https://github.com/lzutao/junction/actions
[junction]: https://learn.microsoft.com/en-us/windows/win32/fileio/hard-links-and-junctions#junctions
[perm]: https://en.wikipedia.org/wiki/NTFS_links#Restrictions_and_drawbacks
Expand Down
4 changes: 2 additions & 2 deletions src/internals/c.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ const _: () = {
let std_layout = Layout::new::<RawHandle>();
let win_sys_layout = Layout::new::<HANDLE>();
// MSVR(Rust v1.57): use assert! instead
[(); 1][!(std_layout.size() == win_sys_layout.size()) as usize];
[(); 1][!(std_layout.align() == win_sys_layout.align()) as usize];
[(); 1][std_layout.size() - win_sys_layout.size()];
[(); 1][std_layout.align() - win_sys_layout.align()];
};

// NOTE: to use `size_of` operator, below structs should be packed.
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ an application accessing `D:\SYMLINK\DRIVERS` would in reality be accessing
*/
#![doc(html_root_url = "https://docs.rs/junction/~1")]
#![cfg(windows)]
#![deny(rust_2018_idioms)]
#![deny(rust_2021_compatibility)]

mod internals;

Expand Down