2025-10-10 14:47:19 +02:00

116 lines
4.0 KiB
YAML

name: Artifacts
on:
push:
# tags:
# - 'v*'
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
cpu: [amd64]
nim_version: [v2.0.14]
rust_version: [1.79.0]
include:
- os: ubuntu-latest
lib_ext: so
shell: bash --noprofile --norc -e -o pipefail
- os: windows-latest
lib_ext: dll
shell: msys2
- os: macos-latest
lib_ext: so
shell: bash --noprofile --norc -e -o pipefail
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.cpu }}-libcodex-${{ hashFiles('vendor/nim-codex/.codex-commit') }}
- name: Release - Setup Nimbus Build System
uses: ./.github/actions/nimbus-build-system
with:
os: ${{ matrix.os }}
cpu: ${{ matrix.cpu }}
shell: ${{ matrix.shell }}
nim_version: ${{ matrix.nim_version }}
rust_version: ${{ matrix.rust_version }}
- name: Build libcodex (Linux)
if: runner.os == 'Linux' && steps.cache-libcodex.outputs.cache-hit != 'true'
run: |
CODEX_LIB_PARAMS="-d:LeopardCmakeFlags=\"-DCMAKE_POSITION_INDEPENDENT_CODE=ON\"" make libcodex
- name: Build libcodex (macOS)
if: runner.os == 'macos-latest' && steps.cache-libcodex.outputs.cache-hit != 'true'
run: |
CODEX_LIB_PARAMS="-d:LeopardCmakeFlags=\"-DCMAKE_POSITION_INDEPENDENT_CODE=ON\"" make libcodex
- name: Build libcodex (Windows)
if: matrix.os == 'windows-latest' && steps.cache-libcodex.outputs.cache-hit != 'true'
shell: msys2 {0}
run: |
CODEX_LIB_PARAMS="-d:LeopardCmakeFlags=\"-DCMAKE_POSITION_INDEPENDENT_CODE=ON\"" make libcodex
- name: Package artifacts (Linux/macOS)
if: matrix.os != 'windows-latest'
run: |
mkdir -p dist/${{ matrix.os }}-${{ matrix.cpu }}
cp vendor/nim-codex/build/libcodex.${{ matrix.lib_ext }} dist/${{ matrix.os }}-${{ matrix.cpu }}/
cp vendor/nim-codex/library/libcodex.h dist/${{ matrix.os }}-${{ matrix.cpu }}/
tar -czf codex-${{ matrix.os }}-${{ matrix.cpu }}.tar.gz -C dist/${{ matrix.os }}-${{ matrix.cpu }} .
echo "ARCHIVE_PATH=codex-${{ matrix.os }}-${{ matrix.cpu }}.tar.gz" >> $GITHUB_ENV
- name: Package artifacts (Windows)
if: matrix.os == 'windows-latest'
shell: msys2 {0}
run: |
mkdir -p dist/${{ matrix.os }}-${{ matrix.cpu }}
for file in libcodex.dll libcodex.dll.a libcodex.lib; do
if [ -f "vendor/nim-codex/build/${file}" ]; then
cp "vendor/nim-codex/build/${file}" dist/${{ matrix.os }}-${{ matrix.cpu }}/
fi
done
cp vendor/nim-codex/library/libcodex.h dist/${{ matrix.os }}-${{ matrix.cpu }}/
7z a codex-${{ matrix.os }}-${{ matrix.cpu }}.zip dist/${{ matrix.os }}-${{ matrix.cpu }}/*
echo "ARCHIVE_PATH=codex-${{ matrix.os }}-${{ matrix.cpu }}.zip" >> $GITHUB_ENV
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: codex-${{ matrix.os }}-${{ matrix.cpu }}
path: ${{ env.ARCHIVE_PATH }}
if-no-files-found: error
# publish-release:
# needs: build
# runs-on: ubuntu-latest-22.04
# steps:
# - uses: actions/download-artifact@v4
# with:
# path: dist
# - name: Create release draft
# uses: softprops/action-gh-release@v1
# with:
# files: dist/**/codex-*.{tar.gz,zip}
# draft: true