mirror of
https://github.com/house-of-vanity/khm.git
synced 2025-07-07 15:24:07 +00:00
Create main.yml
This commit is contained in:
committed by
GitHub
parent
dff21a5f9c
commit
34dccc5772
116
.github/workflows/main.yml
vendored
Normal file
116
.github/workflows/main.yml
vendored
Normal file
@ -0,0 +1,116 @@
|
||||
name: Rust CI
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- 'v*.*.*' # Запуск при создании новой тэгированной версии
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
||||
include:
|
||||
- os: ubuntu-latest
|
||||
target: x86_64-unknown-linux-gnu
|
||||
- os: windows-latest
|
||||
target: x86_64-pc-windows-msvc
|
||||
- os: macos-latest
|
||||
target: x86_64-apple-darwin
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Set up Rust
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
toolchain: stable
|
||||
profile: minimal
|
||||
override: true
|
||||
|
||||
- name: Install target
|
||||
run: rustup target add ${{ matrix.target }}
|
||||
|
||||
- name: Build project
|
||||
run: cargo build --release --target ${{ matrix.target }}
|
||||
|
||||
- name: Run tests
|
||||
run: cargo test --target ${{ matrix.target }}
|
||||
|
||||
- name: Upload release assets
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: khm-${{ matrix.os }}
|
||||
path: target/${{ matrix.target }}/release/
|
||||
|
||||
release:
|
||||
runs-on: ubuntu-latest
|
||||
needs: build
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Download Linux build artifact
|
||||
uses: actions/download-artifact@v2
|
||||
with:
|
||||
name: khm-ubuntu-latest
|
||||
path: target/x86_64-unknown-linux-gnu/release/
|
||||
|
||||
- name: Download Windows build artifact
|
||||
uses: actions/download-artifact@v2
|
||||
with:
|
||||
name: khm-windows-latest
|
||||
path: target/x86_64-pc-windows-msvc/release/
|
||||
|
||||
- name: Download macOS build artifact
|
||||
uses: actions/download-artifact@v2
|
||||
with:
|
||||
name: khm-macos-latest
|
||||
path: target/x86_64-apple-darwin/release/
|
||||
|
||||
- name: Create Release
|
||||
id: create_release
|
||||
uses: actions/create-release@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
tag_name: ${{ github.ref }}
|
||||
release_name: Release ${{ github.ref }}
|
||||
draft: false
|
||||
prerelease: false
|
||||
|
||||
- name: Upload Linux Release Asset
|
||||
uses: actions/upload-release-asset@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||
asset_path: target/x86_64-unknown-linux-gnu/release/khm
|
||||
asset_name: khm-linux
|
||||
asset_content_type: application/octet-stream
|
||||
|
||||
- name: Upload Windows Release Asset
|
||||
uses: actions/upload-release-asset@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||
asset_path: target/x86_64-pc-windows-msvc/release/khm.exe
|
||||
asset_name: khm-windows.exe
|
||||
asset_content_type: application/octet-stream
|
||||
|
||||
- name: Upload macOS Release Asset
|
||||
uses: actions/upload-release-asset@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||
asset_path: target/x86_64-apple-darwin/release/khm
|
||||
asset_name: khm-macos
|
||||
asset_content_type: application/octet-stream
|
Reference in New Issue
Block a user