From cc4f932d175b65e6fc9a55df5c55fc0b3a7d9ada Mon Sep 17 00:00:00 2001 From: Andrew Hlynskyi Date: Tue, 4 Apr 2023 02:38:29 +0300 Subject: [PATCH] cicd: new workflow --- .github/scripts/cross.sh | 10 ++ .github/scripts/make.sh | 19 +++ .github/scripts/tree-sitter.sh | 12 ++ .github/workflows/CICD.yml | 69 ++++++++++ .github/workflows/build.yml | 171 +++++++++++++++++++++++++ .github/workflows/ci.yml | 150 ---------------------- .github/workflows/fast_checks.yml | 31 +++++ .github/workflows/full_rust_checks.yml | 32 +++++ .github/workflows/msrv.yml | 42 ++++++ .github/workflows/publish.yml | 21 +++ .github/workflows/release.yml | 101 +++++++++++++++ Cargo.lock | Bin 27903 -> 28279 bytes script/generate-fixtures | 12 +- script/generate-fixtures-wasm | 12 +- 14 files changed, 526 insertions(+), 156 deletions(-) create mode 100755 .github/scripts/cross.sh create mode 100755 .github/scripts/make.sh create mode 100755 .github/scripts/tree-sitter.sh create mode 100644 .github/workflows/CICD.yml create mode 100644 .github/workflows/build.yml delete mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/fast_checks.yml create mode 100644 .github/workflows/full_rust_checks.yml create mode 100644 .github/workflows/msrv.yml create mode 100644 .github/workflows/publish.yml create mode 100644 .github/workflows/release.yml diff --git a/.github/scripts/cross.sh b/.github/scripts/cross.sh new file mode 100755 index 000000000..070171926 --- /dev/null +++ b/.github/scripts/cross.sh @@ -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" "$@" diff --git a/.github/scripts/make.sh b/.github/scripts/make.sh new file mode 100755 index 000000000..62aa0c06d --- /dev/null +++ b/.github/scripts/make.sh @@ -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 diff --git a/.github/scripts/tree-sitter.sh b/.github/scripts/tree-sitter.sh new file mode 100755 index 000000000..2e6e31c29 --- /dev/null +++ b/.github/scripts/tree-sitter.sh @@ -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 diff --git a/.github/workflows/CICD.yml b/.github/workflows/CICD.yml new file mode 100644 index 000000000..7c2351a89 --- /dev/null +++ b/.github/workflows/CICD.yml @@ -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 diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 000000000..27b310859 --- /dev/null +++ b/.github/workflows/build.yml @@ -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 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index e6ef591a2..000000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -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 diff --git a/.github/workflows/fast_checks.yml b/.github/workflows/fast_checks.yml new file mode 100644 index 000000000..ea474799a --- /dev/null +++ b/.github/workflows/fast_checks.yml @@ -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" diff --git a/.github/workflows/full_rust_checks.yml b/.github/workflows/full_rust_checks.yml new file mode 100644 index 000000000..2cc5f77dc --- /dev/null +++ b/.github/workflows/full_rust_checks.yml @@ -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 diff --git a/.github/workflows/msrv.yml b/.github/workflows/msrv.yml new file mode 100644 index 000000000..3697930e8 --- /dev/null +++ b/.github/workflows/msrv.yml @@ -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 diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 000000000..e1ad3e053 --- /dev/null +++ b/.github/workflows/publish.yml @@ -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" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 000000000..27e969e7f --- /dev/null +++ b/.github/workflows/release.yml @@ -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 diff --git a/Cargo.lock b/Cargo.lock index 404c269f684b575fdc180664ded4af04f50eb0f7..4b4437e64ea5b1fce96860a76c1f2d27f7caabb5 100644 GIT binary patch delta 2200 zcmZ8jO>CXT71eVbViJ{-ia4ngh~rHPYOOmzcV;e>_)!#)s310~A`oiTnYlC6RSPsB zN-I_TZCbS(qG6eC$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y!Cm z_4e33TA%)V^zlh_>ERwFQ5zZQnSnz`cX+WGEik7fo2#vwdo>;FBC}+V zuZq$FzAU&NpEfP23gbL_!U+(zHpeU1otb`Dc1|wrc=p`UrGmyus9(aT%FhGG0Dshg nFG9|Wa<%}EC=N!^=xjO6o7MPeQ5)l{3!5W8_2Kk;{qoee#seWp diff --git a/script/generate-fixtures b/script/generate-fixtures index 85298c461..2c3b178a7 100755 --- a/script/generate-fixtures +++ b/script/generate-fixtures @@ -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) diff --git a/script/generate-fixtures-wasm b/script/generate-fixtures-wasm index 9d44b58cb..4bba56ae2 100755 --- a/script/generate-fixtures-wasm +++ b/script/generate-fixtures-wasm @@ -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)