mirror of
https://github.com/logos-storage/logos-storage-go-bindings.git
synced 2026-01-02 13:33:10 +00:00
115 lines
3.4 KiB
YAML
115 lines
3.4 KiB
YAML
name: Artifacts
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- "v*"
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ${{ matrix.target.os }}
|
|
strategy:
|
|
matrix:
|
|
target:
|
|
- os: ubuntu-latest
|
|
cpu: amd64
|
|
lib_ext: so
|
|
|
|
- os: ubuntu-24.04-arm
|
|
cpu: arm64
|
|
lib_ext: so
|
|
|
|
- os: macos-latest
|
|
lib_ext: so
|
|
cpu: arm64
|
|
|
|
- os: windows-latest
|
|
cpu: amd64
|
|
lib_ext: dll
|
|
|
|
steps:
|
|
- name: Check out sources
|
|
uses: actions/checkout@v4
|
|
with:
|
|
submodules: recursive
|
|
|
|
- name: Set up Go
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
go-version-file: go.mod
|
|
|
|
- name: Record submodule commit
|
|
run: git -C vendor/nim-codex rev-parse HEAD > vendor/nim-codex/.codex-commit
|
|
|
|
- name: Cache libcodex build
|
|
id: cache-libcodex
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: vendor/nim-codex/build
|
|
key: ${{ runner.os }}-${{ matrix.target.cpu }}-libcodex-${{ hashFiles('vendor/nim-codex/.codex-commit') }}
|
|
|
|
- name: MSYS2 (Windows amd64)
|
|
if: matrix.target.os == 'windows-latest' && matrix.target.cpu == 'amd64'
|
|
uses: msys2/setup-msys2@v2
|
|
with:
|
|
path-type: inherit
|
|
msystem: UCRT64
|
|
install: >-
|
|
base-devel
|
|
git
|
|
mingw-w64-ucrt-x86_64-toolchain
|
|
mingw-w64-ucrt-x86_64-cmake
|
|
mingw-w64-ucrt-x86_64-ntldd-git
|
|
mingw-w64-ucrt-x86_64-rust
|
|
|
|
- name: Build libcodex (Linux and MacOS)
|
|
if: matrix.target.os != 'windows-latest' && steps.cache-libcodex.outputs.cache-hit != 'true'
|
|
run: |
|
|
make update
|
|
make libcodex
|
|
|
|
- name: Build libcodex (Windows)
|
|
if: matrix.target.os == 'windows-latest' && steps.cache-libcodex.outputs.cache-hit != 'true'
|
|
shell: msys2 {0}
|
|
run: |
|
|
pacman -Sy --noconfirm make
|
|
git config --global core.symlinks false
|
|
make update
|
|
make libcodex
|
|
|
|
- name: Package artifacts (Linux / macOS)
|
|
if: matrix.target.os != 'windows-latest'
|
|
run: |
|
|
if [ "$(uname)" = "Linux" ]; then sudo apt-get update && sudo apt-get install -y zip; fi
|
|
zip -j codex-${{ matrix.target.os }}-${{ matrix.target.cpu }}.zip vendor/nim-codex/build/libcodex.${{ matrix.target.lib_ext }} vendor/nim-codex/library/libcodex.h
|
|
|
|
- name: Package artifacts (Windows)
|
|
if: matrix.target.os == 'windows-latest'
|
|
shell: msys2 {0}
|
|
run: |
|
|
7z a codex-${{ matrix.target.os }}-${{ matrix.target.cpu }}.zip -si:libcodex.dll < vendor/nim-codex/build/libcodex.dll
|
|
7z a codex-${{ matrix.target.os }}-${{ matrix.target.cpu }}.zip -si:libcodex.h < vendor/nim-codex/library/libcodex.h
|
|
|
|
- name: Upload artifacts
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: codex-${{ matrix.target.os }}-${{ matrix.target.cpu }}
|
|
path: codex-${{ matrix.target.os }}-${{ matrix.target.cpu }}.zip
|
|
if-no-files-found: error
|
|
|
|
publish-release:
|
|
needs: build
|
|
runs-on: ubuntu-latest
|
|
if: startsWith(github.ref, 'refs/tags/')
|
|
steps:
|
|
- uses: actions/download-artifact@v5
|
|
with:
|
|
path: dist
|
|
- name: Create release
|
|
uses: softprops/action-gh-release@v2
|
|
with:
|
|
body_path: ./RELEASE.md
|
|
files: dist/**
|
|
draft: true
|