cicd: new workflow
This commit is contained in:
parent
1b1c3974f7
commit
cc4f932d17
14 changed files with 611 additions and 228 deletions
10
.github/scripts/cross.sh
vendored
Executable file
10
.github/scripts/cross.sh
vendored
Executable file
|
|
@ -0,0 +1,10 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -x
|
||||
set -e
|
||||
|
||||
if [ "$CROSS" != 1 ]; then
|
||||
exit 111
|
||||
fi
|
||||
|
||||
docker run --rm -v /home/runner:/home/runner -w "$PWD" "$CROSS_IMAGE" "$@"
|
||||
19
.github/scripts/make.sh
vendored
Executable file
19
.github/scripts/make.sh
vendored
Executable file
|
|
@ -0,0 +1,19 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -x
|
||||
set -e
|
||||
|
||||
if [ "$CROSS" = 1 ]; then
|
||||
if [ -z "$CC" ]; then
|
||||
echo "make.sh: CC is not set" >&2
|
||||
exit 111
|
||||
fi
|
||||
if [ -z "$AR" ]; then
|
||||
echo "make.sh: AR is not set" >&2
|
||||
exit 111
|
||||
fi
|
||||
|
||||
cross.sh make CC=$CC AR=$AR "$@"
|
||||
else
|
||||
make "$@"
|
||||
fi
|
||||
12
.github/scripts/tree-sitter.sh
vendored
Executable file
12
.github/scripts/tree-sitter.sh
vendored
Executable file
|
|
@ -0,0 +1,12 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -x
|
||||
set -e
|
||||
|
||||
tree_sitter="$ROOT"/target/"$TARGET"/release/tree-sitter
|
||||
|
||||
if [ "$CROSS" = 1 ]; then
|
||||
cross.sh $CROSS_RUNNER "$tree_sitter" "$@"
|
||||
else
|
||||
"$tree_sitter" "$@"
|
||||
fi
|
||||
69
.github/workflows/CICD.yml
vendored
Normal file
69
.github/workflows/CICD.yml
vendored
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
name: CICD
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
pull_request:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- check/*
|
||||
|
||||
concurrency:
|
||||
group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}'
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
init:
|
||||
name: Init
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Get PR head ref
|
||||
if: ${{ github.event_name == 'pull_request' }}
|
||||
id: ref
|
||||
run: |
|
||||
echo "ref=refs/pull/${{ github.event.pull_request.number }}/head" >> $GITHUB_OUTPUT
|
||||
outputs:
|
||||
ref: >-
|
||||
${{
|
||||
(github.event_name == 'pull_request' && startsWith(github.head_ref, 'release/v'))
|
||||
&& steps.ref.outputs.ref
|
||||
|| github.ref
|
||||
}}
|
||||
|
||||
fast_checks:
|
||||
name: Fast checks
|
||||
uses: ./.github/workflows/fast_checks.yml
|
||||
|
||||
full_checks:
|
||||
name: Full Rust checks
|
||||
needs: fast_checks
|
||||
uses: ./.github/workflows/full_rust_checks.yml
|
||||
|
||||
min_version:
|
||||
name: Minimum supported rust version
|
||||
needs: fast_checks
|
||||
uses: ./.github/workflows/msrv.yml
|
||||
with:
|
||||
package: tree-sitter-cli
|
||||
|
||||
build:
|
||||
name: Build & Test
|
||||
needs: [init, fast_checks]
|
||||
uses: ./.github/workflows/build.yml
|
||||
with:
|
||||
ref: ${{ needs.init.outputs.ref }}
|
||||
|
||||
release:
|
||||
name: Release
|
||||
needs: [init, fast_checks, full_checks, min_version, build]
|
||||
if: >
|
||||
github.event.pull_request.head.repo.full_name == github.repository &&
|
||||
startsWith(github.head_ref, 'release/v')
|
||||
uses: ./.github/workflows/release.yml
|
||||
with:
|
||||
ref: ${{ needs.init.outputs.ref }}
|
||||
|
||||
publish:
|
||||
name: Publish
|
||||
needs: release
|
||||
uses: ./.github/workflows/publish.yml
|
||||
171
.github/workflows/build.yml
vendored
Normal file
171
.github/workflows/build.yml
vendored
Normal file
|
|
@ -0,0 +1,171 @@
|
|||
name: Build & Test
|
||||
|
||||
env:
|
||||
CARGO_TERM_COLOR: always
|
||||
RUSTFLAGS: "-D warnings"
|
||||
CROSS_DEBUG: 1
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
ref:
|
||||
default: ${{ github.ref }}
|
||||
type: string
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: ${{ matrix.job.name }} (${{ matrix.job.target }}) (${{ matrix.job.os }})
|
||||
runs-on: ${{ matrix.job.os }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
job:
|
||||
- { name: linux-aarch64 , target: aarch64-unknown-linux-gnu , os: ubuntu-latest , use-cross: true }
|
||||
- { name: linux-arm , target: arm-unknown-linux-gnueabihf , os: ubuntu-latest , use-cross: true }
|
||||
- { name: linux-x64 , target: x86_64-unknown-linux-gnu , os: ubuntu-latest }
|
||||
- { name: linux-x86 , target: i686-unknown-linux-gnu , os: ubuntu-latest , use-cross: true }
|
||||
- { name: windows-x64 , target: x86_64-pc-windows-msvc , os: windows-latest }
|
||||
- { name: windows-x86 , target: i686-pc-windows-msvc , os: windows-latest }
|
||||
- { name: macos-x64 , target: x86_64-apple-darwin , os: macos-latest }
|
||||
|
||||
env:
|
||||
BUILD_CMD: cargo
|
||||
|
||||
defaults:
|
||||
run:
|
||||
shell: bash
|
||||
|
||||
steps:
|
||||
- name: Checkout source code
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
ref: ${{ inputs.ref }}
|
||||
|
||||
- name: Read Emscripten version
|
||||
run: |
|
||||
echo "EMSCRIPTEN_VERSION=$(cat cli/emscripten-version)" >> $GITHUB_ENV
|
||||
|
||||
- name: Install Emscripten
|
||||
uses: mymindstorm/setup-emsdk@v12
|
||||
with:
|
||||
version: ${{ env.EMSCRIPTEN_VERSION }}
|
||||
|
||||
- name: Install Rust toolchain
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
with:
|
||||
targets: ${{ matrix.job.target }}
|
||||
|
||||
- name: Install cross
|
||||
if: matrix.job.use-cross
|
||||
uses: taiki-e/install-action@v2
|
||||
with:
|
||||
tool: cross
|
||||
|
||||
- name: Build custom cross image
|
||||
if: ${{ matrix.job.use-cross && matrix.job.os == 'ubuntu-latest' }}
|
||||
run: |
|
||||
cd ..
|
||||
|
||||
target="${{ matrix.job.target }}"
|
||||
image=ghcr.io/cross-rs/$target:custom
|
||||
echo "CROSS_IMAGE=$image" >> $GITHUB_ENV
|
||||
|
||||
echo "[target.$target]" >> Cross.toml
|
||||
echo "image = \"$image\"" >> Cross.toml
|
||||
echo "CROSS_CONFIG=$PWD/Cross.toml" >> $GITHUB_ENV
|
||||
|
||||
echo "FROM ghcr.io/cross-rs/$target:edge" >> Dockerfile
|
||||
echo "ENV DEBIAN_FRONTEND=noninteractive" >> Dockerfile
|
||||
echo "RUN apt-get update && apt-get install -y nodejs" >> Dockerfile
|
||||
docker build -t $image .
|
||||
docker images
|
||||
docker run --rm $image env
|
||||
|
||||
cd -
|
||||
|
||||
- name: Setup extra env
|
||||
run: |
|
||||
PATH="$PWD/.github/scripts:$PATH"
|
||||
echo "PATH=$PATH" >> $GITHUB_ENV
|
||||
echo "ROOT=$PWD" >> $GITHUB_ENV
|
||||
echo "TREE_SITTER=tree-sitter.sh" >> $GITHUB_ENV
|
||||
|
||||
export TARGET=${{ matrix.job.target }}
|
||||
echo "TARGET=$TARGET" >> $GITHUB_ENV
|
||||
|
||||
USE_CROSS="${{ matrix.job.use-cross }}"
|
||||
|
||||
if [ "$USE_CROSS" == "true" ]; then
|
||||
echo "BUILD_CMD=cross" >> $GITHUB_ENV
|
||||
|
||||
export CROSS=1; echo "CROSS=$CROSS" >> $GITHUB_ENV
|
||||
|
||||
runner=$(cross.sh bash -c "env | sed -nr '/^CARGO_TARGET_.*_RUNNER=/s///p'")
|
||||
[ -n "$runner" ] && echo "CROSS_RUNNER=$runner" >> $GITHUB_ENV
|
||||
echo "runner: $runner"
|
||||
|
||||
case "$TARGET" in
|
||||
i686-unknown-linux-gnu) CC=i686-linux-gnu-gcc AR=i686-linux-gnu-ar ;;
|
||||
aarch64-unknown-linux-gnu) CC=aarch64-linux-gnu-gcc AR=aarch64-linux-gnu-ar ;;
|
||||
arm-unknown-linux-gnueabihf) CC=arm-unknown-linux-gnueabihf-gcc AR=arm-unknown-linux-gnueabihf-gcc-ar ;;
|
||||
esac
|
||||
|
||||
[ -n "$CC" ] && echo "CC=$CC" >> $GITHUB_ENV
|
||||
[ -n "$AR" ] && echo "AR=$AR" >> $GITHUB_ENV
|
||||
fi
|
||||
|
||||
case "$TARGET" in
|
||||
*-windows-*)
|
||||
echo "RUST_TEST_THREADS=1" >> $GITHUB_ENV # See #2041 tree-sitter issue
|
||||
;;
|
||||
esac
|
||||
|
||||
- name: Build C library
|
||||
if: "!contains(matrix.job.os, 'windows')" # Requires an additional adapted Makefile for `cl.exe` compiler
|
||||
run: make.sh CFLAGS="-Werror" -j
|
||||
|
||||
- name: Build wasm library
|
||||
run: script/build-wasm
|
||||
|
||||
- name: Build CLI
|
||||
run: $BUILD_CMD build --release --target=${{ matrix.job.target }}
|
||||
|
||||
- name: Fetch fixtures
|
||||
run: script/fetch-fixtures
|
||||
|
||||
- name: Generate fixtures
|
||||
run: script/generate-fixtures
|
||||
|
||||
- name: Generate WASM fixtures
|
||||
if: "!matrix.job.use-cross"
|
||||
run: script/generate-fixtures-wasm
|
||||
|
||||
- name: Run main tests
|
||||
run: $BUILD_CMD test --target=${{ matrix.job.target }}
|
||||
|
||||
- name: Run wasm tests
|
||||
if: "!matrix.job.use-cross" # TODO: Install Emscripten into custom cross images
|
||||
run: script/test-wasm
|
||||
|
||||
- name: Run benchmarks
|
||||
if: "!matrix.job.use-cross" # It doesn't make sense to benchmark something in an emulator
|
||||
run: $BUILD_CMD bench benchmark -p tree-sitter-cli --target=${{ matrix.job.target }}
|
||||
|
||||
- name: Upload CLI artifact
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: tree-sitter.${{ matrix.job.name }}
|
||||
path: target/${{ matrix.job.target }}/release/tree-sitter${{ contains(matrix.job.target, 'windows') && '.exe' || '' }}
|
||||
if-no-files-found: error
|
||||
retention-days: 7
|
||||
|
||||
- name: Upload WASM artifacts
|
||||
if: ${{ matrix.job.name == 'linux-x64' }}
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: tree-sitter.wasm
|
||||
path: |
|
||||
lib/binding_web/tree-sitter.js
|
||||
lib/binding_web/tree-sitter.wasm
|
||||
if-no-files-found: error
|
||||
retention-days: 7
|
||||
150
.github/workflows/ci.yml
vendored
150
.github/workflows/ci.yml
vendored
|
|
@ -1,150 +0,0 @@
|
|||
name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
tags:
|
||||
- v*
|
||||
pull_request:
|
||||
branches:
|
||||
- "**"
|
||||
|
||||
env:
|
||||
CARGO_TERM_COLOR: always
|
||||
CARGO_INCREMENTAL: 0
|
||||
|
||||
jobs:
|
||||
unix-tests:
|
||||
name: Unix tests
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
fail-fast: true
|
||||
matrix:
|
||||
os:
|
||||
- macos-latest
|
||||
- ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repo
|
||||
uses: actions/checkout@v3
|
||||
|
||||
# Work around https://github.com/actions/cache/issues/403.
|
||||
- name: Use GNU tar
|
||||
if: matrix.os == 'macos-latest'
|
||||
run: |
|
||||
echo PATH="/usr/local/opt/gnu-tar/libexec/gnubin:$PATH" >> $GITHUB_ENV
|
||||
|
||||
- name: Read Emscripten version
|
||||
run: |
|
||||
printf 'EMSCRIPTEN_VERSION=%s\n' "$(cat cli/emscripten-version)" >> $GITHUB_ENV
|
||||
|
||||
- name: Cache artifacts
|
||||
id: cache
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: |
|
||||
~/.cargo/registry
|
||||
~/.cargo/git
|
||||
target
|
||||
key: ${{ runner.os }}-cargo-${{ hashFiles('Cargo.lock') }}-emscripten-${{ env.EMSCRIPTEN_VERSION }}
|
||||
|
||||
- name: Install rust
|
||||
if: steps.cache.outputs.cache-hit != 'true'
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
toolchain: stable
|
||||
profile: minimal
|
||||
components: rustfmt, clippy
|
||||
|
||||
- name: Check Rust code formatting
|
||||
run: cargo fmt -- --check
|
||||
|
||||
- name: Install emscripten
|
||||
uses: mymindstorm/setup-emsdk@v12
|
||||
with:
|
||||
version: ${{ env.EMSCRIPTEN_VERSION }}
|
||||
|
||||
- name: Build C library
|
||||
run: make
|
||||
|
||||
- name: Build wasm library
|
||||
run: script/build-wasm
|
||||
|
||||
- name: Build CLI
|
||||
run: |
|
||||
RUSTFLAGS="-D warnings"
|
||||
cargo build --release
|
||||
|
||||
- name: Set up fixture parsers
|
||||
run: |
|
||||
script/fetch-fixtures
|
||||
script/generate-fixtures
|
||||
script/generate-fixtures-wasm
|
||||
|
||||
- name: Run main tests
|
||||
run: cargo test
|
||||
|
||||
- name: Run wasm tests
|
||||
run: script/test-wasm
|
||||
|
||||
- name: Run benchmarks
|
||||
run: script/benchmark
|
||||
|
||||
- name: Compress CLI binary
|
||||
if: startsWith(github.ref, 'refs/tags/v')
|
||||
run: |
|
||||
cp target/release/tree-sitter .
|
||||
export platform=$(echo ${{ runner.os }} | awk '{print tolower($0)}')
|
||||
gzip --suffix "-${platform}-x64.gz" tree-sitter
|
||||
|
||||
- name: Release
|
||||
uses: softprops/action-gh-release@v1
|
||||
if: startsWith(github.ref, 'refs/tags/v')
|
||||
with:
|
||||
draft: true
|
||||
files: |
|
||||
tree-sitter-*.gz
|
||||
lib/binding_web/tree-sitter.js
|
||||
lib/binding_web/tree-sitter.wasm
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
windows-tests:
|
||||
name: Windows tests
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
- name: Checkout repo
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Cache artifacts
|
||||
id: cache
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: |
|
||||
~/.cargo/registry
|
||||
~/.cargo/git
|
||||
target
|
||||
key: ${{ runner.os }}-cargo-${{ hashFiles('Cargo.lock') }}
|
||||
|
||||
- name: Install rust
|
||||
if: steps.cache.outputs.cache-hit != 'true'
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
toolchain: stable
|
||||
profile: minimal
|
||||
|
||||
- name: Check Rust code formatting
|
||||
run: cargo fmt -- --check
|
||||
|
||||
- name: Build CLI
|
||||
run: |
|
||||
$env:RUSTFLAGS="-D warnings"
|
||||
cargo build --release
|
||||
|
||||
- name: Set up fixture parsers
|
||||
run: |
|
||||
script/fetch-fixtures.cmd
|
||||
script/generate-fixtures.cmd
|
||||
|
||||
- name: Run main tests
|
||||
run: script/test
|
||||
31
.github/workflows/fast_checks.yml
vendored
Normal file
31
.github/workflows/fast_checks.yml
vendored
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
name: Fast checks to fail fast on any simple code issues
|
||||
|
||||
env:
|
||||
CARGO_TERM_COLOR: always
|
||||
RUSTFLAGS: "-D warnings"
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
|
||||
jobs:
|
||||
check_rust_formatting:
|
||||
name: Check Rust formating
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
|
||||
- name: Checkout source code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Run cargo fmt
|
||||
run: cargo fmt -- --check
|
||||
|
||||
check_c_warnings:
|
||||
name: Check C warnings
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
|
||||
- name: Checkout source code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Make C library to check that it's able to compile without warnings
|
||||
run: make -j CFLAGS="-Werror"
|
||||
32
.github/workflows/full_rust_checks.yml
vendored
Normal file
32
.github/workflows/full_rust_checks.yml
vendored
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
name: Full Rust codebase checks
|
||||
|
||||
env:
|
||||
CARGO_TERM_COLOR: always
|
||||
RUSTFLAGS: "-D warnings"
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
|
||||
jobs:
|
||||
run:
|
||||
name: Run checks
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
|
||||
- name: Checkout source code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Install rust toolchain
|
||||
uses: dtolnay/rust-toolchain@master
|
||||
with:
|
||||
toolchain: stable
|
||||
components: clippy, rustfmt
|
||||
|
||||
- name: Run cargo fmt
|
||||
run: cargo fmt -- --check
|
||||
|
||||
# - name: Run clippy
|
||||
# run: cargo clippy --all-targets
|
||||
|
||||
- name: Run cargo check
|
||||
run: cargo check --workspace --examples --tests --benches --bins
|
||||
42
.github/workflows/msrv.yml
vendored
Normal file
42
.github/workflows/msrv.yml
vendored
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
name: Minimum supported rust version
|
||||
|
||||
env:
|
||||
CARGO_TERM_COLOR: always
|
||||
RUSTFLAGS: "-D warnings"
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
package:
|
||||
description: Target cargo package name
|
||||
required: true
|
||||
type: string
|
||||
|
||||
|
||||
jobs:
|
||||
run:
|
||||
name: Run checks
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
|
||||
- name: Checkout source code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Get the MSRV from the package metadata
|
||||
id: msrv
|
||||
run: cargo metadata --no-deps --format-version 1 | jq -r '"version=" + (.packages[] | select(.name == "${{ inputs.package }}").rust_version)' >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Install rust toolchain (v${{ steps.msrv.outputs.version }})
|
||||
uses: dtolnay/rust-toolchain@master
|
||||
with:
|
||||
toolchain: ${{ steps.msrv.outputs.version }}
|
||||
components: clippy, rustfmt
|
||||
|
||||
- name: Run cargo fmt
|
||||
run: cargo fmt -- --check
|
||||
|
||||
# - name: Run clippy (on minimum supported rust version to prevent warnings we can't fix)
|
||||
# run: cargo clippy --all-targets
|
||||
|
||||
# - name: Run main tests
|
||||
# run: cargo test
|
||||
21
.github/workflows/publish.yml
vendored
Normal file
21
.github/workflows/publish.yml
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
name: Publish to registries
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
|
||||
jobs:
|
||||
crates_io:
|
||||
name: Publish to Crates.io
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Publish packages
|
||||
run: |
|
||||
echo "::warning::TODO: add a Crates.io publish logic"
|
||||
|
||||
npm:
|
||||
name: Publish to npmjs.com
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Publish packages
|
||||
run: |
|
||||
echo "::warning::TODO: add a npmjs.com publish logic"
|
||||
101
.github/workflows/release.yml
vendored
Normal file
101
.github/workflows/release.yml
vendored
Normal file
|
|
@ -0,0 +1,101 @@
|
|||
name: Release
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
ref:
|
||||
default: ${{ github.ref }}
|
||||
type: string
|
||||
|
||||
jobs:
|
||||
permissions:
|
||||
name: Check permissions
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
release_allowed: ${{ steps.maintainer.outputs.is_maintainer == 'true' }}
|
||||
steps:
|
||||
|
||||
- name: Is maintainer
|
||||
id: maintainer
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
repo: ${{ github.repository }}
|
||||
actor: ${{ github.actor }}
|
||||
run: |
|
||||
maintainer=$(
|
||||
gh api "/repos/${repo}/collaborators" |
|
||||
jq ".[] | {login, maintainer: .permissions | .maintain} | select(.login == \"${actor}\") | .maintainer"
|
||||
);
|
||||
if [ "$maintainer" == "true" ]; then
|
||||
echo "@${actor} has maintainer level permissions :rocket:" >> $GITHUB_STEP_SUMMARY;
|
||||
echo "is_maintainer=true" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
|
||||
release:
|
||||
name: Release
|
||||
needs: permissions
|
||||
if: needs.permissions.outputs.release_allowed
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write
|
||||
steps:
|
||||
|
||||
- name: Checkout source code
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
ref: ${{ inputs.ref }}
|
||||
|
||||
- name: Download build artifacts
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
path: artifacts
|
||||
|
||||
- name: Display structure of downloaded files
|
||||
run: ls -lR
|
||||
working-directory: artifacts
|
||||
|
||||
- name: Prepare release artifacts
|
||||
run: |
|
||||
mkdir -p target
|
||||
mv artifacts/tree-sitter.wasm/* target/
|
||||
rm -r artifacts/tree-sitter.wasm
|
||||
for platform in $(cd artifacts; ls); do
|
||||
exe=$(ls artifacts/$platform/tree-sitter*)
|
||||
gzip --stdout --name $exe > target/tree-sitter-$platform.gz
|
||||
done
|
||||
rm -rf artifacts
|
||||
ls -l target/
|
||||
|
||||
- name: Get tag name from a release/v* branch name
|
||||
id: tag_name
|
||||
env:
|
||||
tag: ${{ github.head_ref }}
|
||||
run: echo "tag=${tag#release/}" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Add a release tag
|
||||
env:
|
||||
ref: ${{ inputs.ref }}
|
||||
tag: ${{ steps.tag_name.outputs.tag }}
|
||||
message: "Release ${{ steps.tag_name.outputs.tag }}"
|
||||
run: |
|
||||
git config user.name "${GITHUB_ACTOR}"
|
||||
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
|
||||
git tag -a "$tag" HEAD -m "$message"
|
||||
git push origin "$tag"
|
||||
|
||||
- name: Create release
|
||||
uses: softprops/action-gh-release@v1
|
||||
with:
|
||||
name: ${{ steps.tag_name.outputs.tag }}
|
||||
tag_name: ${{ steps.tag_name.outputs.tag }}
|
||||
fail_on_unmatched_files: true
|
||||
files: |
|
||||
tree-sitter-*.gz
|
||||
tree-sitter.wasm
|
||||
tree-sitter.js
|
||||
|
||||
- name: Merge release PR
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
run: |
|
||||
gh pr merge ${{ github.event.pull_request.html_url }} --match-head-commit $(git rev-parse HEAD) --merge --delete-branch
|
||||
157
Cargo.lock
generated
157
Cargo.lock
generated
|
|
@ -22,9 +22,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "anyhow"
|
||||
version = "1.0.69"
|
||||
version = "1.0.70"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "224afbd727c3d6e4b90103ece64b8d1b67fbb1973b1046c2281eed3f3803f800"
|
||||
checksum = "7de8ce5e0f9f8d88245311066a578d72b7af3e7088f32783804676302df237e4"
|
||||
|
||||
[[package]]
|
||||
name = "ascii"
|
||||
|
|
@ -38,7 +38,7 @@ version = "0.2.14"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"
|
||||
dependencies = [
|
||||
"hermit-abi",
|
||||
"hermit-abi 0.1.19",
|
||||
"libc",
|
||||
"winapi",
|
||||
]
|
||||
|
|
@ -128,9 +128,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "core-foundation-sys"
|
||||
version = "0.8.3"
|
||||
version = "0.8.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc"
|
||||
checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa"
|
||||
|
||||
[[package]]
|
||||
name = "ctor"
|
||||
|
|
@ -139,7 +139,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "6d2301688392eb071b0bf1a37be05c469d3cc4dbbd95df672fe28ab021e6a096"
|
||||
dependencies = [
|
||||
"quote",
|
||||
"syn",
|
||||
"syn 1.0.109",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -191,13 +191,13 @@ checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91"
|
|||
|
||||
[[package]]
|
||||
name = "errno"
|
||||
version = "0.2.8"
|
||||
version = "0.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f639046355ee4f37944e44f60642c6f3a7efa3cf6b78c78a0d989a8ce6c396a1"
|
||||
checksum = "50d6a0976c999d473fe89ad888d5a284e55366d9dc9038b1ba2aa15128c4afa0"
|
||||
dependencies = [
|
||||
"errno-dragonfly",
|
||||
"libc",
|
||||
"winapi",
|
||||
"windows-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -260,6 +260,12 @@ dependencies = [
|
|||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hermit-abi"
|
||||
version = "0.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fed44880c466736ef9a5c5b5facefb5ed0785676d0c02d612db14e54f0d84286"
|
||||
|
||||
[[package]]
|
||||
name = "html-escape"
|
||||
version = "0.2.13"
|
||||
|
|
@ -287,9 +293,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "indexmap"
|
||||
version = "1.9.2"
|
||||
version = "1.9.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1885e79c1fc4b10f0e172c475f458b7f7b93061064d98c3293e98c5ba0c8b399"
|
||||
checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
"hashbrown",
|
||||
|
|
@ -306,12 +312,13 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "io-lifetimes"
|
||||
version = "1.0.6"
|
||||
version = "1.0.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cfa919a82ea574332e2de6e74b4c36e74d41982b335080fa59d4ef31be20fdf3"
|
||||
checksum = "09270fd4fa1111bc614ed2246c7ef56239a3063d5be0d1ec3b589c505d400aeb"
|
||||
dependencies = [
|
||||
"hermit-abi 0.3.1",
|
||||
"libc",
|
||||
"windows-sys 0.45.0",
|
||||
"windows-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -322,16 +329,18 @@ checksum = "453ad9f582a441959e5f0d088b02ce04cfe8d51a8eaf077f12ac6d3e94164ca6"
|
|||
|
||||
[[package]]
|
||||
name = "jni"
|
||||
version = "0.20.0"
|
||||
version = "0.21.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "039022cdf4d7b1cf548d31f60ae783138e5fd42013f6271049d7df7afadef96c"
|
||||
checksum = "1a87aa2bb7d2af34197c04845522473242e1aa17c12f4935d5856491a7fb8c97"
|
||||
dependencies = [
|
||||
"cesu8",
|
||||
"cfg-if",
|
||||
"combine",
|
||||
"jni-sys",
|
||||
"log",
|
||||
"thiserror",
|
||||
"walkdir",
|
||||
"windows-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -373,9 +382,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "linux-raw-sys"
|
||||
version = "0.1.4"
|
||||
version = "0.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f051f77a7c8e6957c0696eac88f26b0117e54f52d3fc682ab19397a8812846a4"
|
||||
checksum = "d59d8c75012853d2e872fb56bc8a2e53718e2cafe1a4c823143141c6d90c322f"
|
||||
|
||||
[[package]]
|
||||
name = "log"
|
||||
|
|
@ -457,9 +466,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "1.0.52"
|
||||
version = "1.0.56"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1d0e1ae9e836cc3beddd63db0df682593d7e2d3d891ae8c9083d2113e1744224"
|
||||
checksum = "2b63bdb0cd06f1f4dedf69b254734f9b45af66e4a031e42a7480257d9898b435"
|
||||
dependencies = [
|
||||
"unicode-ident",
|
||||
]
|
||||
|
|
@ -471,7 +480,7 @@ dependencies = [
|
|||
"proc-macro2",
|
||||
"quote",
|
||||
"rand",
|
||||
"syn",
|
||||
"syn 1.0.109",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -515,9 +524,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "raw-window-handle"
|
||||
version = "0.5.1"
|
||||
version = "0.5.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4f851a03551ceefd30132e447f07f96cb7011d6b658374f3aed847333adb5559"
|
||||
checksum = "f2ff9a1f06a88b01621b7ae906ef0211290d1c8a168a15542486a8f61c0833b9"
|
||||
|
||||
[[package]]
|
||||
name = "redox_syscall"
|
||||
|
|
@ -528,6 +537,15 @@ dependencies = [
|
|||
"bitflags",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "redox_syscall"
|
||||
version = "0.3.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "redox_users"
|
||||
version = "0.4.3"
|
||||
|
|
@ -535,15 +553,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b"
|
||||
dependencies = [
|
||||
"getrandom",
|
||||
"redox_syscall",
|
||||
"redox_syscall 0.2.16",
|
||||
"thiserror",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "regex"
|
||||
version = "1.7.1"
|
||||
version = "1.7.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "48aaa5748ba571fb95cd2c85c09f629215d3a6ece942baa100950af03a34f733"
|
||||
checksum = "8b1f693b24f6ac912f4893ef08244d70b6067480d2f1a46e950c9691e6749d1d"
|
||||
dependencies = [
|
||||
"aho-corasick",
|
||||
"memchr",
|
||||
|
|
@ -552,9 +570,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "regex-syntax"
|
||||
version = "0.6.28"
|
||||
version = "0.6.29"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "456c603be3e8d448b072f410900c09faf164fbce2d480456f50eea6e25f9c848"
|
||||
checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1"
|
||||
|
||||
[[package]]
|
||||
name = "rustc-hash"
|
||||
|
|
@ -564,16 +582,16 @@ checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2"
|
|||
|
||||
[[package]]
|
||||
name = "rustix"
|
||||
version = "0.36.9"
|
||||
version = "0.37.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fd5c6ff11fecd55b40746d1995a02f2eb375bf8c00d192d521ee09f42bef37bc"
|
||||
checksum = "2aae838e49b3d63e9274e1c01833cc8139d3fec468c3b84688c628f44b1ae11d"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"errno",
|
||||
"io-lifetimes",
|
||||
"libc",
|
||||
"linux-raw-sys",
|
||||
"windows-sys 0.45.0",
|
||||
"windows-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -599,29 +617,29 @@ checksum = "bebd363326d05ec3e2f532ab7660680f3b02130d780c299bca73469d521bc0ed"
|
|||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
version = "1.0.156"
|
||||
version = "1.0.159"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "314b5b092c0ade17c00142951e50ced110ec27cea304b1037c6969246c2469a4"
|
||||
checksum = "3c04e8343c3daeec41f58990b9d77068df31209f2af111e059e9fe9646693065"
|
||||
dependencies = [
|
||||
"serde_derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_derive"
|
||||
version = "1.0.156"
|
||||
version = "1.0.159"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d7e29c4601e36bcec74a223228dce795f4cd3616341a4af93520ca1a837c087d"
|
||||
checksum = "4c614d17805b093df4b147b51339e7e44bf05ef59fba1e45d83500bcfb4d8585"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"syn 2.0.13",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_json"
|
||||
version = "1.0.94"
|
||||
version = "1.0.95"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1c533a59c9d8a93a09c6ab31f0fd5e5f4dd1b8fc9434804029839884765d04ea"
|
||||
checksum = "d721eca97ac802aa7777b701877c8004d950fc142651367300d21c1cc0194744"
|
||||
dependencies = [
|
||||
"indexmap",
|
||||
"itoa",
|
||||
|
|
@ -653,16 +671,27 @@ dependencies = [
|
|||
]
|
||||
|
||||
[[package]]
|
||||
name = "tempfile"
|
||||
version = "3.4.0"
|
||||
name = "syn"
|
||||
version = "2.0.13"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "af18f7ae1acd354b992402e9ec5864359d693cd8a79dcbef59f76891701c1e95"
|
||||
checksum = "4c9da457c5285ac1f936ebd076af6dac17a61cfe7826f2076b4d015cf47bc8ec"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tempfile"
|
||||
version = "3.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b9fbec84f381d5795b08656e4912bec604d162bff9291d6189a78f4c8ab87998"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"fastrand",
|
||||
"redox_syscall",
|
||||
"redox_syscall 0.3.5",
|
||||
"rustix",
|
||||
"windows-sys 0.42.0",
|
||||
"windows-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -676,22 +705,22 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "thiserror"
|
||||
version = "1.0.39"
|
||||
version = "1.0.40"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a5ab016db510546d856297882807df8da66a16fb8c4101cb8b30054b0d5b2d9c"
|
||||
checksum = "978c9a314bd8dc99be594bc3c175faaa9794be04a5a5e153caba6915336cebac"
|
||||
dependencies = [
|
||||
"thiserror-impl",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "thiserror-impl"
|
||||
version = "1.0.39"
|
||||
version = "1.0.40"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5420d42e90af0c38c3290abcca25b9b3bdf379fc9f55c528f53a269d9c9a267e"
|
||||
checksum = "f9456a42c5b0d803c8cd86e73dd7cc9edd429499f37a3550d286d5e86720569f"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"syn 2.0.13",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -827,9 +856,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "unicode-bidi"
|
||||
version = "0.3.11"
|
||||
version = "0.3.13"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "524b68aca1d05e03fdf03fcdce2c6c94b6daf6d16861ddaa7e4f2b6638a9052c"
|
||||
checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-ident"
|
||||
|
|
@ -883,12 +912,11 @@ checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191"
|
|||
|
||||
[[package]]
|
||||
name = "walkdir"
|
||||
version = "2.3.2"
|
||||
version = "2.3.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "808cf2735cd4b6866113f648b791c6adc5714537bc222d9347bb203386ffda56"
|
||||
checksum = "36df944cda56c7d8d8b7496af378e6b16de9284591917d307c9b4d313c44e698"
|
||||
dependencies = [
|
||||
"same-file",
|
||||
"winapi",
|
||||
"winapi-util",
|
||||
]
|
||||
|
||||
|
|
@ -919,7 +947,7 @@ dependencies = [
|
|||
"once_cell",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"syn 1.0.109",
|
||||
"wasm-bindgen-shared",
|
||||
]
|
||||
|
||||
|
|
@ -941,7 +969,7 @@ checksum = "2aff81306fcac3c7515ad4e177f521b5c9a15f2b08f4e32d823066102f35a5f6"
|
|||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"syn 1.0.109",
|
||||
"wasm-bindgen-backend",
|
||||
"wasm-bindgen-shared",
|
||||
]
|
||||
|
|
@ -964,9 +992,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "webbrowser"
|
||||
version = "0.8.7"
|
||||
version = "0.8.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "97d1fa1e5c829b2bf9eb1e28fb950248b797cd6a04866fbdfa8bc31e5eef4c78"
|
||||
checksum = "579cc485bd5ce5bfa0d738e4921dd0b956eca9800be1fd2e5257ebe95bc4617e"
|
||||
dependencies = [
|
||||
"core-foundation",
|
||||
"dirs 4.0.0",
|
||||
|
|
@ -1021,21 +1049,6 @@ version = "0.4.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
|
||||
|
||||
[[package]]
|
||||
name = "windows-sys"
|
||||
version = "0.42.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7"
|
||||
dependencies = [
|
||||
"windows_aarch64_gnullvm",
|
||||
"windows_aarch64_msvc",
|
||||
"windows_i686_gnu",
|
||||
"windows_i686_msvc",
|
||||
"windows_x86_64_gnu",
|
||||
"windows_x86_64_gnullvm",
|
||||
"windows_x86_64_msvc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-sys"
|
||||
version = "0.45.0"
|
||||
|
|
|
|||
|
|
@ -2,12 +2,18 @@
|
|||
|
||||
set -e
|
||||
|
||||
cargo build --release
|
||||
root_dir=$PWD
|
||||
|
||||
if [ "$CI" == true ]; then
|
||||
set -x
|
||||
tree_sitter="$TREE_SITTER"
|
||||
else
|
||||
cargo build --release
|
||||
tree_sitter=${root_dir}/target/release/tree-sitter
|
||||
fi
|
||||
|
||||
filter_grammar_name=$1
|
||||
|
||||
root_dir=$PWD
|
||||
tree_sitter=${root_dir}/target/release/tree-sitter
|
||||
grammars_dir=${root_dir}/test/fixtures/grammars
|
||||
grammar_files=$(find $grammars_dir -name grammar.js | grep -v node_modules)
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,15 @@
|
|||
|
||||
set -e
|
||||
|
||||
cargo build --release
|
||||
root_dir=$PWD
|
||||
|
||||
if [ "$CI" == true ]; then
|
||||
set -x
|
||||
tree_sitter="$TREE_SITTER"
|
||||
else
|
||||
cargo build --release
|
||||
tree_sitter=${root_dir}/target/release/tree-sitter
|
||||
fi
|
||||
|
||||
build_wasm_args=
|
||||
if [[ $1 == "--docker" ]]; then
|
||||
|
|
@ -12,8 +20,6 @@ fi
|
|||
|
||||
filter_grammar_name=$1
|
||||
|
||||
root_dir=$PWD
|
||||
tree_sitter=${root_dir}/target/release/tree-sitter
|
||||
grammars_dir=${root_dir}/test/fixtures/grammars
|
||||
grammar_files=$(find $grammars_dir -name grammar.js | grep -v node_modules)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue