Install deps in CI #5
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
name: build | |
on: push | |
jobs: | |
build: | |
runs-on: >- | |
${{ | |
(matrix.os == 'mac' && matrix.arch == 'arm64') && | |
'macos-14' || | |
(fromJson('{"linux":"ubuntu-22.04","mac":"macos-13","win":"windows-2022"}')[matrix.os]) | |
}} | |
continue-on-error: false | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [linux, mac] | |
arch: [x64] | |
include: | |
- os: mac | |
arch: arm64 | |
steps: | |
- name: Install linux dependencies | |
if: matrix.os == 'linux' && matrix.arch == runner.arch | |
run: sudo apt-get install -y libblas-dev liblapack-dev liblapacke-dev | |
- name: Install mac dependencies | |
if: matrix.os == 'mac' && matrix.arch == 'x64' | |
run: brew install openblas | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Download models | |
run: | | |
npm install -g @frost-beta/huggingface | |
huggingface download --filter=*.json --filter=*.safetensors openai/clip-vit-large-patch14 | |
- name: Test | |
run: | | |
yarn | |
yarn prepack | |
yarn tsx test.ts clip-vit-large-patch14 | |
publish: | |
if: startsWith(github.ref, 'refs/tags/') | |
needs: [build] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Get tag | |
run: echo "VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV | |
- name: Set package version | |
run: | | |
npm config set git-tag-version=false | |
npm version $VERSION | |
- name: Install deps | |
run: yarn | |
- name: Publish npm package | |
uses: JS-DevTools/npm-publish@v3 | |
with: | |
token: ${{ secrets.NPM_TOKEN }} | |
access: public | |
ignore-scripts: false |