Skip to content

add cargo alias

add cargo alias #593

Workflow file for this run

name: ci
on: [push, pull_request]
jobs:
build:
name: ${{ matrix.kind }} ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macOS-latest, ubuntu-latest, windows-latest]
env:
CARGO_INCREMENTAL: 0
RUST_BACKTRACE: full
CARGO_TERM_COLOR: always
steps:
- name: Clone repository
uses: actions/checkout@v3
- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
components: rustfmt, clippy
- name: Install rust
uses: hecrj/setup-rust-action@v1
- name: Install clippy and rustfmt
run: |
rustup component add clippy
rustup component add rustfmt
- name: Log versions
run: |
rustc --version
cargo --version
- name: Cache
uses: actions/cache@v3
with:
path: |-
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/*/.*
target/*/build
target/*/deps
key:
${{ matrix.config.os }}-${{ hashFiles('Cargo.lock') }}
restore-keys: |
${{ matrix.config.os }}-
- name: Run cargo fmt
run: cargo fmt --all -- --check
- name: Run cargo check
run: cargo check --locked
- name: Run cargo clippy
run: cargo clippy -- -D warnings
- name: Build release
run: cargo build --release --locked
- name: Build release(aarch64-apple-darwin)
if: startsWith(matrix.os, 'macOS')
run: |
rustup target add aarch64-apple-darwin
cargo build --release --target aarch64-apple-darwin --locked
- name: Run cargo test
run: cargo test --locked
- name: Test install from local file (bash)
if: startsWith(matrix.os, 'ubuntu') || startsWith(matrix.os, 'macOS')
run: ./install.sh ./target/release/dvm
- name: Pre-release (linux)
if: startsWith(matrix.os, 'ubuntu')
run: zip -r dvm-x86_64-unknown-linux-gnu.zip dvm
working-directory: target/release
- name: Pre-release (mac)
if: startsWith(matrix.os, 'macOS')
run: zip -r dvm-x86_64-apple-darwin.zip dvm
working-directory: target/release
- name: Pre-release (mac-aarch64)
if: startsWith(matrix.os, 'macOS')
run: zip -r dvm-aarch64-apple-darwin.zip dvm
working-directory: target/aarch64-apple-darwin/release
- name: Pre-release (windows)
if: startsWith(matrix.os, 'windows')
run: |
Compress-Archive -CompressionLevel Optimal -Force -Path target/release/dvm.exe -DestinationPath target/release/dvm-x86_64-pc-windows-msvc.zip
- name: Release
uses: softprops/action-gh-release@v1
if: |
startsWith(github.repository, 'justjavac') &&
startsWith(github.ref, 'refs/tags/')
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: |
target/release/dvm-x86_64-pc-windows-msvc.zip
target/release/dvm-x86_64-unknown-linux-gnu.zip
target/release/dvm-x86_64-apple-darwin.zip
target/aarch64-apple-darwin/release/dvm-aarch64-apple-darwin.zip
draft: true
- name: Release DVM
uses: justjavac/action-dvm-release@v1
if: |
startsWith(github.repository, 'justjavac') &&
startsWith(github.ref, 'refs/tags/')
env:
GITHUB_TOKEN: ${{ secrets.PERSONAL_TOKEN }}
with:
files: |
target/release/dvm-x86_64-pc-windows-msvc.zip
target/release/dvm-x86_64-unknown-linux-gnu.zip
target/release/dvm-x86_64-apple-darwin.zip
- name: Release DVM(aarch64)
uses: justjavac/action-dvm-release@v1
if: |
startsWith(github.repository, 'justjavac') &&
startsWith(github.ref, 'refs/tags/')
env:
GITHUB_TOKEN: ${{ secrets.PERSONAL_TOKEN }}
with:
files: |
target/aarch64-apple-darwin/release/dvm-aarch64-apple-darwin.zip
- name: Publish
if: |
startsWith(matrix.os, 'ubuntu') &&
startsWith(github.repository, 'justjavac') &&
startsWith(github.ref, 'refs/tags/')
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
run: |
cargo publish