Skip to content

Commit

Permalink
Add release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
hans00 committed Apr 24, 2024
1 parent b8f8f4d commit e05e279
Show file tree
Hide file tree
Showing 4 changed files with 244 additions and 2 deletions.
77 changes: 77 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: Release
on:
release:
types: [created]
workflow_dispatch:

jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- uses: actions/checkout@v4
with:
submodules: 'true'
- uses: actions/[email protected]
with:
node-version: 20
cache: 'yarn'
- name: node_modules cache
uses: actions/[email protected]
with:
path: node_modules
key: ${{ runner.os }}-node_modules-${{ hashFiles('**/yarn.lock') }}
- run: yarn install
- name: Build CPU (x86_64)
run: yarn clean && yarn build-native
- name: Build CPU (arm64)
run: yarn clean && yarn build-native -A arm64
- name: Prepare Vulkan SDK
if: runner.os == 'ubuntu-latest'
uses: humbletim/[email protected]
with:
vulkan-query-version: 1.3.204.0
vulkan-components: Vulkan-Headers, Vulkan-Loader
vulkan-use-cache: true
- name: Build with Vulkan
if: runner.os == 'ubuntu-latest'
run: yarn clean && yarn build-native --CDVARIANT=vulkan --CDLLAMA_VULKAN=1
- name: Build with OpenCL
if: runner.os == 'windows-latest'
run: yarn clean && yarn build-native --CDVARIANT=opencl --CDLLAMA_OPENCL=1
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: bin
path: bin
retention-days: 3
publish:
needs: build
runs-on: ubuntu-latest
if: github.event_name == 'release'
steps:
- uses: actions/checkout@v4
with:
submodules: 'true'
- uses: actions/[email protected]
with:
node-version: 20
cache: 'yarn'
- name: node_modules cache
uses: actions/[email protected]
with:
path: node_modules
key: ${{ runner.os }}-node_modules-${{ hashFiles('**/yarn.lock') }}
- name: Download bundled files
uses: actions/download-artifact@v4
with:
name: bin
path: bin
- run: yarn install
- run: yarn build
- name: Publish to NPM
run: yarn publish --access public
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release")
endif()

message(STATUS "Build type: ${CMAKE_BUILD_TYPE}")
message(STATUS "To Platform: ${CMAKE_SYSTEM_NAME}")
message(STATUS "To Architecture: ${CMAKE_SYSTEM_PROCESSOR}")

include_directories(${CMAKE_JS_INC})

# flags: -fPIC
Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"test": "jest",
"build": "tsc",
"prepack": "yarn build",
"build-native": "cmake-js compile"
"build-native": "cmake-js compile",
"clean": "rimraf build"
},
"repository": {
"type": "git",
Expand Down Expand Up @@ -46,6 +47,7 @@
"@types/node": "^20.12.7",
"cmake-js": "^7.3.0",
"jest": "^29.7.0",
"rimraf": "^5.0.5",
"typescript": "^5.4.5"
},
"dependencies": {
Expand Down
Loading

0 comments on commit e05e279

Please sign in to comment.