ci.yml 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. name: CI
  2. on:
  3. push:
  4. branches: [master]
  5. pull_request:
  6. branches: [master]
  7. permissions:
  8. contents: read
  9. env:
  10. CI: true
  11. TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
  12. TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
  13. jobs:
  14. build:
  15. runs-on: ubuntu-latest
  16. timeout-minutes: 15
  17. strategy:
  18. matrix:
  19. node-version: [18]
  20. steps:
  21. - uses: actions/checkout@v3
  22. - name: Use Node.js ${{ matrix.node-version }}
  23. uses: actions/setup-node@v3
  24. with:
  25. node-version: ${{ matrix.node-version }}
  26. - name: Cache node_modules
  27. uses: actions/cache@v3
  28. with:
  29. path: node_modules
  30. key: ${{ runner.os }}-${{ matrix.node-version }}-node_modules-${{ hashFiles('**/package-lock.json') }}
  31. # Cargo already skips downloading dependencies if they already exist
  32. - name: Cache cargo
  33. uses: actions/cache@v3
  34. with:
  35. path: |
  36. ~/.cargo/bin/
  37. ~/.cargo/registry/index/
  38. ~/.cargo/registry/cache/
  39. ~/.cargo/git/db/
  40. target/
  41. key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
  42. # Cache the `oxide` Rust build
  43. - name: Cache oxide build
  44. uses: actions/cache@v3
  45. with:
  46. path: |
  47. ./oxide/target/
  48. ./oxide/crates/node/*.node
  49. ./oxide/crates/node/index.js
  50. ./oxide/crates/node/index.d.ts
  51. key: ${{ runner.os }}-oxide-${{ hashFiles('./oxide/crates/**/*') }}
  52. - name: Install dependencies
  53. run: npm install
  54. - name: Check versions
  55. run: |
  56. echo "Node:" `node --version`
  57. echo "NPM:" `npm --version`
  58. echo "Rust:" `rustc --version`
  59. echo "Cargo:" `cargo --version`
  60. - name: Build Tailwind CSS
  61. run: npx turbo run build --filter=//
  62. - name: Test (Node.js)
  63. run: |
  64. npx turbo run test --filter=// || \
  65. npx turbo run test --filter=// || \
  66. npx turbo run test --filter=// || exit 1
  67. - name: Test (Rust)
  68. run: |
  69. cd ./oxide
  70. cargo test || \
  71. cargo test || \
  72. cargo test || exit 1
  73. cd -
  74. - name: Lint
  75. run: npx turbo run style --filter=//