feat: bump C-API #405
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copyright (c) 2016-2023 Knuth Project developers. | |
# Distributed under the MIT software license, see the accompanying | |
# file COPYING or http://www.opensource.org/licenses/mit-license.php. | |
name: Build and Test | |
on: [push, pull_request] | |
jobs: | |
# test-macos-14-x86: | |
# name: Test macOS 14 x86_64 | |
# runs-on: macos-14-large | |
# steps: | |
# - name: Hello | |
# run: | | |
# echo "Hello from macos-14 x86_64" | |
# test-macos-14-arm: | |
# name: Test macOS 14 ARM | |
# runs-on: macos-14-arm64 | |
# steps: | |
# - name: Hello | |
# run: | | |
# echo "Hello from macos-14 ARM" | |
generate-matrix: | |
name: Generate Job Matrix | |
if: github.ref == 'refs/heads/master' | |
runs-on: ubuntu-22.04 | |
outputs: | |
matrix: ${{ steps.set-matrix.outputs.matrix }} | |
steps: | |
- name: Generate Job Matrix | |
id: set-matrix | |
env: | |
# MATRIX: '{"config":[{"name":"Linux NodeJS 16","nodejs_version":"16","os":"ubuntu-20.04","os_kind":"linux","march_id":"x64-ZLm9Pjh","test":"1"}, | |
# {"name":"Linux NodeJS 14","nodejs_version":"14","os":"ubuntu-20.04","os_kind":"linux","march_id":"x64-ZLm9Pjh","test":"1"}, | |
# {"name":"Linux NodeJS 12","nodejs_version":"12","os":"ubuntu-20.04","os_kind":"linux","march_id":"x64-ZLm9Pjh","test":"1"}, | |
# {"name":"macOS NodeJS 16","nodejs_version":"16","os":"macos-11","os_kind":"macos","march_id":"x64-ZLm9Pjh","test":"0"}, | |
# {"name":"macOS NodeJS 14","nodejs_version":"14","os":"macos-11","os_kind":"macos","march_id":"x64-ZLm9Pjh","test":"0"}, | |
# {"name":"macOS NodeJS 12","nodejs_version":"12","os":"macos-11","os_kind":"macos","march_id":"x64-ZLm9Pjh","test":"0"}, | |
# {"name":"Windows NodeJS 16","nodejs_version":"16","os":"windows-2022","os_kind":"windows","march_id":"x64-ZLm9Pjh","test":"1"}, | |
# {"name":"Windows NodeJS 14","nodejs_version":"14","os":"windows-2022","os_kind":"windows","march_id":"x64-ZLm9Pjh","test":"1"}, | |
# {"name":"Windows NodeJS 12","nodejs_version":"12","os":"windows-2022","os_kind":"windows","march_id":"x64-ZLm9Pjh","test":"1"}, | |
# ]}' | |
# MATRIX: '{"config":[{"name":"Linux (GCC11) NodeJS 16","nodejs_version":"16","os":"ubuntu-20.04","os_kind":"linux","march_id":"x64-ZLm9Pjh","test":"1"}, | |
# {"name":"Linux (GCC11) NodeJS 14","nodejs_version":"14","os":"ubuntu-20.04","os_kind":"linux","march_id":"x64-ZLm9Pjh","test":"1"}, | |
# {"name":"Linux (GCC11) NodeJS 12","nodejs_version":"12","os":"ubuntu-20.04","os_kind":"linux","march_id":"x64-ZLm9Pjh","test":"1"}, | |
# {"name":"macOS 12 NodeJS 16","nodejs_version":"16","os":"macos-12","os_kind":"macos","march_id":"x64-ZLm9Pjh","test":"0"}, | |
# {"name":"macOS 12 NodeJS 14","nodejs_version":"14","os":"macos-12","os_kind":"macos","march_id":"x64-ZLm9Pjh","test":"0"}, | |
# {"name":"macOS 12 NodeJS 12","nodejs_version":"12","os":"macos-12","os_kind":"macos","march_id":"x64-ZLm9Pjh","test":"0"}, | |
# ]}' | |
# MATRIX: '{"config":[{"name":"Linux (GCC 13) NodeJS 18","nodejs_version":"18","os":"ubuntu-22.04","os_kind":"linux","march_id":"x64-ZLm9Pjh","test":"1", "compiler_version":"13", "docker_suffix":"-ubuntu20.04"}, | |
# {"name":"Linux (GCC 13) NodeJS 16","nodejs_version":"16","os":"ubuntu-22.04","os_kind":"linux","march_id":"x64-ZLm9Pjh","test":"1", "compiler_version":"13", "docker_suffix":"-ubuntu20.04"}, | |
# {"name":"macOS 12 NodeJS 18","nodejs_version":"18","os":"macos-12","os_kind":"macos","march_id":"x64-ZLm9Pjh","test":"0"}, | |
# {"name":"macOS 12 NodeJS 16","nodejs_version":"16","os":"macos-12","os_kind":"macos","march_id":"x64-ZLm9Pjh","test":"0"}, | |
# ]}' | |
# MATRIX: '{"config":[{"name":"Linux - GCC 13 - NodeJS 20","nodejs_version":"20","os":"ubuntu-22.04","os_kind":"linux","march_id":"x64-ZLm9Pjh","test":"1", "compiler_version":"13", "docker_suffix":"-ubuntu20.04"}, | |
# {"name":"macOS 14 (x86_64) - NodeJS 20","nodejs_version":"20","os":"macos-14-large","os_kind":"macos","march_id":"x64-ZLm9Pjh","arch":"x86_64","test":"0","macos_version":"14.0"}, | |
# {"name":"macOS 14 (ARM) - NodeJS 20","nodejs_version":"20","os":"macos-14-arm64","os_kind":"macos","march_id":"x64-ZLm9Pjh","arch":"armv8","test":"0","macos_version":"14.0"} | |
# ]}' | |
MATRIX: '{"config":[{"name":"Linux - GCC 14 - NodeJS 20","nodejs_version":"20","os":"ubuntu-22.04","os_kind":"linux","march_id":"x64-ZLm9Pjh","test":"1", "compiler_version":"14", "docker_suffix":"-ubuntu20.04"}, | |
{"name":"macOS 14 (ARM) - NodeJS 20","nodejs_version":"20","os":"macos-14-arm64","os_kind":"macos","march_id":"x64-ZLm9Pjh","arch":"armv8","test":"0","macos_version":"14.0"} | |
]}' | |
run: | | |
echo "${MATRIX}" | |
echo "matrix=${MATRIX}" >> $GITHUB_OUTPUT | |
build-with-container: | |
needs: [generate-matrix] | |
strategy: | |
fail-fast: false | |
matrix: ${{fromJson(needs.generate-matrix.outputs.matrix)}} | |
name: ${{ matrix.config.name }} | |
uses: k-nuth/js-native/.github/workflows/build-with-container.yml@master | |
with: | |
if: ${{ matrix.config.os_kind == 'linux' }} | |
upload: ${{ github.event_name == 'push' }} # && needs.check.outputs.permitted == 'true' | |
os: ${{ matrix.config.os }} | |
image: "kthnode/gcc${{ matrix.config.compiler_version }}${{ matrix.config.docker_suffix }}" | |
# NPM_EMAIL: | |
NODEJS_VERSION: ${{ matrix.config.nodejs_version }} | |
secrets: | |
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} | |
NODE_PRE_GYP_GITHUB_TOKEN: ${{ secrets.NODE_PRE_GYP_GITHUB_TOKEN }} | |
builds: | |
needs: generate-matrix | |
runs-on: ${{ matrix.config.os }} | |
strategy: | |
fail-fast: false | |
matrix: ${{fromJson(needs.generate-matrix.outputs.matrix)}} | |
name: ${{ matrix.config.name }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: "3.12" | |
- name: Settting EnvVars (Linux) | |
if: ${{ matrix.config.os_kind == 'linux' }} | |
shell: bash | |
run: | | |
echo "NODEJS_VERSION=${{ matrix.config.nodejs_version }}" >> $GITHUB_ENV | |
echo "KTH_GHA_MARCH_ID=${{ matrix.config.march_id }}" >> $GITHUB_ENV | |
echo "KTH_GHA_ARCH=${{ matrix.config.arch }}" >> $GITHUB_ENV | |
echo "KTH_GHA_RUN_TESTS=${{ matrix.config.test }}" >> $GITHUB_ENV | |
- name: Settting EnvVars (macOS) | |
if: ${{ matrix.config.os_kind == 'macos' }} | |
shell: bash | |
run: | | |
echo "NODEJS_VERSION=${{ matrix.config.nodejs_version }}" >> $GITHUB_ENV | |
echo "KTH_GHA_MARCH_ID=${{ matrix.config.march_id }}" >> $GITHUB_ENV | |
echo "KTH_GHA_ARCH=${{ matrix.config.arch }}" >> $GITHUB_ENV | |
echo "KTH_GHA_RUN_TESTS=${{ matrix.config.test }}" >> $GITHUB_ENV | |
echo "MACOSX_DEPLOYMENT_TARGET=${{ matrix.config.macos_version }}" >> $GITHUB_ENV | |
- name: Settting EnvVars (Windows) | |
if: ${{ matrix.config.os_kind == 'windows' }} | |
shell: powershell | |
run: | | |
echo "NODEJS_VERSION=${{ matrix.config.nodejs_version }}" >> $Env:GITHUB_ENV | |
echo "KTH_GHA_MARCH_ID=${{ matrix.config.march_id }}" >> $Env:GITHUB_ENV | |
echo "KTH_GHA_ARCH=${{ matrix.config.arch }}" >> $Env:GITHUB_ENV | |
echo "KTH_GHA_RUN_TESTS=${{ matrix.config.test }}" >> $Env:GITHUB_ENV | |
# - name: Build (Linux) | |
# if: ${{ matrix.config.os_kind == 'linux' }} | |
# env: | |
# NODE_PRE_GYP_GITHUB_TOKEN: ${{ secrets.NODE_PRE_GYP_GITHUB_TOKEN }} | |
# NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} | |
# shell: bash | |
# run: | | |
# # echo ${NPM_AUTH_TOKEN} | |
# # echo ${NPM_EMAIL} | |
# # echo ${NODEJS_VERSION} | |
# # echo ${NODE_PRE_GYP_GITHUB_TOKEN} | |
# echo "-------------------------------------------------------" | |
# whoami | |
# echo "-------------------------------------------------------" | |
# chmod a+x .cicd/entrypoint.sh | |
# chmod -R 777 ${PWD} | |
# /usr/bin/docker run --rm -e KTH_GHA_MARCH_ID=$KTH_GHA_MARCH_ID -e NPM_AUTH_TOKEN=$NPM_AUTH_TOKEN -e NPM_EMAIL=$NPM_EMAIL -e NODEJS_VERSION=$NODEJS_VERSION -e NODE_PRE_GYP_GITHUB_TOKEN=$NODE_PRE_GYP_GITHUB_TOKEN -v ${PWD}:/home/conan/project -v ${PWD}/.cicd/entrypoint.sh:/tmp/entrypoint.sh conanio/gcc11-ubuntu16.04 /bin/bash -c /tmp/entrypoint.sh | |
- uses: actions/setup-node@v2 | |
if: ${{ matrix.config.os_kind != 'linux' }} | |
with: | |
node-version: '${{ matrix.config.nodejs_version }}' | |
- name: Install (macOS) | |
if: ${{ matrix.config.os_kind == 'macos' }} | |
env: | |
NODE_PRE_GYP_GITHUB_TOKEN: ${{ secrets.NODE_PRE_GYP_GITHUB_TOKEN }} | |
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} | |
# MACOSX_DEPLOYMENT_TARGET: "14.0" # TODO: move it to the matrix data | |
shell: bash | |
run: | | |
set -x | |
echo "MACOSX_DEPLOYMENT_TARGET: $MACOSX_DEPLOYMENT_TARGET" | |
node --version | |
npm --version | |
brew update &>/dev/null | |
brew outdated pyenv || brew upgrade pyenv &>/dev/null | |
brew install pyenv-virtualenv &>/dev/null | |
# brew install cmake || true | |
if which pyenv > /dev/null; then | |
eval "$(pyenv init -)" | |
eval "$(pyenv virtualenv-init -)" | |
fi | |
# pyenv install --list | |
# pyenv install 3.8.7 | |
# pyenv virtualenv 3.8.7 conan | |
pyenv install 3.12.3 | |
pyenv virtualenv 3.12.3 conan | |
pyenv rehash | |
pyenv activate conan | |
npm install -g node-gyp | |
npm install -g @mapbox/node-pre-gyp | |
# npm install -g aws-sdk | |
# npm install -g node-pre-gyp-github | |
npm install -g @mmomtchev/node-pre-gyp-github | |
# pip install conan_package_tools --upgrade | |
# pip install conan --upgrade | |
pip install kthbuild --upgrade | |
python3 -m pip install "conan>=2.0" --upgrade --ignore-installed | |
conan --version | |
# conan profile detect | |
conan config install -t dir ./.conan | |
# conan user | |
- name: Build (macOS) | |
if: ${{ matrix.config.os_kind == 'macos' }} | |
env: | |
NODE_PRE_GYP_GITHUB_TOKEN: ${{ secrets.NODE_PRE_GYP_GITHUB_TOKEN }} | |
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} | |
shell: bash | |
run: | | |
echo "MACOSX_DEPLOYMENT_TARGET: $MACOSX_DEPLOYMENT_TARGET" | |
if which pyenv > /dev/null; then | |
eval "$(pyenv init -)" | |
eval "$(pyenv virtualenv-init -)" | |
fi | |
pyenv activate conan | |
python --version | |
# conan user | |
# echo "-----------------------------------------------------------" | |
# conan config get | |
# echo "-----------------------------------------------------------" | |
# conan config set general.revisions_enabled=1 | |
# echo "-----------------------------------------------------------" | |
# conan config get | |
# echo "-----------------------------------------------------------" | |
# conan remote add kth_temp https://packages.kth.cash/api || true | |
conan profile detect | |
conan install . --build=missing -s compiler.cppstd=20 | |
# -o c-api/*:march_id=ZLm9Pjh | |
echo "*** KTH_GHA_ARCH: ${KTH_GHA_ARCH}" | |
# export KTH_ARCH=${KTH_GHA_ARCH} | |
# echo "*** KTH_ARCH: ${KTH_ARCH}" | |
export KTH_TMP=${KTH_GHA_ARCH} | |
echo "*** KTH_TMP: ${KTH_TMP}" | |
# npm install --loglevel verbose | |
npm install --loglevel verbose | |
if [[ "${KTH_GHA_RUN_TESTS}" == "1" ]]; then | |
npm run test | |
# /Users/runner/work/_temp/1cbd6dec-60ec-4181-81bd-cceaf2210ae3.sh: line 13: 37183 Illegal instruction: 4 npm run test | |
fi | |
# node-pre-gyp configure build package --verbose --target_arch=${KTH_GHA_MARCH_ID} | |
node-pre-gyp configure build package --verbose | |
node-pre-gyp-github publish --release || true | |
# node-pre-gyp clean | |
# node-gyp clean | |
# npm install | |
# npm publish || true | |
- name: Install (Windows) | |
if: ${{ matrix.config.os_kind == 'windows' }} | |
shell: powershell | |
run: | | |
# Write-Host "CONAN_VISUAL_VERSIONS: $Env:CONAN_VISUAL_VERSIONS" | |
$ErrorActionPreference = 'SilentlyContinue' | |
npm --version | |
npm -g install npm@next | |
npm --version | |
npm install -g [email protected] | |
npm install -g @mapbox/node-pre-gyp | |
npm install -g aws-sdk | |
# npm install -g node-pre-gyp-github | |
npm install -g @mmomtchev/node-pre-gyp-github | |
pip --version | |
pip install kthbuild --upgrade | |
python --version | |
# conan user # It creates the conan data directory | |
node --version | |
npm --version | |
python --version | |
# cl /version | |
Write-Host "----------------------------" | |
node -p "process.arch" | |
Write-Host "----------------------------" | |
# conan user | |
conan remote add kth_temp https://packages.kth.cash/api | |
# conan install . -s compiler.runtime=MT | |
# conan user | |
$ErrorActionPreference = 'Continue' | |
- name: Build (Windows) | |
if: ${{ matrix.config.os_kind == 'windows' }} | |
env: | |
NODE_PRE_GYP_GITHUB_TOKEN: ${{ secrets.NODE_PRE_GYP_GITHUB_TOKEN }} | |
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} | |
shell: powershell | |
run: | | |
$ErrorActionPreference = 'SilentlyContinue' | |
# npm install | |
# npm install --loglevel verbose | |
# npm install --target_arch=${KTH_GHA_MARCH_ID} --loglevel verbose | |
Write-Host "****************************************************" | |
Write-Host "BEFORE npm install" | |
Write-Host "****************************************************" | |
npm install --loglevel verbose | |
Write-Host "****************************************************" | |
Write-Host "AFTER npm install" | |
Write-Host "****************************************************" | |
Write-Host "****************************************************" | |
Write-Host "BEFORE npm run test" | |
Write-Host "****************************************************" | |
npm run test | |
Write-Host "****************************************************" | |
Write-Host "AFTER npm run test" | |
Write-Host "****************************************************" | |
Remove-Item './deps' -Recurse | |
Write-Host "****************************************************" | |
Write-Host "BEFORE node-pre-gyp configure build package" | |
Write-Host "****************************************************" | |
# node-pre-gyp configure build package --target_arch=${KTH_GHA_MARCH_ID} | |
node-pre-gyp configure build package | |
# node-pre-gyp configure --verbose | |
# node-pre-gyp build --verbose | |
# node-pre-gyp package --verbose | |
Write-Host "****************************************************" | |
Write-Host "AFTER node-pre-gyp configure build package" | |
Write-Host "****************************************************" | |
$ErrorActionPreference = 'SilentlyContinue' | |
node-pre-gyp-github publish --release | |
$ErrorActionPreference = 'Continue' | |
# $ErrorActionPreference = 'SilentlyContinue' | |
# conan remove "*" -f | |
# conan remote remove kth | |
# conan remote remove kthbuild_kth_temp_ | |
# $ErrorActionPreference = 'Continue' | |
# References: | |
# https://github.com/radareorg/radare2 |