Merge pull request #30 from llemaitre19/bugfix/29 #94
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
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node | |
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions | |
name: Auto-release | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- grammar.js | |
- src/**/* | |
- corpus/**/* | |
jobs: | |
build-release-linux: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- name: Get Node.js ${{ matrix.node-version }} | |
uses: actions/checkout@v3 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: 'npm' | |
- name: Build and test | |
run: | | |
npm ci | |
npm run build --if-present | |
npm run test | |
mv /home/runner/.cache/tree-sitter/lib/css_in_js.so /home/runner/.cache/tree-sitter/lib/libtree-sitter-css-in-js.so | |
- name: Create tar file | |
uses: TheDoctor0/[email protected] | |
with: | |
type: tar | |
directory: /home/runner/.cache/tree-sitter/lib | |
path: libtree-sitter-css-in-js.so | |
filename: linux.tar.gz | |
- name: Upload tarball | |
uses: actions/upload-artifact@v3 | |
with: | |
name: linux-latest | |
path: /home/runner/.cache/tree-sitter/lib/linux.tar.gz | |
if-no-files-found: error | |
retention-days: 1 | |
build-release-windows: | |
runs-on: windows-latest | |
permissions: | |
contents: write | |
steps: | |
- name: Get Node.js ${{ matrix.node-version }} | |
uses: actions/checkout@v3 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: 'npm' | |
- name: Build and test | |
run: | | |
npm ci | |
npm run build --if-present | |
npm run test | |
copy C:\Users\runneradmin\AppData\Local\tree-sitter\lib\css_in_js.dll C:\Users\runneradmin\AppData\Local\tree-sitter\lib\libtree-sitter-css-in-js.dll | |
- name: Create tar file | |
uses: TheDoctor0/[email protected] | |
with: | |
type: tar | |
directory: C:\Users\runneradmin\AppData\Local\tree-sitter\lib | |
path: libtree-sitter-css-in-js.dll | |
filename: windows.tar.gz | |
- name: Upload tarball | |
uses: actions/upload-artifact@v3 | |
with: | |
name: windows-latest | |
path: C:\Users\runneradmin\AppData\Local\tree-sitter\lib\windows.tar.gz | |
if-no-files-found: error | |
retention-days: 1 | |
build-release-macos: | |
runs-on: macos-latest | |
permissions: | |
contents: write | |
steps: | |
- name: Get Node.js ${{ matrix.node-version }} | |
uses: actions/checkout@v3 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: 'npm' | |
- name: Build and test | |
run: | | |
npm ci | |
npm run build --if-present | |
npm run test | |
mv /Users/runner/Library/Caches/tree-sitter/lib/css_in_js.so /Users/runner/Library/Caches/tree-sitter/lib/libtree-sitter-css-in-js.so | |
# arm64 | |
gcc -fPIC -c -I./src src/parser.c src/scanner.c -target arm64-apple-macos11 | |
cc -fPIC -shared parser.o scanner.o -o "libtree-sitter-css-in-js.dylib" -target arm64-apple-macos11 | |
mv libtree-sitter-css-in-js.dylib /Users/runner/Library/Caches/tree-sitter/lib | |
- name: Create tar file | |
uses: TheDoctor0/[email protected] | |
with: | |
type: tar | |
directory: /Users/runner/Library/Caches/tree-sitter/lib | |
path: libtree-sitter-css-in-js.* | |
filename: macos.tar.gz | |
- name: Upload tarball | |
uses: actions/upload-artifact@v3 | |
with: | |
name: macos-latest | |
path: /Users/runner/Library/Caches/tree-sitter/lib/macos.tar.gz | |
if-no-files-found: error | |
retention-days: 1 | |
generate-release: | |
runs-on: ubuntu-latest | |
needs: [ build-release-macos, build-release-windows, build-release-linux ] | |
#needs: [ build-release-linux ] | |
permissions: | |
contents: write | |
steps: | |
- name: Collect tarballs | |
uses: actions/download-artifact@v3 | |
with: | |
path: ./artifacts | |
- name: Publish release | |
uses: "marvinpinto/action-automatic-releases@latest" | |
with: | |
repo_token: "${{ secrets.GITHUB_TOKEN }}" | |
automatic_release_tag: "latest" | |
prerelease: false | |
title: "Grammar binaries bundle" | |
files: | | |
artifacts/linux-latest/linux.tar.gz | |
artifacts/windows-latest/windows.tar.gz | |
artifacts/macos-latest/macos.tar.gz |