fix linux protoc error #46
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: Rust | |
on: | |
push: | |
branches: [ main ] | |
tags: "*" | |
pull_request: | |
branches: [ main ] | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
rust: [nightly] | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Setup Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: ${{ matrix.rust }} | |
override: true | |
components: rustfmt, clippy | |
- name: Install protobuf compiler (Ubuntu) | |
if: matrix.os == 'ubuntu-latest' | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y protobuf-compiler | |
- name: Install protobuf compiler (macOS) | |
if: matrix.os == 'macos-latest' | |
run: | | |
brew install protobuf | |
- name: Install protobuf compiler (Windows) | |
if: matrix.os == 'windows-latest' | |
uses: crazy-max/ghaction-chocolatey@v1 | |
with: | |
args: install protoc | |
- name: Build | |
run: cargo build --verbose | |
- name: Check formatting | |
run: cargo fmt -- --check | |
- name: Lint with Clippy | |
run: cargo clippy -- -D warnings | |
- name: Create Release (Windows) | |
if: startsWith(github.ref, 'refs/tags/') && matrix.os == 'windows-latest' | |
run: | | |
echo ${{ matrix.os }} | |
cargo build --release | |
mv target/release/cccp.exe target/release/cccp_${{ matrix.os }}.exe | |
- name: Create Release (Non-Windows) | |
if: startsWith(github.ref, 'refs/tags/') && matrix.os != 'windows-latest' | |
run: | | |
echo ${{ matrix.os }} | |
cargo build --release | |
mv target/release/cccp target/release/cccp_${{ matrix.os }} | |
- name: Upload Release (Windows) | |
if: startsWith(github.ref, 'refs/tags/') && matrix.os == 'windows-latest' | |
uses: actions/upload-artifact@v2 | |
with: | |
name: cccp_${{ matrix.os }} | |
path: target/release/cccp_${{ matrix.os }}.exe | |
- name: Upload Release (Non-Windows) | |
if: startsWith(github.ref, 'refs/tags/') && matrix.os != 'windows-latest' | |
uses: actions/upload-artifact@v2 | |
with: | |
name: cccp_${{ matrix.os }} | |
path: target/release/cccp_${{ matrix.os }} |