-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
20f40c9
commit c441462
Showing
2 changed files
with
111 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
name: CI | ||
permissions: | ||
contents: read | ||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
- main | ||
env: | ||
RUST_BACKTRACE: 1 | ||
CARGO_TERM_COLOR: always | ||
CLICOLOR: 1 | ||
CARGO_INCREMENTAL: 0 | ||
concurrency: | ||
group: "${{ github.workflow }}-${{ github.ref }}" | ||
cancel-in-progress: true | ||
jobs: | ||
lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
- name: Install Rust | ||
uses: dtolnay/rust-toolchain@stable | ||
with: | ||
toolchain: stable | ||
- name: Install Protoc | ||
uses: arduino/setup-protoc@v3 | ||
- uses: Swatinem/rust-cache@v2 | ||
- name: Check documentation | ||
env: | ||
RUSTDOCFLAGS: -D warnings | ||
run: cargo doc --workspace --all-features --no-deps --document-private-items | ||
- name: Install cargo-sort | ||
uses: baptiste0928/cargo-install@v3 | ||
with: | ||
crate: cargo-sort | ||
version: "^1.0" | ||
- name: Check formatting | ||
run: cargo +nightly fmt --all -- --check | ||
- name: Check Cargo.toml sorting | ||
run: cargo sort --workspace --check |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
name: release | ||
on: | ||
push: | ||
tags: ["[0-9]+.[0-9]+.[0-9]+*"] | ||
workflow_dispatch: | ||
jobs: | ||
build_binaries: | ||
name: ${{ matrix.target }} | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
include: | ||
- os: ubuntu-latest | ||
target: aarch64-unknown-linux-gnu | ||
- os: ubuntu-latest | ||
target: x86_64-unknown-linux-gnu | ||
- os: macos-latest | ||
target: x86_64-apple-darwin | ||
- os: macos-latest | ||
target: aarch64-apple-darwin | ||
- os: windows-latest | ||
target: x86_64-pc-windows-msvc | ||
- os: windows-latest | ||
target: aarch64-pc-windows-msvc | ||
steps: | ||
- name: checkout | ||
uses: actions/checkout@v4 | ||
- name: Get version | ||
id: get_version | ||
uses: SebRollen/[email protected] | ||
with: | ||
file: Cargo.toml | ||
field: package.version | ||
- uses: actions-rust-lang/setup-rust-toolchain@v1 | ||
with: | ||
rustflags: "" | ||
- uses: taiki-e/install-action@v2 | ||
with: | ||
tool: cross | ||
- name: Build | ||
run: cross build --release --target ${{ matrix.target }} | ||
- name: Prepare artifacts | ||
shell: bash | ||
run: "\ncd target/${{ matrix.target }}/release\n\nif [ \"${{ matrix.os }}\" = \"windows-latest\" ]; then\n 7z a ../../../$s2-cli-${{ matrix.target }}.zip $s2-cli.exe\nelse\n tar -czf ../../../$s2-cli-${{ matrix.target }}.tar.gz $s2-cli\nfi \n" | ||
- name: Upload artifacts | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: ${{ matrix.target }} | ||
path: | | ||
*.tar.gz | ||
*.zip | ||
if-no-files-found: error | ||
create_release: | ||
needs: build_binaries | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
steps: | ||
- name: Download artifacts | ||
uses: actions/download-artifact@v4 | ||
- name: Create Release | ||
uses: softprops/action-gh-release@v2 | ||
with: | ||
files: | | ||
**/*.tar.gz | ||
**/*.zip | ||
draft: true | ||
generate_release_notes: true |