main.yml 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. name: CI
  2. on:
  3. push:
  4. branches: ["main"]
  5. pull_request:
  6. merge_group:
  7. types: [checks_requested]
  8. env:
  9. CARGO_NET_GIT_FETCH_WITH_CLI: true
  10. jobs:
  11. Test:
  12. strategy:
  13. matrix:
  14. os: [ubuntu-latest, macos-latest, windows-latest]
  15. rust: [1.67.0, stable, beta, nightly]
  16. exclude:
  17. - os: macos-latest
  18. rust: 1.67.0
  19. - os: windows-latest
  20. rust: 1.67.0
  21. - os: macos-latest
  22. rust: beta
  23. - os: windows-latest
  24. rust: beta
  25. - os: macos-latest
  26. rust: nightly
  27. runs-on: ${{ matrix.os }}
  28. steps:
  29. - uses: actions/checkout@v4
  30. - uses: dtolnay/rust-toolchain@master
  31. with:
  32. toolchain: ${{ matrix.rust }}
  33. - run: cargo build --all-targets
  34. # Run tests
  35. - name: Run tests
  36. run: cargo test
  37. # Run tests enabling the serde feature
  38. - name: Run tests with the serde feature
  39. run: cargo test --features "url/serde,url/expose_internals"
  40. # The #[debugger_visualizer] attribute is currently gated behind a feature flag until #[debugger_visualizer]
  41. # is available in all rustc versions past our MSRV. As such, we only run the tests on newer rustc versions.
  42. - name: Run debugger_visualizer tests
  43. if: |
  44. matrix.os == 'windows-latest' &&
  45. matrix.rust != '1.67.0'
  46. run: cargo test --test debugger_visualizer --features "url/debugger_visualizer,url_debug_tests/debugger_visualizer" -- --test-threads=1
  47. - name: Test `no_std` support
  48. run: cargo test --no-default-features --features=alloc
  49. WASM:
  50. runs-on: ubuntu-latest
  51. steps:
  52. - uses: actions/checkout@v4
  53. - uses: dtolnay/rust-toolchain@stable
  54. with:
  55. targets: wasm32-unknown-unknown
  56. - name: Install wasm-pack
  57. run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
  58. - run: cargo build --target wasm32-unknown-unknown
  59. - run: cd url && wasm-pack test --headless --chrome
  60. - run: cd url && wasm-pack test --headless --firefox
  61. Lint:
  62. runs-on: ubuntu-latest
  63. steps:
  64. - uses: actions/checkout@v4
  65. - uses: dtolnay/rust-toolchain@stable
  66. with:
  67. components: rustfmt, clippy
  68. - run: cargo fmt --all --check
  69. - run: cargo clippy --workspace --all-targets -- -D warnings
  70. if: always()
  71. Audit:
  72. runs-on: ubuntu-latest
  73. steps:
  74. - uses: actions/checkout@v4
  75. - uses: EmbarkStudios/cargo-deny-action@v1
  76. Result:
  77. name: Result
  78. runs-on: ubuntu-latest
  79. needs:
  80. - "Test"
  81. - "WASM"
  82. - "Lint"
  83. - "Audit"
  84. steps:
  85. - name: Mark the job as successful
  86. run: exit 0
  87. if: success()
  88. - name: Mark the job as unsuccessful
  89. run: exit 1
  90. if: "!success()"