mirror of
https://github.com/xHyroM/zed-discord-presence.git
synced 2024-11-21 21:51:05 +01:00
ci: add release & actions
This commit is contained in:
parent
b3825e78c7
commit
3059d9d2d1
5 changed files with 118 additions and 14 deletions
17
.github/actions/check/action.yml
vendored
Normal file
17
.github/actions/check/action.yml
vendored
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
name: Check
|
||||||
|
description: Lints & formats
|
||||||
|
|
||||||
|
runs:
|
||||||
|
using: composite
|
||||||
|
steps:
|
||||||
|
- name: check
|
||||||
|
shell: bash
|
||||||
|
run: cargo check --all
|
||||||
|
|
||||||
|
- name: fmt
|
||||||
|
shell: bash
|
||||||
|
run: cargo fmt --all -- --check
|
||||||
|
|
||||||
|
- name: clippy
|
||||||
|
shell: bash
|
||||||
|
run: cargo clippy --all -- -D warnings
|
13
.github/actions/install-rust/action.yml
vendored
Normal file
13
.github/actions/install-rust/action.yml
vendored
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
name: Install rust
|
||||||
|
description: Installs the latest version of rust, rustfmt & clippy
|
||||||
|
|
||||||
|
runs:
|
||||||
|
using: composite
|
||||||
|
steps:
|
||||||
|
- name: install rust
|
||||||
|
uses: dtolnay/rust-toolchain@stable
|
||||||
|
with:
|
||||||
|
components: rustfmt, clippy
|
||||||
|
|
||||||
|
- name: cache dependencies
|
||||||
|
uses: Swatinem/rust-cache@v2
|
16
.github/workflows/check.yml
vendored
16
.github/workflows/check.yml
vendored
|
@ -5,24 +5,14 @@ on:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
check:
|
check:
|
||||||
|
name: check
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: checkout
|
- name: checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: install rust
|
- name: install rust
|
||||||
uses: dtolnay/rust-toolchain@stable
|
uses: ./github/actions/install-rust
|
||||||
with:
|
|
||||||
components: rustfmt, clippy
|
|
||||||
|
|
||||||
- name: cache dependencies
|
|
||||||
uses: Swatinem/rust-cache@v2
|
|
||||||
|
|
||||||
- name: check
|
- name: check
|
||||||
run: cargo check --all
|
uses: ./github/actions/check
|
||||||
|
|
||||||
- name: fmt
|
|
||||||
run: cargo fmt --all -- --check
|
|
||||||
|
|
||||||
- name: clippy
|
|
||||||
run: cargo clippy --all -- -D warnings
|
|
||||||
|
|
85
.github/workflows/release.yml
vendored
Normal file
85
.github/workflows/release.yml
vendored
Normal file
|
@ -0,0 +1,85 @@
|
||||||
|
name: Release
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
check:
|
||||||
|
name: check
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: install rust
|
||||||
|
uses: ./github/actions/install-rust
|
||||||
|
|
||||||
|
- name: check
|
||||||
|
uses: ./github/actions/check
|
||||||
|
|
||||||
|
compile:
|
||||||
|
name: compile ${{ matrix.target }}
|
||||||
|
runs-on: ${{ matrix.runs-on && matrix.runs-on || 'ubuntu-latest' }}
|
||||||
|
needs: check
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- target: x86_64-unknown-linux-gnu
|
||||||
|
runner: ubuntu-latest
|
||||||
|
archive: tar.gz
|
||||||
|
|
||||||
|
- target: aarch64-unknown-linux-gnu
|
||||||
|
runner: ubuntu-latest
|
||||||
|
archive: tar.gz
|
||||||
|
|
||||||
|
- target: x86_64-apple-darwin
|
||||||
|
runner: macos-latest
|
||||||
|
archive: tar.gz
|
||||||
|
- target: aarch64-apple-darwin
|
||||||
|
runner: macos-latest
|
||||||
|
archive: tar.gz
|
||||||
|
|
||||||
|
- target: x86_64-pc-windows-msvc
|
||||||
|
runner: windows-latest
|
||||||
|
archive: zip
|
||||||
|
steps:
|
||||||
|
- name: checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: build binary
|
||||||
|
run: cargo build -p discord-presence-lsp --verbose --locked --release --target ${{ matrix.target }}
|
||||||
|
|
||||||
|
- name: prepare for upload
|
||||||
|
id: vars
|
||||||
|
run: |
|
||||||
|
BIN_SUFFIX=""
|
||||||
|
if [[ "${{ matrix.runner }}" == "windows-latest" ]]; then
|
||||||
|
BIN_SUFFIX=".exe"
|
||||||
|
fi
|
||||||
|
|
||||||
|
BIN_OUTPUT="target/${{ matrix.target }}/release/discord-presence-lsp${BIN_SUFFIX}"
|
||||||
|
ARCHIVE_NAME="discord-presence-lsp-${{ matrix.target }}"
|
||||||
|
|
||||||
|
mkdir tmp/
|
||||||
|
mkdir "tmp/${ARCHIVE_NAME}"
|
||||||
|
|
||||||
|
mv "${BIN_OUTPUT}" "tmp/${ARCHIVE_NAME}"
|
||||||
|
cp LICENSE "tmp/${ARCHIVE_NAME}"
|
||||||
|
cp lsp/README.md "tmp/${ARCHIVE_NAME}"
|
||||||
|
|
||||||
|
if [[ "${{ matrix.archive }}" == "tar.gz" ]]; then
|
||||||
|
ARCHIVE_PATH="tmp/${ARCHIVE_NAME}.tar.gz"
|
||||||
|
tar -czvf "${ARCHIVE_PATH}" -C "tmp/${ARCHIVE_NAME}"
|
||||||
|
else
|
||||||
|
ARCHIVE_PATH="tmp/${ARCHIVE_NAME}.zip"
|
||||||
|
zip -r "${ARCHIVE_PATH}" -C "tmp/${ARCHIVE_NAME}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "archive_name=${ARCHIVE_NAME}"
|
||||||
|
echo "archive_path=${ARCHIVE_PATH}" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
- name: upload artifact
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: ${{ steps.vars.outputs.archive_name }}
|
||||||
|
path: |
|
||||||
|
${{ steps.vars.outputs.archive_path }}
|
|
@ -2,7 +2,6 @@
|
||||||
name = "zed-discord-presence"
|
name = "zed-discord-presence"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
license = "GNU General Public License v3.0"
|
|
||||||
license-file = "LICENSE"
|
license-file = "LICENSE"
|
||||||
repository = "https://git.sr.ht/~hyro/zed-discord-presence"
|
repository = "https://git.sr.ht/~hyro/zed-discord-presence"
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue