Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
QiBaobin committed Jan 24, 2023
2 parents 6f6cb3c + 64ec025 commit 784380f
Show file tree
Hide file tree
Showing 244 changed files with 10,898 additions and 3,468 deletions.
78 changes: 17 additions & 61 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,10 @@ jobs:
profile: minimal
override: true

- uses: Swatinem/rust-cache@v1
- uses: Swatinem/rust-cache@v2

- name: Run cargo check
uses: actions-rs/cargo@v1
with:
command: check
run: cargo check

test:
name: Test Suite
Expand All @@ -46,12 +44,9 @@ jobs:
uses: actions/checkout@v3

- name: Install stable toolchain
uses: helix-editor/rust-toolchain@v1
with:
profile: minimal
override: true
uses: dtolnay/rust-toolchain@1.61

- uses: Swatinem/rust-cache@v1
- uses: Swatinem/rust-cache@v2

- name: Cache test tree-sitter grammar
uses: actions/cache@v3
Expand All @@ -61,15 +56,10 @@ jobs:
restore-keys: ${{ runner.os }}-stable-v${{ env.CACHE_VERSION }}-tree-sitter-grammars-

- name: Run cargo test
uses: actions-rs/cargo@v1
with:
command: test
args: --workspace
run: cargo test --workspace

- name: Run cargo integration-test
uses: actions-rs/cargo@v1
with:
command: integration-test
run: cargo integration-test

strategy:
matrix:
Expand All @@ -83,31 +73,20 @@ jobs:
uses: actions/checkout@v3

- name: Install stable toolchain
uses: helix-editor/rust-toolchain@v1
uses: dtolnay/rust-toolchain@1.61
with:
profile: minimal
override: true
components: rustfmt, clippy

- uses: Swatinem/rust-cache@v1
- uses: Swatinem/rust-cache@v2

- name: Run cargo fmt
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
run: cargo fmt --all --check

- name: Run cargo clippy
uses: actions-rs/cargo@v1
with:
command: clippy
args: --workspace --all-targets -- -D warnings
run: cargo clippy --workspace --all-targets -- -D warnings

- name: Run cargo doc
uses: actions-rs/cargo@v1
with:
command: doc
args: --no-deps --workspace --document-private-items
run: cargo doc --no-deps --workspace --document-private-items
env:
RUSTDOCFLAGS: -D warnings

Expand All @@ -119,18 +98,15 @@ jobs:
uses: actions/checkout@v3

- name: Install stable toolchain
uses: helix-editor/rust-toolchain@v1
with:
profile: minimal
override: true
uses: dtolnay/rust-toolchain@1.61

- uses: Swatinem/rust-cache@v1
- uses: Swatinem/rust-cache@v2

- name: Validate queries
run: cargo xtask query-check

- name: Generate docs
uses: actions-rs/cargo@v1
with:
command: xtask
args: docgen
run: cargo xtask docgen

- name: Check uncommitted documentation changes
run: |
Expand All @@ -139,23 +115,3 @@ jobs:
|| (echo "Run 'cargo xtask docgen', commit the changes and push again" \
&& exit 1)
queries:
name: Tree-sitter queries
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v3

- name: Install stable toolchain
uses: helix-editor/rust-toolchain@v1
with:
profile: minimal
override: true

- uses: Swatinem/rust-cache@v1

- name: Generate docs
uses: actions-rs/cargo@v1
with:
command: xtask
args: query-check
73 changes: 33 additions & 40 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,12 @@ jobs:
uses: actions/checkout@v3

- name: Install stable toolchain
uses: helix-editor/rust-toolchain@v1
with:
profile: minimal
override: true
uses: dtolnay/rust-toolchain@stable

- uses: Swatinem/rust-cache@v1
- uses: Swatinem/rust-cache@v2

- name: Fetch tree-sitter grammars
uses: actions-rs/cargo@v1
with:
command: run
args: --package=helix-loader --bin=hx-loader
run: cargo run --package=helix-loader --bin=hx-loader

