Skip to content

Commit

Permalink
ci: Build, test and release on more platforms (#14)
Browse files Browse the repository at this point in the history
This runs the build on multiple platforms, uploads the artifacts for the release process to subsequently download.

This only builds for x86 on osx and linux. Windows currently does not work due to bazelbuild/rules_rust#2454. For arm64 cross-compiling will need to be set up.
  • Loading branch information
cameron-martin authored Feb 2, 2024
1 parent fc701fb commit ac30b6c
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 19,439 deletions.
61 changes: 61 additions & 0 deletions .github/workflows/build-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
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-11
extension: ""
fail-fast: false

steps:
- uses: actions/checkout@v3
- name: Build & Test
run: |
cargo --version
bazel test //... -c opt
- uses: actions/upload-artifact@v4
with:
name: bazel-lsp-${{ matrix.target.name }}${{ matrix.target.extension }}
path: bazel-bin/bazel-lsp${{ matrix.target.extension }}
release:
if: github.ref == 'refs/heads/master'
name: Release
runs-on: ubuntu-latest
steps:
- uses: google-github-actions/release-please-action@v4
id: release
with:
token: ${{ secrets.RELEASE_PLEASE_TOKEN }}
release-type: rust
- uses: actions/download-artifact@v4
if: ${{ steps.release.outputs.release_created }}
with:
path: releases
pattern: bazel-lsp-*
- name: Add version to artifacts
if: ${{ steps.release.outputs.release_created }}
run: |
VERSION=${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }}.${{ steps.release.outputs.patch }}
find releases -type f -exec bash -c 'mv "$1" "${1/bazel-lsp-/bazel-lsp-"$VERSION"-}"' _ '{}' \;
- name: Upload Release Artifacts
if: ${{ steps.release.outputs.release_created }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh release upload ${{ steps.release.outputs.tag_name }} ./releases/*
35 changes: 0 additions & 35 deletions .github/workflows/release-please.yml

This file was deleted.

20 changes: 0 additions & 20 deletions .github/workflows/rust.yml

This file was deleted.

3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
/target
/bazel-*
/bazel-*
/MODULE.bazel.lock
Loading

0 comments on commit ac30b6c

Please sign in to comment.