|
1 | | -name: Precompile NIFs |
| 1 | +name: Build precompiled NIFs |
| 2 | + |
2 | 3 | on: |
3 | 4 | push: |
4 | 5 | tags: |
5 | 6 | - "v*" |
6 | 7 |
|
7 | | -permissions: |
8 | | - contents: write |
9 | | - |
10 | 8 | jobs: |
11 | | - build_nif: |
12 | | - name: NIF ${{ matrix.nif }} - ${{ matrix.job.target }} |
| 9 | + build_release: |
| 10 | + name: NIF ${{ matrix.nif }} - ${{ matrix.job.target }} (${{ matrix.job.os }}) |
13 | 11 | runs-on: ${{ matrix.job.os }} |
| 12 | + permissions: |
| 13 | + contents: write |
| 14 | + id-token: write |
| 15 | + attestations: write |
14 | 16 | strategy: |
15 | 17 | fail-fast: false |
16 | 18 | matrix: |
17 | | - nif: ["2.15", "2.16", "2.17"] |
| 19 | + nif: ["2.15"] |
18 | 20 | job: |
19 | | - - { target: aarch64-apple-darwin, os: macos-14 } |
20 | | - - { target: x86_64-apple-darwin, os: macos-13 } |
21 | | - - { target: x86_64-unknown-linux-gnu, os: ubuntu-22.04 } |
22 | | - - { target: x86_64-unknown-linux-musl, os: ubuntu-22.04 } |
23 | | - - { target: aarch64-unknown-linux-gnu, os: ubuntu-22.04 } |
24 | | - - { target: aarch64-unknown-linux-musl, os: ubuntu-22.04 } |
25 | | - - { target: x86_64-pc-windows-msvc, os: windows-2022 } |
| 21 | + - { target: aarch64-apple-darwin, os: macos-15 } |
| 22 | + - { target: x86_64-apple-darwin, os: macos-15-intel } |
| 23 | + - { target: x86_64-unknown-linux-gnu, os: ubuntu-22.04 } |
| 24 | + - { target: x86_64-unknown-linux-musl, os: ubuntu-22.04, use-cross: true } |
| 25 | + - { target: aarch64-unknown-linux-gnu, os: ubuntu-22.04, use-cross: true } |
| 26 | + - { target: aarch64-unknown-linux-musl, os: ubuntu-22.04, use-cross: true } |
| 27 | + - { target: x86_64-pc-windows-msvc, os: windows-2022 } |
26 | 28 |
|
27 | 29 | steps: |
28 | | - - uses: actions/checkout@v4 |
| 30 | + - name: Checkout source code |
| 31 | + uses: actions/checkout@v4 |
29 | 32 |
|
30 | | - - name: Extract version |
| 33 | + - name: Extract project version |
31 | 34 | shell: bash |
32 | 35 | run: | |
33 | | - VERSION=$(grep '@version "' mix.exs | cut -d'"' -f2) |
34 | | - echo "PROJECT_VERSION=$VERSION" >> $GITHUB_ENV |
| 36 | + echo "PROJECT_VERSION=$(sed -n 's/^ @version "\(.*\)"/\1/p' mix.exs | head -n1)" >> $GITHUB_ENV |
| 37 | +
|
| 38 | + - name: Install Rust toolchain |
| 39 | + uses: dtolnay/rust-toolchain@stable |
| 40 | + with: |
| 41 | + target: ${{ matrix.job.target }} |
35 | 42 |
|
36 | | - - name: Build NIF |
37 | | - id: build |
38 | | - uses: philss/rustler-precompiled-action@v1.1.4 |
| 43 | + - name: Build the project |
| 44 | + id: build-crate |
| 45 | + uses: philss/rustler-precompiled-action@v1.1.5 |
39 | 46 | with: |
40 | 47 | project-name: simdxml_nif |
41 | 48 | project-version: ${{ env.PROJECT_VERSION }} |
42 | 49 | target: ${{ matrix.job.target }} |
43 | 50 | nif-version: ${{ matrix.nif }} |
44 | | - use-cross: ${{ matrix.job.os == 'ubuntu-22.04' && matrix.job.target != 'x86_64-unknown-linux-gnu' }} |
45 | | - project-dir: native/simdxml_nif |
| 51 | + use-cross: ${{ matrix.job.use-cross }} |
| 52 | + project-dir: "native/simdxml_nif" |
46 | 53 |
|
47 | | - - name: Upload artifact |
| 54 | + - name: Artifact upload |
48 | 55 | uses: actions/upload-artifact@v4 |
49 | 56 | with: |
50 | | - name: ${{ steps.build.outputs.file-name }} |
51 | | - path: ${{ steps.build.outputs.file-path }} |
52 | | - |
53 | | - release: |
54 | | - needs: build_nif |
55 | | - runs-on: ubuntu-latest |
56 | | - steps: |
57 | | - - uses: actions/checkout@v4 |
58 | | - |
59 | | - - uses: actions/download-artifact@v4 |
60 | | - with: |
61 | | - path: artifacts |
62 | | - merge-multiple: true |
| 57 | + name: ${{ steps.build-crate.outputs.file-name }} |
| 58 | + path: ${{ steps.build-crate.outputs.file-path }} |
63 | 59 |
|
64 | | - - name: Create GitHub Release |
| 60 | + - name: Publish archives and packages |
65 | 61 | uses: softprops/action-gh-release@v2 |
66 | 62 | with: |
67 | | - files: artifacts/* |
68 | | - generate_release_notes: true |
| 63 | + files: | |
| 64 | + ${{ steps.build-crate.outputs.file-path }} |
| 65 | + if: startsWith(github.ref, 'refs/tags/') |
0 commit comments