- name: Bundle grammars
run: tar cJf grammars.tar.xz -C runtime/grammars/sources .
Expand All @@ -50,24 +44,34 @@ jobs:
dist:
name: Dist
needs: [fetch-grammars]
env:
# For some builds, we use cross to test on 32-bit and big-endian
# systems.
CARGO: cargo
# When CARGO is set to CROSS, this is set to `--target matrix.target`.
TARGET_FLAGS:
# When CARGO is set to CROSS, TARGET_DIR includes matrix.target.
TARGET_DIR: ./target
# Emit backtraces on panics.
RUST_BACKTRACE: 1
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false # don't fail other jobs if one fails
matrix:
build: [x86_64-linux, x86_64-macos, x86_64-windows] #, x86_64-win-gnu, win32-msvc
include:
- build: x86_64-linux
os: ubuntu-20.04
os: ubuntu-latest
rust: stable
target: x86_64-unknown-linux-gnu
cross: false
- build: aarch64-linux
os: ubuntu-20.04
os: ubuntu-latest
rust: stable
target: aarch64-unknown-linux-gnu
cross: true
- build: riscv64-linux
os: ubuntu-20.04
os: ubuntu-latest
rust: stable
target: riscv64gc-unknown-linux-gnu
cross: true
Expand All @@ -77,7 +81,7 @@ jobs:
target: x86_64-apple-darwin
cross: false
- build: x86_64-windows
os: windows-2019
os: windows-latest
rust: stable
target: x86_64-pc-windows-msvc
cross: false
Expand Down Expand Up @@ -110,28 +114,31 @@ jobs:
tar xJf grammars/grammars.tar.xz -C runtime/grammars/sources
- name: Install ${{ matrix.rust }} toolchain
uses: actions-rs/toolchain@v1
uses: dtolnay/rust-toolchain@master
with:
profile: minimal
toolchain: ${{ matrix.rust }}
target: ${{ matrix.target }}
override: true

# Install a pre-release version of Cross
# TODO: We need to pre-install Cross because we need cross-rs/cross#591 to
# get a newer C++ compiler toolchain. Remove this step when Cross
# 0.3.0, which includes cross-rs/cross#591, is released.
- name: Install Cross
if: "matrix.cross"
run: cargo install cross --git https://github.com/cross-rs/cross.git --rev 47df5c76e7cba682823a0b6aa6d95c17b31ba63a
run: |
cargo install cross --git https://github.com/cross-rs/cross.git --rev 47df5c76e7cba682823a0b6aa6d95c17b31ba63a
echo "CARGO=cross" >> $GITHUB_ENV
# echo "TARGET_FLAGS=--target ${{ matrix.target }}" >> $GITHUB_ENV
# echo "TARGET_DIR=./target/${{ matrix.target }}" >> $GITHUB_ENV

- name: Show command used for Cargo
run: |
echo "cargo command is: ${{ env.CARGO }}"
echo "target flag is: ${{ env.TARGET_FLAGS }}"
- name: Run cargo test
uses: actions-rs/cargo@v1
if: "!matrix.skip_tests"
with:
use-cross: ${{ matrix.cross }}
command: test
args: --release --locked --target ${{ matrix.target }} --workspace
run: ${{ env.CARGO }} test --release --locked --target ${{ matrix.target }} --workspace

- name: Set profile.release.strip = true
shell: bash
Expand All @@ -142,11 +149,7 @@ jobs:
EOF
- name: Build release binary
uses: actions-rs/cargo@v1
with:
use-cross: ${{ matrix.cross }}
command: build
args: --release --locked --target ${{ matrix.target }}
run: ${{ env.CARGO }} build --release --locked --target ${{ matrix.target }}

- name: Build AppImage
shell: bash
Expand Down Expand Up @@ -221,16 +224,6 @@ jobs:

- uses: actions/download-artifact@v3

- name: Calculate tag name
run: |
name=dev
if [[ $GITHUB_REF == refs/tags/* ]]; then
name=${GITHUB_REF:10}
fi
echo ::set-output name=val::$name
echo TAG=$name >> $GITHUB_ENV
id: tagname

- name: Build archive
shell: bash
run: |
Expand All @@ -250,7 +243,7 @@ jobs:
if [[ $platform =~ "windows" ]]; then
exe=".exe"
fi
pkgname=helix-$TAG-$platform
pkgname=helix-$GITHUB_REF_NAME-$platform
mkdir $pkgname
cp $source/LICENSE $source/README.md $pkgname
mkdir $pkgname/contrib
Expand All @@ -270,7 +263,7 @@ jobs:
fi
done
tar cJf dist/helix-$TAG-source.tar.xz -C $source .
tar cJf dist/helix-$GITHUB_REF_NAME-source.tar.xz -C $source .
mv dist $source/
- name: Upload binaries to release
Expand All @@ -280,7 +273,7 @@ jobs:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: dist/*
file_glob: true
tag: ${{ steps.tagname.outputs.val }}
tag: ${{ github.ref_name }}
overwrite: true

- name: Upload binaries as artifact
Expand Down
Loading

0 comments on commit 784380f

Please sign in to comment.