gitignore: Add logs folder #113
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: Deploy unix | |
on: [push, pull_request] | |
jobs: | |
check: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@master | |
- uses: actions-rs/toolchain@v1.0.1 | |
with: | |
toolchain: stable | |
override: true | |
- name: Check style | |
run: cargo fmt -- --check | |
- name: Check tag with toml | |
if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')}} | |
run: | | |
VERSION_TAG="$(git describe --tags --abbrev=0)" | |
echo "Version tag: $VERSION_TAG" | |
echo "Checking if toml is updated.." | |
grep ${VERSION_TAG:1} Cargo.toml | |
- name: Install libraries | |
run: | | |
sudo apt update | |
sudo apt install --yes libudev-dev | |
- name: Build | |
run: cargo build --verbose | |
build-x86_64: | |
needs: check | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@master | |
- uses: actions-rs/toolchain@v1.0.1 | |
with: | |
toolchain: stable | |
override: true | |
- name: Install linux libraries | |
run: | | |
uname -a | |
sudo apt update | |
sudo apt install -y libudev-dev | |
- uses: actions-rs/cargo@v1 | |
with: | |
command: build | |
args: --verbose --release | |
- name: Rename | |
run: cp target/release/linux2rest linux2rest-x86_64 | |
- uses: actions/upload-artifact@master | |
with: | |
name: linux2rest-x86_64 | |
path: linux2rest-x86_64 | |
- uses: svenstaro/upload-release-action@v2 | |
name: Upload binaries to release | |
if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')}} | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: linux2rest-x86_64 | |
asset_name: linux2rest-x86_64 | |
tag: ${{ github.ref }} | |
overwrite: true | |
build-armv7: | |
needs: check | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v1.0.0 | |
- name: Restore cache | |
uses: actions/cache@v2 | |
id: cache | |
with: | |
path: /tmp/.cache | |
key: ${{ runner.os }}-cargo-armv7-${{ hashFiles('Cargo.toml') }}-${{ hashFiles('Cargo.lock') }} | |
restore-keys: | | |
${{ runner.os }}-cargo-armv7-${{ hashFiles('Cargo.toml') }}-${{ hashFiles('Cargo.lock') }} | |
${{ runner.os }}-cargo-armv7-${{ hashFiles('Cargo.toml') }} | |
${{ runner.os }}-cargo-armv7 | |
- uses: uraimo/run-on-arch-action@v2.0.5 | |
id: runcmd | |
with: | |
arch: armv7 | |
distro: ubuntu18.04 | |
githubToken: ${{ github.token }} | |
setup: | | |
mkdir -p /tmp/.cache | |
install: | | |
uname -a | |
apt update | |
apt install -y libudev-dev curl gcc | |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | bash -s -- -y | |
export PATH="$HOME/.cargo/bin:$PATH" | |
cargo install sccache --no-default-features | |
dockerRunArgs: | | |
--volume "/tmp/.cache:/tmp/.cache" | |
run: | | |
export SCCACHE_DIR=/tmp/.cache | |
export PATH="$HOME/.cargo/bin:$PATH" | |
apt install -y pkg-config libudev-dev libssl-dev openssl | |
sccache --show-stats | |
RUSTC_WRAPPER=sccache cargo build --verbose --release --features raspberry | |
sccache --show-stats | |
- name: Rename | |
run: | | |
cp target/release/linux2rest linux2rest-armv7 | |
- name: Fix cache owner | |
run: | | |
sudo chown $(whoami) -R /tmp/.cache | |
- uses: actions/upload-artifact@master | |
with: | |
name: linux2rest-armv7 | |
path: linux2rest-armv7 | |
- uses: svenstaro/upload-release-action@v2 | |
name: Upload binaries to release | |
if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')}} | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: linux2rest-armv7 | |
asset_name: linux2rest-armv7 | |
tag: ${{ github.ref }} | |
prerelease: true | |
overwrite: true |