|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + - develop |
| 8 | + pull_request: |
| 9 | + |
| 10 | +jobs: |
| 11 | + build: |
| 12 | + strategy: |
| 13 | + fail-fast: false |
| 14 | + matrix: |
| 15 | + settings: |
| 16 | + - host: macos-latest |
| 17 | + target: x86_64-apple-darwin |
| 18 | + build: npm run build --target x86_64-apple-darwin |
| 19 | + - host: macos-latest |
| 20 | + target: aarch64-apple-darwin |
| 21 | + build: npm run build --target aarch64-apple-darwin |
| 22 | + - host: ubuntu-latest |
| 23 | + target: x86_64-unknown-linux-gnu |
| 24 | + build: npm run build --target x86_64-unknown-linux-gnu |
| 25 | + - host: ubuntu-latest |
| 26 | + target: x86_64-unknown-linux-musl |
| 27 | + build: npm run build --target x86_64-unknown-linux-musl |
| 28 | + - host: ubuntu-latest |
| 29 | + target: aarch64-unknown-linux-gnu |
| 30 | + build: npm run build --target aarch64-unknown-linux-gnu |
| 31 | + - host: ubuntu-latest |
| 32 | + target: aarch64-unknown-linux-musl |
| 33 | + build: npm run build --target aarch64-unknown-linux-musl |
| 34 | + - host: windows-latest |
| 35 | + target: x86_64-pc-windows-msvc |
| 36 | + build: npm run build --target x86_64-pc-windows-msvc |
| 37 | + - host: windows-latest |
| 38 | + target: aarch64-pc-windows-msvc |
| 39 | + build: npm run build --target aarch64-pc-windows-msvc |
| 40 | + |
| 41 | + name: Build - ${{ matrix.settings.target }} |
| 42 | + runs-on: ${{ matrix.settings.host }} |
| 43 | + |
| 44 | + steps: |
| 45 | + - uses: actions/checkout@v4 |
| 46 | + |
| 47 | + - name: Setup Node.js |
| 48 | + uses: actions/setup-node@v4 |
| 49 | + with: |
| 50 | + node-version: 20 |
| 51 | + cache: 'npm' |
| 52 | + |
| 53 | + - name: Install Rust |
| 54 | + uses: dtolnay/rust-toolchain@stable |
| 55 | + with: |
| 56 | + toolchain: stable |
| 57 | + targets: ${{ matrix.settings.target }} |
| 58 | + |
| 59 | + - name: Cache cargo |
| 60 | + uses: actions/cache@v4 |
| 61 | + with: |
| 62 | + path: | |
| 63 | + ~/.cargo/registry/index/ |
| 64 | + ~/.cargo/registry/cache/ |
| 65 | + ~/.cargo/git/db/ |
| 66 | + target/ |
| 67 | + key: ${{ matrix.settings.target }}-cargo-${{ hashFiles('**/Cargo.lock') }} |
| 68 | + |
| 69 | + - name: Install dependencies |
| 70 | + run: npm ci |
| 71 | + |
| 72 | + - name: Build |
| 73 | + run: ${{ matrix.settings.build }} |
| 74 | + |
| 75 | + - name: Upload artifact |
| 76 | + uses: actions/upload-artifact@v4 |
| 77 | + with: |
| 78 | + name: bindings-${{ matrix.settings.target }} |
| 79 | + path: '*.node' |
| 80 | + if-no-files-found: error |
| 81 | + |
| 82 | + test: |
| 83 | + name: Test Node.js ${{ matrix.node }} - ${{ matrix.os }} |
| 84 | + runs-on: ${{ matrix.os }} |
| 85 | + strategy: |
| 86 | + fail-fast: false |
| 87 | + matrix: |
| 88 | + os: [ubuntu-latest, macos-latest, windows-latest] |
| 89 | + node: ['16', '18', '20'] |
| 90 | + |
| 91 | + steps: |
| 92 | + - uses: actions/checkout@v4 |
| 93 | + |
| 94 | + - name: Setup Node.js ${{ matrix.node }} |
| 95 | + uses: actions/setup-node@v4 |
| 96 | + with: |
| 97 | + node-version: ${{ matrix.node }} |
| 98 | + cache: 'npm' |
| 99 | + |
| 100 | + - name: Install Rust |
| 101 | + uses: dtolnay/rust-toolchain@stable |
| 102 | + |
| 103 | + - name: Install dependencies |
| 104 | + run: npm ci |
| 105 | + |
| 106 | + - name: Build |
| 107 | + run: npm run build:debug |
| 108 | + |
| 109 | + - name: Test |
| 110 | + run: npm test |
| 111 | + if: matrix.os != 'windows-latest' |
0 commit comments