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: Strip binary on Linux and macOS if: matrix.os != 'windows-latest' run: strip target/${{ matrix.target }}/release/khm - name: Strip binary on Windows if: matrix.os == 'windows-latest' run: | sudo apt-get install -y llvm llvm-strip-10 target/${{ matrix.target }}/release/khm.exe - name: Upload release assets uses: actions/upload-artifact@v2 with: name: khm-${{ matrix.os }} path: target/${{ matrix.target }}/release/