main.yml 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. name: CI
  2. on:
  3. push:
  4. branches: ["master"]
  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.56.0, stable, beta, nightly]
  16. exclude:
  17. - os: macos-latest
  18. rust: 1.56.0
  19. - os: windows-latest
  20. rust: 1.56.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@v3
  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.56.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@v3
  53. - uses: dtolnay/rust-toolchain@stable
  54. with:
  55. targets: wasm32-unknown-unknown
  56. - run: cargo build --target wasm32-unknown-unknown
  57. Lint:
  58. runs-on: ubuntu-latest
  59. steps:
  60. - uses: actions/checkout@v3
  61. - uses: dtolnay/rust-toolchain@stable
  62. with:
  63. components: rustfmt, clippy
  64. - run: cargo fmt --all --check
  65. - run: cargo clippy --workspace --all-targets -- -D warnings
  66. if: always()
  67. Audit:
  68. runs-on: ubuntu-latest
  69. steps:
  70. - uses: actions/checkout@v3
  71. - uses: EmbarkStudios/cargo-deny-action@v1
  72. Result:
  73. name: Result
  74. runs-on: ubuntu-latest
  75. needs:
  76. - "Test"
  77. - "WASM"
  78. - "Lint"
  79. - "Audit"
  80. steps:
  81. - name: Mark the job as successful
  82. run: exit 0
  83. if: success()
  84. - name: Mark the job as unsuccessful
  85. run: exit 1
  86. if: "!success()"