chore: release main (#28) #90
This file contains hidden or 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
| on: | |
| push: | |
| branches: | |
| - main | |
| concurrency: | |
| # Skip intermediate builds: always. | |
| # Cancel intermediate builds: only if it is a pull request build. | |
| group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event.inputs.force_publish }} | |
| cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }} | |
| name: release-please | |
| env: | |
| RUST_BACKTRACE: 1 | |
| CARGO_TERM_COLOR: always | |
| jobs: | |
| test: | |
| name: Test ${{ matrix.rust-version }} on ${{ matrix.os }} | |
| runs-on: ${{ matrix.os }} | |
| timeout-minutes: 120 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: | |
| - ubuntu-latest | |
| - macOS-latest | |
| - windows-latest | |
| rust-version: | |
| - stable | |
| env: | |
| HAS_CODECOV_ACCESS: ${{ secrets.CODECOV_TOKEN != '' }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ github.event.inputs.git_ref || github.ref }} | |
| - uses: dtolnay/rust-toolchain@stable | |
| with: | |
| toolchain: ${{ matrix.rust-version }} | |
| components: rustfmt, clippy | |
| - uses: Swatinem/rust-cache@v2 | |
| - name: Install cargo-llvm-cov | |
| if: env.HAS_CODECOV_ACCESS == 'true' | |
| run: cargo install cargo-llvm-cov | |
| - name: Test compilation | |
| run: cargo check --all --all-targets --locked | |
| - name: Test formatting | |
| run: cargo fmt --all -- --check | |
| - name: Test clippy | |
| run: cargo clippy --all --all-targets --locked | |
| - name: Test documentation | |
| run: cargo doc --all --no-deps --locked | |
| - name: Run tests with code coverage | |
| if: env.HAS_CODECOV_ACCESS == 'true' | |
| run: cargo llvm-cov --locked --all-features --workspace --codecov --output-path codecov.json | |
| - name: Upload coverage to Codecov | |
| if: env.HAS_CODECOV_ACCESS == 'true' | |
| uses: codecov/codecov-action@v5 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| slug: alanpq/ritobin-lsp | |
| files: ./codecov.json | |
| fail_ci_if_error: false | |
| verbose: true | |
| - name: Run tests | |
| if: env.HAS_CODECOV_ACCESS != 'true' | |
| run: cargo test --all --locked | |
| release-please: | |
| name: Execute release chores | |
| permissions: | |
| contents: write | |
| issues: write | |
| pull-requests: write | |
| runs-on: ubuntu-latest | |
| needs: [test] | |
| outputs: | |
| rust_created: ${{ steps.release.outputs['crates/ritobin-lsp--release_created'] }} | |
| vsc_created: ${{ steps.release.outputs['editors/code--release_created'] }} | |
| releases_created: ${{ steps.release.outputs.releases-created }} | |
| rust_tag_name: ${{ steps.release.outputs['crates/ritobin-lsp--tag_name'] }} | |
| vsc_tag_name: ${{ steps.release.outputs['editors/code--tag_name'] }} | |
| steps: | |
| - uses: googleapis/release-please-action@v4 | |
| id: release | |
| with: | |
| config-file: release-please-config.json | |
| manifest-file: .release-please-manifest.json | |
| rust-packaging: | |
| permissions: | |
| contents: write | |
| name: rust-packaging-${{ matrix.platform.target }} | |
| runs-on: ${{ matrix.platform.os }} | |
| needs: | |
| - release-please | |
| if: needs.release-please.outputs.rust_created || needs.release-please.outputs.vsc_created | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| platform: | |
| - vsix_target: linux-x64 | |
| os: ubuntu-latest | |
| target: x86_64-unknown-linux-musl | |
| npm_arch: x64 | |
| bin: ritobin-lsp | |
| name: ritobin-lsp-linux-x86_64-musl.tar.gz | |
| - vsix_target: linux-arm64 | |
| os: ubuntu-latest | |
| target: aarch64-unknown-linux-musl | |
| npm_arch: arm64 | |
| bin: ritobin-lsp | |
| name: ritobin-lsp-linux-aarch64-musl.tar.gz | |
| skip_tests: true | |
| - vsix_target: win32-arm64 | |
| os: windows-latest | |
| target: i686-pc-windows-msvc | |
| npm_arch: arm64 | |
| bin: ritobin-lsp.exe | |
| name: ritobin-lsp-windows-i686.zip | |
| skip_tests: true | |
| - vsix_target: win32-x64 | |
| os: windows-latest | |
| target: x86_64-pc-windows-msvc | |
| npm_arch: x64 | |
| bin: ritobin-lsp.exe | |
| name: ritobin-lsp-windows-x86_64.zip | |
| - vsix_target: darwin-x64 | |
| os: macos-latest | |
| target: x86_64-apple-darwin | |
| npm_arch: x64 | |
| bin: ritobin-lsp | |
| name: ritobin-lsp-macos-darwin-x86_64.tar.gz | |
| - vsix_target: darwin-arm64 | |
| os: macos-latest | |
| target: aarch64-apple-darwin | |
| npm_arch: arm64 | |
| bin: ritobin-lsp | |
| name: ritobin-lsp-macos-darwin-aarch64.tar.gz | |
| skip_tests: true | |
| toolchain: | |
| - stable | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ github.event.inputs.git_ref || github.ref }} | |
| - uses: Swatinem/rust-cache@v2 | |
| - name: Install musl-tools on Linux | |
| run: sudo apt-get update --yes && sudo apt-get install --yes musl-tools | |
| if: contains(matrix.platform.name, 'musl') | |
| - name: Build binary | |
| uses: houseabsolute/actions-rust-cross@v0 | |
| with: | |
| command: "build" | |
| target: ${{ matrix.platform.target }} | |
| toolchain: ${{ matrix.toolchain }} | |
| args: "--locked --release" | |
| strip: true | |
| - name: Run tests | |
| uses: houseabsolute/actions-rust-cross@v0 | |
| with: | |
| command: "test" | |
| target: ${{ matrix.platform.target }} | |
| toolchain: ${{ matrix.toolchain }} | |
| args: "--locked --release" | |
| if: ${{ !matrix.platform.skip_tests }} | |
| - uses: actions/setup-node@v4 | |
| if: needs.release-please.outputs.vsc_created && matrix.toolchain == 'stable' | |
| with: | |
| node-version: 22.x | |
| - run: cd editors/code; npm ci | |
| - name: Package vscode extension | |
| if: needs.release-please.outputs.vsc_created && matrix.toolchain == 'stable' | |
| run: | | |
| cd editors/code | |
| mkdir server | |
| cp -v ../../target/${{ matrix.platform.target }}/release/${{ matrix.platform.bin }} ./server/. | |
| npx vsce package --target ${{ matrix.platform.vsix_target }} --out ../../${{ needs.release-please.outputs.vsc_tag_name }}-${{ matrix.platform.vsix_target }}.vsix | |
| - name: Publish vscode extension to GitHub release | |
| uses: svenstaro/upload-release-action@v2 | |
| if: needs.release-please.outputs.vsc_created && matrix.toolchain == 'stable' | |
| with: | |
| file_glob: true | |
| tag: ${{ needs.release-please.outputs.vsc_tag_name }} | |
| file: "*.vsix" | |
| overwrite: true | |
| - name: Package as archive | |
| if: needs.release-please.outputs.rust_created && matrix.toolchain == 'stable' | |
| shell: bash | |
| run: | | |
| cd target/${{ matrix.platform.target }}/release | |
| if [[ "${{ matrix.platform.os }}" == "windows-latest" ]]; then | |
| 7z a ../../../${{ matrix.platform.name }} ${{ matrix.platform.bin }} | |
| else | |
| tar czvf ../../../${{ matrix.platform.name }} ${{ matrix.platform.bin }} | |
| fi | |
| cd - | |
| - name: Publish release artifacts to GitHub release | |
| uses: svenstaro/upload-release-action@v2 | |
| if: needs.release-please.outputs.rust_created && matrix.toolchain == 'stable' | |
| with: | |
| file_glob: true | |
| tag: ${{ needs.release-please.outputs.rust_tag_name }} | |
| file: ${{ matrix.platform.name }} | |
| overwrite: true |