fork/static-web-server
git clone https://git.julia.blue/fork/static-web-server
0b128b9
allow-symlink
1name : devel 2on : 3merge_group : 4branches : 5- master 6pull_request : 7paths : 8- .github/workflows/devel.yml 9- .cargo/config.toml 10- Cargo.lock 11- Cargo.toml 12- src/** 13- tests/** 14push : 15branches : 16- master 17paths : 18- .github/workflows/devel.yml 19- .cargo/config.toml 20- Cargo.lock 21- Cargo.toml 22- src/** 23- tests/** 24schedule : 25- cron : '30 01 * * *' # Every day at 01:30 UTC 26 27jobs : 28checks : 29name : Code checks 30runs-on : ubuntu-22.04 31 32steps : 33- name : Checkout repository 34uses : actions/checkout@v4 35with : 36fetch-depth : 1 37 38- name : Install stable toolchain 39uses : dtolnay/rust-toolchain@stable 40with : 41toolchain : stable 42components : rustfmt, clippy 43 44- name : Check formatting 45run : | 46cargo fmt --all -- --check tests/*.rs 47 48- name : Check via Clippy 49run : | 50cargo clippy --all-features -- -D warnings 51 52- name : Check via Clippy (tests) 53run : | 54cargo clippy --all-features --tests -- -D warnings 55 56test : 57name : Test 58runs-on : ${{ matrix.os }} 59env : 60# Cargo binary 61CARGO_BIN : cargo 62# When CARGO_BIN is set to CROSS, this is set to `--target matrix.target` 63TARGET_FLAGS : "" 64# When CARGO_BIN is set to CROSS, TARGET_DIR includes matrix.target 65TARGET_DIR : ./target 66# Emit backtraces on panics 67RUST_BACKTRACE : 1 68# Skip tests 69SKIP_TESTS : "" 70# SWS features for Cargo build 71CARGO_FEATURES : "--features=all" 72strategy : 73matrix : 74build : 75- pinned 76- linux-musl 77- linux-musl-arm64 78- linux-musl-i686 79- linux-gnu 80- linux-gnu-arm64 81- linux-gnu-i686 82- linux-arm-gnueabihf 83- linux-musl-armv6 84- linux-musl-armv7 85- linux-gnu-armv7 86- linux-ppc64le 87- linux-s390x 88# NOTE: looks like not supported by `listenfd` crate 89# - linux-android-armv7 90- linux-android-arm64 91- netbsd 92- illumos 93- macos 94- macos-arm64 95- windows-msvc 96- windows-msvc-i686 97- windows-msvc-arm64 98- windows-pc-gnu 99include : 100# Specific Rust channels. 101# We test against the latest and minimum Rust stable version. 102- build : pinned 103os : ubuntu-22.04 104rust : 1.88.0 105# Some of our release builds are generated by a nightly compiler to take 106# advantage of the latest optimizations/compile time improvements. 107- build : linux-musl 108os : ubuntu-22.04 109rust : stable 110target : x86_64-unknown-linux-musl 111- build : linux-musl-i686 112os : ubuntu-22.04 113rust : stable 114target : i686-unknown-linux-musl 115- build : linux-musl-arm64 116os : ubuntu-22.04 117rust : stable 118target : aarch64-unknown-linux-musl 119- build : linux-gnu 120os : ubuntu-22.04 121rust : stable 122target : x86_64-unknown-linux-gnu 123- build : linux-gnu-i686 124os : ubuntu-22.04 125rust : stable 126target : i686-unknown-linux-gnu 127- build : linux-gnu-arm64 128os : ubuntu-22.04 129rust : stable 130target : aarch64-unknown-linux-gnu 131- build : linux-arm-gnueabihf 132os : ubuntu-22.04 133rust : stable 134target : arm-unknown-linux-gnueabihf 135- build : linux-musl-armv6 136os : ubuntu-22.04 137rust : stable 138target : arm-unknown-linux-musleabihf 139- build : linux-musl-armv7 140os : ubuntu-22.04 141rust : stable 142target : armv7-unknown-linux-musleabihf 143- build : linux-gnu-armv7 144os : ubuntu-22.04 145rust : stable 146target : armv7-unknown-linux-gnueabihf 147- build : linux-ppc64le 148os : ubuntu-22.04 149rust : stable 150target : powerpc64le-unknown-linux-gnu 151- build : linux-s390x 152os : ubuntu-22.04 153rust : stable 154target : s390x-unknown-linux-gnu 155# NOTE: looks like not supported by `listenfd` crate 156# - build: linux-android-armv7 157# os: ubuntu-22.04 158# rust: stable 159# target: armv7-linux-androideabi 160- build : linux-android-arm64 161os : ubuntu-22.04 162rust : stable 163target : aarch64-linux-android 164- build : netbsd 165os : ubuntu-22.04 166rust : stable 167target : x86_64-unknown-netbsd 168- build : illumos 169os : ubuntu-22.04 170rust : stable 171target : x86_64-unknown-illumos 172- build : macos 173os : macos-14 174rust : stable 175target : x86_64-apple-darwin 176- build : macos-arm64 177os : macos-14 178rust : stable 179target : aarch64-apple-darwin 180- build : windows-msvc 181os : windows-2022 182rust : stable 183target : x86_64-pc-windows-msvc 184- build : windows-msvc-i686 185os : windows-2022 186rust : stable 187target : i686-pc-windows-msvc 188- build : windows-msvc-arm64 189os : windows-2022 190rust : stable 191target : aarch64-pc-windows-msvc 192- build : windows-pc-gnu 193os : windows-2022 194rust : stable 195target : x86_64-pc-windows-gnu 196 197steps : 198- name : Checkout repository 199uses : actions/checkout@v4 200with : 201fetch-depth : 1 202 203- name : Cache Rust Cargo/Toolchain 204uses : actions/cache@v4 205with : 206path : | 207~/.cargo 208**/target 209key : rust-${{ matrix.build }}-${{ matrix.target }}-${{ hashFiles('**/Cargo.lock') }} 210restore-keys : | 211rust-${{ matrix.build }}-${{ matrix.target }}- 212 213- name : Install Linux/BSD tools 214if : ${{ !contains(matrix.os, 'windows') }} 215run : scripts/ci/install_tools.sh --target=${{ matrix.target }} 216 217- name : Install Rust 218uses : dtolnay/rust-toolchain@stable 219with : 220toolchain : ${{ matrix.rust }} 221target : ${{ matrix.target }} 222 223- name : Set up Cross 224if : ${{ !contains(matrix.os, 'windows') && matrix.target != '' }} 225shell : bash 226run : | 227# Use 'cargo.sh' script for Android targets only 228if [[ "${{ matrix.build }}" == "linux-android-armv7" ]] || [[ "${{ matrix.build }}" == "linux-android-arm64" ]]; then 229echo "CARGO_BIN=scripts/ci/cargo.sh" >> $GITHUB_ENV 230else 231target='' 232case "${{ matrix.os }}" in 233*macos*) 234target=x86_64-apple-darwin 235;; 236*) 237target=x86_64-unknown-linux-musl 238;; 239esac 240 241echo "Installing cross..." 242curl -sSL \ 243"https://github.com/cross-rs/cross/releases/download/v0.2.5/cross-$target.tar.gz" \ 244| sudo tar zxf - -C /usr/local/bin/ cross cross-util 245cross -V 246echo "CARGO_BIN=/usr/local/bin/cross" >> $GITHUB_ENV 247fi 248 249- name : Setup Cargo 250shell : bash 251run : | 252if [[ "${{ matrix.target }}" != "" ]]; then 253echo "TARGET_FLAGS=--target=${{ matrix.target }}" >> $GITHUB_ENV 254echo "TARGET_DIR=./target/${{ matrix.target }}" >> $GITHUB_ENV 255fi 256echo "cargo command is: ${{ env.CARGO_BIN }}" 257echo "target flag is: ${{ env.TARGET_FLAGS }}" 258echo "target dir is: ${{ env.TARGET_DIR }}" 259 260- name : Setup Windows ARM64 261if : ${{ contains(matrix.build, 'windows-msvc-arm64') }} 262run : | 263# ring crate: add Visual Studio Build Tools "VS 2022 C++ ARM64 build tools" and "clang" components 264$env:Path += ";C:\Program Files (x86)\Microsoft Visual Studio\2022\Enterprise\VC\Tools\Llvm\x64\bin" 265 266- name : Skip tests 267shell : bash 268if : ${{ contains(fromJSON('["macos-arm64", "linux-android-arm64", "linux-android-armv7", "netbsd", "illumos", "windows-msvc-arm64"]'), matrix.build) }} 269run : | 270# Can't run tests: cross-compiling 271echo "SKIP_TESTS=--no-run" >> $GITHUB_ENV 272 273- name : Run tests 274shell : bash 275run : | 276${{ env.CARGO_BIN }} test --verbose ${{ env.CARGO_FEATURES }} ${{ env.TARGET_FLAGS }} ${{ env.SKIP_TESTS }} 277 278- name : Run build 279shell : bash 280run : | 281${{ env.CARGO_BIN }} build --bin static-web-server -vv ${{ env.CARGO_FEATURES }} ${{ env.TARGET_FLAGS }} 282 283- name : Run executable 284shell : bash 285run : | 286case "${{ matrix.build }}" in 287*-arm*|*bsd*|*illumos*|*ppc64*|*s390x*) 288echo "arm,bsd,illumos,ppc64,s390x are unable to execute on CI for now!" 289;; 290*) 291if [[ "${{ matrix.os }}" == "windows-2022" ]]; then 292target/${{ matrix.target }}/debug/static-web-server.exe -h 293else 294target/${{ matrix.target }}/debug/static-web-server -h 295fi 296;; 297esac 298 299- name : Turn off default features 300shell : bash 301run : | 302echo "CARGO_FEATURES=--no-default-features" >> $GITHUB_ENV 303 304- name : Run tests without default features 305shell : bash 306run : | 307${{ env.CARGO_BIN }} test --verbose ${{ env.CARGO_FEATURES }} ${{ env.TARGET_FLAGS }} ${{ env.SKIP_TESTS }} 308 309- name : Run build without default features 310shell : bash 311run : | 312${{ env.CARGO_BIN }} build --bin static-web-server -vv ${{ env.CARGO_FEATURES }} ${{ env.TARGET_FLAGS }} 313 314- name : Run executable without default features 315shell : bash 316run : | 317case "${{ matrix.build }}" in 318*-arm*|*bsd*|*illumos*|*ppc64*|*s390x*) 319echo "arm,bsd,illumos,ppc64,s390x are unable to execute on CI for now!" 320;; 321*) 322if [[ "${{ matrix.os }}" == "windows-2022" ]]; then 323target/${{ matrix.target }}/debug/static-web-server.exe -h 324else 325target/${{ matrix.target }}/debug/static-web-server -h 326fi 327;; 328esac 329 330docs-check : 331name : Docs check 332runs-on : ubuntu-22.04 333 334steps : 335- name : Checkout repository 336uses : actions/checkout@v4 337with : 338fetch-depth : 1 339 340- name : Install nightly toolchain 341uses : dtolnay/rust-toolchain@stable 342with : 343toolchain : nightly 344components : rustfmt, clippy 345 346- name : Rustdoc build 347run : | 348 cargo +nightly rustdoc --lib -Zrustdoc-map --all-features \ 349 --config "build.rustflags=[\"--cfg\", \"tokio_unstable\"]" \ 350 -Zhost-config -Ztarget-applies-to-host \ 351 --config "host.rustflags=[\"--cfg\", \"tokio_unstable\"]" \ 352 --config "build.rustdocflags=[\"--cfg\", \"docsrs\", \"--cfg\", \"docsrs\", \"--cfg\", \"tokio_unstable\", \"-Z\", \"unstable-options\", \"--emit=invocation-specific\", \"--cap-lints\", \"warn\", \"--extern-html-root-takes-precedence\"]" \ 353 -Zunstable-options -- --document-private-items