From d4cf0b76bd1dc6750d467612530a0305b8bfabe3 Mon Sep 17 00:00:00 2001 From: trivernis Date: Sat, 10 Apr 2021 10:32:10 +0200 Subject: [PATCH 1/5] Add build-and-release task and rust-toolchain file Signed-off-by: trivernis --- .github/workflows/build-and-release.yml | 48 +++++++++++++++++++++++++ rust-toolchain | 5 +++ 2 files changed, 53 insertions(+) create mode 100644 .github/workflows/build-and-release.yml create mode 100644 rust-toolchain diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml new file mode 100644 index 0000000..96ff4a4 --- /dev/null +++ b/.github/workflows/build-and-release.yml @@ -0,0 +1,48 @@ +name: "Build and Release" +on: + push: + tags: + - "v*" + workflow_dispatch: + +jobs: + build-release: + 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: Cache cargo builds + uses: actions/cache@v2 + with: + path: | + target + ~/.cargo/ + key: ${{ runner.os }}-cargo-${{ hashFiles('Cargo.lock') }} + restore-keys: | + ${{ runner.os }}-cargo- + - name: Build Release + uses: actions-rs/cargo@v1 + with: + use-cross: false + command: build + args: --release --target x86_64-unknown-linux-gnu + - name: Move binaries + run: mv target/x86_64-unknown-linux-gnu/release/tobi-rs target/tobi-rs-linux-x86_64 + - name: Upload artifacts + uses: actions/upload-artifact@v2 + with: + name: tobi-rs-linux-x86_64 + path: target/tobi-rs-linux-x86_64 + - name: publish release + uses: "marvinpinto/action-automatic-releases@latest" + with: + repo_token: "${{ secrets.GITHUB_TOKEN }}" + prerelease: false + files: | + LICENSE + target/tobi-rs-linux-x86_64 \ No newline at end of file diff --git a/rust-toolchain b/rust-toolchain new file mode 100644 index 0000000..9de0495 --- /dev/null +++ b/rust-toolchain @@ -0,0 +1,5 @@ +[toolchain] +channel = "nightly" +targets = [ + "x86_64-unknown-linux-gnu", +] \ No newline at end of file From b92d87c8618a75ce138216d00cd9d8f1ecceba0f Mon Sep 17 00:00:00 2001 From: trivernis Date: Sat, 10 Apr 2021 10:34:53 +0200 Subject: [PATCH 2/5] Add build task and remove input from toolchain setup Signed-off-by: trivernis --- .github/workflows/build-and-release.yml | 3 --- .github/workflows/build.yml | 36 +++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index 96ff4a4..3c3bd86 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -13,9 +13,6 @@ jobs: uses: actions/checkout@v2 - name: Set up toolchain uses: actions-rs/toolchain@v1 - with: - toolchain: nightly - override: true - name: Cache cargo builds uses: actions/cache@v2 with: diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..505560a --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,36 @@ +name: Build and Test + +on: + workflow_dispatch: + push: + branches: [ main, develop, actions ] + pull_request: + branches: [ main, develop, actions ] + +env: + CARGO_TERM_COLOR: always + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Set up toolchain + uses: actions-rs/toolchain@v1 + - name: Cache build data + uses: actions/cache@v2 + with: + path: | + target + ~/.cargo/ + key: ${{ runner.os }}-cargo-${{ hashFiles('Cargo.lock') }} + restore-keys: | + ${{ runner.os }}-cargo- + + - name: Build + run: cargo build --verbose + + - name: Run tests + run: cargo test --verbose \ No newline at end of file From c4a693802902dd4b3817919bd9f6381fbe16e50c Mon Sep 17 00:00:00 2001 From: trivernis Date: Sat, 10 Apr 2021 10:38:02 +0200 Subject: [PATCH 3/5] Fix toolchain (hopefully) Signed-off-by: trivernis --- .github/workflows/build-and-release.yml | 2 ++ .github/workflows/build.yml | 2 ++ 2 files changed, 4 insertions(+) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index 3c3bd86..e247a67 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -13,6 +13,8 @@ jobs: uses: actions/checkout@v2 - name: Set up toolchain uses: actions-rs/toolchain@v1 + with: + override: true - name: Cache cargo builds uses: actions/cache@v2 with: diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 505560a..371c822 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -19,6 +19,8 @@ jobs: - uses: actions/checkout@v2 - name: Set up toolchain uses: actions-rs/toolchain@v1 + with: + override: true - name: Cache build data uses: actions/cache@v2 with: From f54817c09a70f3be11bf2e757655ef9794be7693 Mon Sep 17 00:00:00 2001 From: trivernis Date: Sat, 10 Apr 2021 10:39:52 +0200 Subject: [PATCH 4/5] Add extension to toolchain file to hopefully work Signed-off-by: trivernis --- rust-toolchain => rust-toolchain.toml | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename rust-toolchain => rust-toolchain.toml (100%) diff --git a/rust-toolchain b/rust-toolchain.toml similarity index 100% rename from rust-toolchain rename to rust-toolchain.toml From bd1fc77f5c91d8b065eeba609802b86eda733cf3 Mon Sep 17 00:00:00 2001 From: trivernis Date: Sat, 10 Apr 2021 10:42:05 +0200 Subject: [PATCH 5/5] Add toolchain information back to tasks Signed-off-by: trivernis --- .github/workflows/build-and-release.yml | 1 + .github/workflows/build.yml | 1 + 2 files changed, 2 insertions(+) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index e247a67..96ff4a4 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -14,6 +14,7 @@ jobs: - name: Set up toolchain uses: actions-rs/toolchain@v1 with: + toolchain: nightly override: true - name: Cache cargo builds uses: actions/cache@v2 diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 371c822..bfc9164 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -20,6 +20,7 @@ jobs: - name: Set up toolchain uses: actions-rs/toolchain@v1 with: + toolchain: nightly override: true - name: Cache build data uses: actions/cache@v2