ci.yml 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. name: CI
  2. on:
  3. push:
  4. branches: [master, main]
  5. pull_request:
  6. env:
  7. CARGO_TERM_COLOR: always
  8. RUSTFLAGS: -Dwarnings
  9. jobs:
  10. fmt:
  11. name: Format
  12. runs-on: ubuntu-latest
  13. steps:
  14. - uses: actions/checkout@v4
  15. - uses: dtolnay/rust-toolchain@stable
  16. with:
  17. components: rustfmt
  18. - run: cargo fmt --all --check
  19. clippy:
  20. name: Clippy
  21. runs-on: ubuntu-latest
  22. steps:
  23. - uses: actions/checkout@v4
  24. - uses: dtolnay/rust-toolchain@stable
  25. with:
  26. components: clippy
  27. - uses: Swatinem/rust-cache@v2
  28. - run: cargo clippy --all-targets --all-features
  29. doc:
  30. name: Docs
  31. runs-on: ubuntu-latest
  32. env:
  33. RUSTDOCFLAGS: -Dwarnings
  34. steps:
  35. - uses: actions/checkout@v4
  36. - uses: dtolnay/rust-toolchain@stable
  37. - uses: Swatinem/rust-cache@v2
  38. - run: cargo doc --workspace --all-features --no-deps
  39. # `mdbook build` and not `mdbook test`: the rust samples in `doc/` are
  40. # fragments naming types the surrounding prose never defines. With
  41. # `create-missing` off in book.toml, a SUMMARY entry pointing at nothing
  42. # fails here.
  43. book:
  44. name: Book
  45. runs-on: ubuntu-latest
  46. env:
  47. MDBOOK: 0.5.4
  48. MDBOOK_MERMAID: 0.17.1
  49. steps:
  50. - uses: actions/checkout@v4
  51. # Prebuilt, because building mdBook from source costs more than the rest
  52. # of this workflow and nothing here needs a toolchain.
  53. - name: Install mdBook
  54. run: |
  55. mkdir -p "$HOME/.local/bin"
  56. echo "$HOME/.local/bin" >> "$GITHUB_PATH"
  57. base=https://github.com/rust-lang/mdBook/releases/download
  58. curl -sSfL \
  59. "$base/v$MDBOOK/mdbook-v$MDBOOK-x86_64-unknown-linux-gnu.tar.gz" \
  60. | tar -xz -C "$HOME/.local/bin"
  61. base=https://github.com/badboy/mdbook-mermaid/releases/download
  62. curl -sSfL \
  63. "$base/v$MDBOOK_MERMAID/mdbook-mermaid-v$MDBOOK_MERMAID-x86_64-unknown-linux-gnu.tar.gz" \
  64. | tar -xz -C "$HOME/.local/bin"
  65. - run: mdbook build
  66. test:
  67. name: Test (SQLite, i64)
  68. runs-on: ubuntu-latest
  69. steps:
  70. - uses: actions/checkout@v4
  71. - uses: dtolnay/rust-toolchain@stable
  72. - uses: Swatinem/rust-cache@v2
  73. # Default features: the SQLite backend with the i64 Cent backing.
  74. - run: cargo test --all
  75. test-i128:
  76. name: Test (i128 backing)
  77. runs-on: ubuntu-latest
  78. steps:
  79. - uses: actions/checkout@v4
  80. - uses: dtolnay/rust-toolchain@stable
  81. - uses: Swatinem/rust-cache@v2
  82. # Swap the Cent backing to i128 across the whole chain. Dashboard has no
  83. # i128 feature, so exclude it from the feature-scoped run.
  84. - run: cargo test --workspace --exclude kuatia-dashboard --features i128
  85. test-postgres:
  86. name: Test (PostgreSQL)
  87. runs-on: ubuntu-latest
  88. services:
  89. postgres:
  90. image: postgres:16
  91. env:
  92. POSTGRES_USER: kuatia
  93. POSTGRES_PASSWORD: kuatia
  94. POSTGRES_DB: kuatia
  95. ports:
  96. - 5432:5432
  97. options: >-
  98. --health-cmd "pg_isready -U kuatia"
  99. --health-interval 10s
  100. --health-timeout 5s
  101. --health-retries 5
  102. env:
  103. DATABASE_URL: postgres://kuatia:kuatia@localhost:5432/kuatia
  104. steps:
  105. - uses: actions/checkout@v4
  106. - uses: dtolnay/rust-toolchain@stable
  107. - uses: Swatinem/rust-cache@v2
  108. # Run only the SQL backend's conformance suite against real Postgres, so
  109. # the Postgres-only code paths (FOR UPDATE locks, ON CONFLICT) are covered.
  110. - run: cargo test -p kuatia-storage-sql --no-default-features --features test-postgres