ci.yml 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. name: CI
  2. on:
  3. push:
  4. branches: [main]
  5. pull_request:
  6. branches: [main]
  7. workflow_dispatch:
  8. jobs:
  9. check:
  10. strategy:
  11. fail-fast: false
  12. matrix:
  13. include:
  14. - platform: macos-latest
  15. - platform: ubuntu-22.04
  16. - platform: windows-latest
  17. runs-on: ${{ matrix.platform }}
  18. steps:
  19. - name: Checkout
  20. uses: actions/checkout@v5
  21. - name: Install Rust stable
  22. uses: dtolnay/rust-toolchain@stable
  23. - name: Install protoc (macOS)
  24. if: matrix.platform == 'macos-latest'
  25. run: |
  26. brew untap aws/tap || true
  27. brew install protobuf
  28. - name: Install dependencies (Ubuntu)
  29. if: matrix.platform == 'ubuntu-22.04'
  30. run: |
  31. sudo apt-get update
  32. sudo apt-get install -y curl libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf protobuf-compiler
  33. - name: Install protoc (Windows)
  34. if: matrix.platform == 'windows-latest'
  35. uses: arduino/setup-protoc@v3
  36. with:
  37. repo-token: ${{ secrets.GITHUB_TOKEN }}
  38. - name: Rust cache
  39. uses: Swatinem/rust-cache@v2
  40. with:
  41. workspaces: src-tauri
  42. cache-on-failure: true
  43. - name: Setup Node.js
  44. uses: actions/setup-node@v5
  45. with:
  46. node-version: 24
  47. - name: Install frontend dependencies
  48. run: npm install
  49. - name: Check frontend build
  50. run: npx vite build
  51. - name: Check Rust build
  52. working-directory: src-tauri
  53. run: cargo build
  54. # Warm target/release on the default branch so tag builds can restore it.
  55. # GitHub cache is ref-scoped: tags cannot see other tags, but they can see main.
  56. # Windows also runs on PRs so this branch can measure release compile time.
  57. release-compile:
  58. name: Release compile ${{ matrix.display }}
  59. if: github.event_name != 'pull_request' || matrix.on_pr
  60. runs-on: ${{ matrix.platform }}
  61. env:
  62. CARGO_PROFILE_RELEASE_LTO: "false"
  63. CARGO_PROFILE_RELEASE_CODEGEN_UNITS: "16"
  64. CARGO_PROFILE_RELEASE_OPT_LEVEL: "1"
  65. strategy:
  66. fail-fast: false
  67. matrix:
  68. include:
  69. - platform: windows-latest
  70. display: Windows x64
  71. on_pr: true
  72. - platform: ubuntu-22.04
  73. display: Linux x64
  74. on_pr: false
  75. - platform: macos-latest
  76. display: macOS
  77. on_pr: false
  78. steps:
  79. - name: Checkout
  80. uses: actions/checkout@v5
  81. - name: Install Rust stable
  82. uses: dtolnay/rust-toolchain@stable
  83. - name: Install protoc (macOS)
  84. if: matrix.platform == 'macos-latest'
  85. run: |
  86. brew untap aws/tap || true
  87. brew install protobuf
  88. - name: Install dependencies (Ubuntu)
  89. if: matrix.platform == 'ubuntu-22.04'
  90. run: |
  91. sudo apt-get update
  92. sudo apt-get install -y curl libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf protobuf-compiler
  93. - name: Install protoc (Windows)
  94. if: matrix.platform == 'windows-latest'
  95. uses: arduino/setup-protoc@v3
  96. with:
  97. repo-token: ${{ secrets.GITHUB_TOKEN }}
  98. - name: Rust cache
  99. uses: Swatinem/rust-cache@v2
  100. with:
  101. workspaces: src-tauri
  102. shared-key: qmai-release
  103. add-job-id-key: false
  104. cache-on-failure: true
  105. - name: Setup Node.js
  106. uses: actions/setup-node@v5
  107. with:
  108. node-version: 24
  109. cache: npm
  110. - name: Install frontend dependencies
  111. run: npm ci
  112. - name: Build frontend
  113. run: npx vite build
  114. - name: Cargo release build
  115. working-directory: src-tauri
  116. run: cargo build --release