build-ffi.yml (1824B)
1 name: Build FFI Library 2 3 on: 4 push: 5 tags: 6 - 'v*' 7 workflow_dispatch: 8 9 jobs: 10 build: 11 strategy: 12 fail-fast: false 13 matrix: 14 include: 15 - os: ubuntu-latest 16 target: x86_64-unknown-linux-gnu 17 artifact: libnickel_lang.so 18 artifact_name: libnickel_lang-x86_64-linux-gnu.tar.gz 19 - os: macos-14 20 target: aarch64-apple-darwin 21 artifact: libnickel_lang.dylib 22 artifact_name: libnickel_lang-aarch64-apple-darwin.tar.gz 23 24 runs-on: ${{ matrix.os }} 25 26 steps: 27 - name: Clone Nickel 28 run: git clone --depth 1 --branch 1.16.0 https://github.com/nickel-lang/nickel.git 29 30 - name: Install Rust 31 uses: dtolnay/rust-toolchain@stable 32 with: 33 targets: ${{ matrix.target }} 34 35 - name: Build library 36 working-directory: nickel 37 run: cargo build --release -p nickel-lang --features capi --target ${{ matrix.target }} 38 39 - name: Package artifact 40 run: | 41 cd nickel/target/${{ matrix.target }}/release 42 tar -czvf ${{ matrix.artifact_name }} ${{ matrix.artifact }} 43 mv ${{ matrix.artifact_name }} ${{ github.workspace }}/ 44 45 - name: Upload artifact 46 uses: actions/upload-artifact@v4 47 with: 48 name: ${{ matrix.artifact_name }} 49 path: ${{ matrix.artifact_name }} 50 51 release: 52 needs: build 53 runs-on: ubuntu-latest 54 if: startsWith(github.ref, 'refs/tags/') 55 permissions: 56 contents: write 57 58 steps: 59 - name: Download all artifacts 60 uses: actions/download-artifact@v4 61 with: 62 path: artifacts 63 64 - name: Create Release 65 uses: softprops/action-gh-release@v1 66 with: 67 files: artifacts/**/*.tar.gz 68 generate_release_notes: true