|
| 1 | +name: Build & Test |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_call: |
| 5 | + inputs: |
| 6 | + run-test: |
| 7 | + default: true |
| 8 | + type: boolean |
| 9 | + |
| 10 | +jobs: |
| 11 | + build: |
| 12 | + name: ${{ matrix.platform }} (${{ matrix.target }}) (${{ matrix.os }}) |
| 13 | + runs-on: ${{ matrix.os }} |
| 14 | + timeout-minutes: 40 |
| 15 | + strategy: |
| 16 | + fail-fast: false |
| 17 | + matrix: |
| 18 | + platform: |
| 19 | + - linux-arm64 |
| 20 | + - linux-x64 |
| 21 | + - windows-arm64 |
| 22 | + - windows-x64 |
| 23 | + - macos-arm64 |
| 24 | + |
| 25 | + include: |
| 26 | + # When adding a new `target`: |
| 27 | + # 1. Define a new platform alias above |
| 28 | + # 2. Add a new record to the matrix map in `crates/cli/npm/install.js` |
| 29 | + - { platform: macos-arm64, target: aarch64-apple-darwin, os: macos-15 } |
| 30 | + - { platform: windows-arm64, target: aarch64-pc-windows-msvc, os: windows-11-arm } |
| 31 | + - { platform: linux-arm64, target: aarch64-unknown-linux-gnu, os: ubuntu-24.04-arm } |
| 32 | + - { platform: windows-x64, target: x86_64-pc-windows-msvc, os: windows-2025 } |
| 33 | + - { platform: linux-x64, target: x86_64-unknown-linux-gnu, os: ubuntu-24.04 } |
| 34 | + # Extra features |
| 35 | + |
| 36 | + env: |
| 37 | + CARGO_TERM_COLOR: always |
| 38 | + RUSTFLAGS: -D warnings |
| 39 | + |
| 40 | + defaults: |
| 41 | + run: |
| 42 | + shell: bash |
| 43 | + |
| 44 | + steps: |
| 45 | + - name: Checkout repository |
| 46 | + uses: actions/checkout@v6 |
| 47 | + |
| 48 | + - name: Set up Rust |
| 49 | + uses: actions-rust-lang/setup-rust-toolchain@v1 |
| 50 | + with: |
| 51 | + target: ${{ matrix.target }} |
| 52 | + |
| 53 | + - name: Build target |
| 54 | + run: cargo build --release --target='${{ matrix.target }}' --features='${{ matrix.features }}' |
| 55 | + |
| 56 | + - name: Run main tests |
| 57 | + if: inputs.run-test && !matrix.no-run |
| 58 | + run: cargo test --target='${{ matrix.target }}' --features='${{ matrix.features }}' |
| 59 | + |
| 60 | + - name: Upload CLI artifact |
| 61 | + if: "!matrix.no-run" |
| 62 | + uses: actions/upload-artifact@v6 |
| 63 | + with: |
| 64 | + name: beancount-language-server.${{ matrix.platform }} |
| 65 | + path: target/${{ matrix.target }}/release/beancount-language-server${{ contains(matrix.target, 'windows') && '.exe' || '' }} |
| 66 | + if-no-files-found: error |
| 67 | + retention-days: 7 |
0 commit comments