diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5d8f88b6..54ad8dbc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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: @@ -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: | @@ -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 @@ -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 @@ -82,59 +87,81 @@ 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 '' > 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 . # FIXME: Disable for now since it's very costly to run. @@ -142,14 +169,13 @@ jobs: 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 @@ -157,7 +183,7 @@ jobs: 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 }} diff --git a/Cargo.toml b/Cargo.toml index fd6a592c..65bfe230 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,8 +3,7 @@ name = "junction" version = "1.1.0" # Also update `html_root_url` in lib.rs authors = ["Lzu Tao "] 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", @@ -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] diff --git a/README.md b/README.md index 37a76d00..caba1b86 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/src/internals/c.rs b/src/internals/c.rs index 30deb605..7ddfc798 100644 --- a/src/internals/c.rs +++ b/src/internals/c.rs @@ -36,8 +36,8 @@ const _: () = { let std_layout = Layout::new::(); let win_sys_layout = Layout::new::(); // 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. diff --git a/src/lib.rs b/src/lib.rs index fa518329..8552d9b6 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -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;