chore(deps): update dependency rules_rust to v0.56.0 #216
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: Rust | |
on: | |
push: | |
branches: ["master"] | |
pull_request: | |
branches: ["master"] | |
jobs: | |
build-and-test: | |
name: Build and Test | |
runs-on: ${{ matrix.target.runs-on }} | |
strategy: | |
matrix: | |
target: | |
- name: linux-amd64 | |
runs-on: ubuntu-20.04 | |
extension: "" | |
- name: windows-amd64 | |
runs-on: windows-2019 | |
extension: .exe | |
- name: osx-amd64 | |
runs-on: macos-13 | |
extension: "" | |
- name: osx-arm64 | |
runs-on: macos-14 | |
extension: "" | |
fail-fast: false | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up buildbuddy | |
env: | |
BUILDBUDDY_API_KEY: ${{ secrets.BUILDBUDDY_API_KEY }} | |
run: | | |
echo "build:ci --remote_header=x-buildbuddy-api-key=$BUILDBUDDY_API_KEY" >> ~/.bazelrc | |
shell: bash | |
- name: Set up output base | |
run: | | |
OUTPUT_BASE=$RUNNER_TEMP/.bazel/output_base | |
echo "startup --output_base=$OUTPUT_BASE" >> ~/.bazelrc | |
echo "OUTPUT_BASE=$OUTPUT_BASE" >> "$GITHUB_ENV" | |
shell: bash | |
if: runner.os != 'Windows' | |
- name: Set up output base | |
run: | | |
OUTPUT_BASE=C:/b | |
echo "startup --output_base=$OUTPUT_BASE" >> ~/.bazelrc | |
echo "OUTPUT_BASE=$OUTPUT_BASE" >> "$GITHUB_ENV" | |
shell: bash | |
if: runner.os == 'Windows' | |
- uses: actions/cache@v4 | |
with: | |
path: | | |
${{ env.OUTPUT_BASE }}/external | |
key: bazel-${{ matrix.target.name }}-${{ github.ref }} | |
restore-keys: | |
bazel-${{ matrix.target.name }}-refs/heads/master | |
- name: Build & Test (bash) | |
run: | | |
INVOCATION_ID="$(uuidgen)" | |
echo "[View on BuildBuddy](https://bazel-lsp.buildbuddy.io/invocation/$INVOCATION_ID)" >> $GITHUB_STEP_SUMMARY | |
bazel test //... -c opt --config=ci --invocation_id="$INVOCATION_ID" | |
if: runner.os != 'Windows' | |
- name: Build & Test (powershell) | |
run: | | |
$InvocationId = New-Guid | |
bazel test //... -c opt --config=ci --invocation_id="$InvocationId" | |
if: runner.os == 'Windows' | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: bazel-lsp-${{ matrix.target.name }} | |
path: bazel-bin/bazel-lsp${{ matrix.target.extension }} | |
release: | |
name: Release | |
needs: [build-and-test] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: googleapis/release-please-action@v4 | |
id: release | |
with: | |
token: ${{ secrets.RELEASE_PLEASE_TOKEN }} | |
release-type: rust | |
if: github.ref == 'refs/heads/master' | |
- uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v4 | |
with: | |
path: releases | |
pattern: bazel-lsp-* | |
- name: Rename artifacts | |
run: | | |
version=${{ steps.release.outputs.major || 0 }}.${{ steps.release.outputs.minor || 0 }}.${{ steps.release.outputs.patch || 0 }} | |
files="$(find releases -type f)" | |
for file in $files; do | |
basename="$(basename $file)" | |
extension="${basename/bazel-lsp/}" | |
dirname="$(dirname $file)" | |
mv "$file" "${dirname/bazel-lsp-/bazel-lsp-${version}-}${extension}" | |
rmdir "$dirname" | |
done | |
- name: Show Release Artifacts | |
run: find releases | |
- name: Upload Release Artifacts | |
if: ${{ steps.release.outputs.release_created }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.RELEASE_PLEASE_TOKEN }} | |
run: gh release upload ${{ steps.release.outputs.tag_name }} ./releases/* |