From ed51d413b2d9c288cb7bbfe2e3150e71777a1308 Mon Sep 17 00:00:00 2001 From: trivernis Date: Sat, 24 Jul 2021 12:18:39 +0200 Subject: [PATCH] Add github action to build binaries Signed-off-by: trivernis --- .github/workflows/build.yml | 53 +++++++++++++++++++++++++++++++++++++ rust-toolchain | 6 +++++ 2 files changed, 59 insertions(+) create mode 100644 .github/workflows/build.yml create mode 100644 rust-toolchain diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..99f5497 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,53 @@ +name: "Build" +on: + push: + branches: [main, develop, actions] + workflow_dispatch: + +env: + CARGO_TERM_COLOR: always + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Set up toolchain + uses: actions-rs/toolchain@v1 + with: + toolchain: nightly + override: true + - name: Set up MinGW + uses: egor-tensin/setup-mingw@v1 + with: + platform: x64 + - name: Cache cargo builds + uses: actions/cache@v2 + with: + path: | + target + ~/.cargo/ + key: ${{ runner.os }}-cargo-${{ hashFiles('Cargo.lock') }} + restore-keys: | + ${{ runner.os }}-cargo- + - name: Test + uses: actions-rs/cargo@v1 + with: + command: test + args: --all + - name: Build Release + uses: actions-rs/cargo@v1 + with: + use-cross: false + command: build + args: --release --all-features -Zmultitarget --target x86_64-unknown-linux-gnu --target x86_64-pc-windows-gnu + - name: Create directories + run: mkdir bin && mkdir bin/linux && mkdir bin/windows + - name: Move binaries + run: mv target/x86_64-unknown-linux-gnu/release/{uwuencode,uwudecode} bin/linux && mv target/x86_64-pc-windows-gnu/release/{uwuencode,uwudecode}.exe bin/windows + - name: Upload artifacts + uses: actions/upload-artifact@v2 + with: + name: uwucodec + path: bin/* \ No newline at end of file diff --git a/rust-toolchain b/rust-toolchain new file mode 100644 index 0000000..bd0f0f5 --- /dev/null +++ b/rust-toolchain @@ -0,0 +1,6 @@ +[toolchain] +channel = "nightly" +targets = [ + "x86_64-unknown-linux-gnu", + "x86_64-pc-windows-gnu", +] \ No newline at end of file