Delete Cargo.lock #40
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
name: Release | |
on: | |
push: | |
branches: ["main"] | |
workflow_dispatch: | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
release: | |
name: Cross build for ${{ matrix.target }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
include: | |
# - os: ubuntu-latest | |
# target: x86_64-unknown-linux-musl | |
# suffix: "" | |
- os: ubuntu-latest | |
target: armv7-unknown-linux-musleabihf | |
suffix: "" | |
# - os: macos-latest | |
# target: x86_64-apple-darwin | |
# suffix: "" | |
# - os: macos-latest | |
# target: aarch64-apple-darwin | |
# suffix: "" | |
# - os: windows-latest | |
# target: x86_64-pc-windows-msvc | |
# suffix: .exe | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: stable | |
- name: Cache | |
uses: Swatinem/[email protected] | |
- name: Install cross | |
run: cargo install cross | |
#- name: Run tests | |
# run: cross test --release --target ${{ matrix.target }} --verbose | |
- name: Build release | |
run: cross build --release --target ${{ matrix.target }} | |
# - name: Install LLVM Strip | |
# if: matrix.os == 'ubuntu-latest' | |
# run: sudo apt-get install -y llvm | |
# | |
# - name: LLVM Strip | |
# if: matrix.os == 'ubuntu-latest' | |
# continue-on-error: true | |
# run: | | |
# llvm-strip target/${{ matrix.target }}/release/stat_server${{matrix.suffix}} | |
# llvm-strip target/${{ matrix.target }}/release/stat_client${{matrix.suffix}} | |
# cp config.toml target/${{ matrix.target }}/release/ | |
# #cp systemd/stat_server.service target/${{ matrix.target }}/release/ | |
# #cp systemd/stat_client.service target/${{ matrix.target }}/release/ | |
- name: Run UPX | |
# Upx may not support some platforms. Ignore the errors | |
continue-on-error: true | |
# Disable upx for mips. See https://github.com/upx/upx/issues/387 | |
if: matrix.os == 'ubuntu-latest' && !contains(matrix.target, 'mips') | |
uses: crazy-max/ghaction-upx@v2 | |
with: | |
version: latest | |
files: | | |
target/${{ matrix.target }}/release/stat_server${{matrix.suffix}} | |
target/${{ matrix.target }}/release/stat_client${{matrix.suffix}} | |
args: -q --best --lzma | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: ServerStatus-${{ matrix.target }} | |
path: | | |
target/${{ matrix.target }}/release/stat_server${{matrix.suffix}} | |
target/${{ matrix.target }}/release/stat_client${{matrix.suffix}} | |
target/${{ matrix.target }}/release/config.toml | |
- name: Zip Release For Server | |
if: matrix.os == 'ubuntu-latest' | |
uses: TheDoctor0/[email protected] | |
with: | |
type: zip | |
filename: server-${{ matrix.target }}.zip | |
directory: target/${{ matrix.target }}/release/ | |
path: | | |
stat_server${{matrix.suffix}} | |
stat_server.service | |
config.toml | |
- name: Zip Release For Client | |
if: matrix.os == 'ubuntu-latest' | |
uses: TheDoctor0/[email protected] | |
with: | |
type: zip | |
filename: client-${{ matrix.target }}.zip | |
directory: target/${{ matrix.target }}/release/ | |
path: | | |
stat_client${{matrix.suffix}} | |
stat_client.service | |
# - name: Zip Release For MacOS/Win | |
# if: matrix.os != 'ubuntu-latest' | |
# uses: TheDoctor0/[email protected] | |
# with: | |
# type: zip | |
# filename: ServerStatus-${{ matrix.target }}.zip | |
# directory: target/${{ matrix.target }}/release/ | |
# path: | | |
# stat_server${{matrix.suffix}} | |
# stat_client${{matrix.suffix}} | |
- name: Publish | |
uses: softprops/action-gh-release@v1 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
files: | | |
target/${{ matrix.target }}/release/server-${{ matrix.target }}.zip | |
target/${{ matrix.target }}/release/client-${{ matrix.target }}.zip | |
generate_release_notes: true | |
draft: true |