Skip to content

Commit

Permalink
Add proper CI and choose different backend (#1)
Browse files Browse the repository at this point in the history
* Add rust CI

* Use checkout v3

* Trigger on all branches

* Use non ncurses backend
  • Loading branch information
rrooij authored Dec 3, 2022
1 parent abd0572 commit ff2be10
Show file tree
Hide file tree
Showing 3 changed files with 241 additions and 45 deletions.
89 changes: 78 additions & 11 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,87 @@
name: Rust


on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

env:
CARGO_TERM_COLOR: always
push:

jobs:
build:

test:
name: Test
runs-on: ubuntu-latest

strategy:
matrix:
build: [stable]

steps:
- uses: actions/checkout@v3
- name: Run tests
run: cargo test --verbose
- name: Checkout
uses: actions/checkout@v3

- name: Install rust
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust || 'stable' }}
profile: minimal
override: true

- name: Build debug
uses: actions-rs/cargo@v1
with:
command: fmt

- name: Build debug
uses: actions-rs/cargo@v1
with:
command: build

- name: Test
uses: actions-rs/cargo@v1
with:
command: test


create-release:
name: deploy
needs: [test]
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
strategy:
matrix:
target: [ aarch64-unknown-linux-gnu, armv7-unknown-linux-gnueabihf, x86_64-unknown-linux-gnu]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
target: ${{ matrix.target }}

- name: Build target
uses: actions-rs/cargo@v1
with:
use-cross: true
command: build
args: --release --target ${{ matrix.target }}

- name: Package
shell: bash
run: |
# TODO:
# strip target/${{ matrix.target }}/release/rust-ci
cd target/${{ matrix.target }}/release
# UPDATEME: replace the string "rust-ci" with your binary's name.
tar czvf ../../../swaydisplays-${{ matrix.target }}.tar.gz swaydisplays
cd -
- name: Publish
uses: softprops/action-gh-release@v1
# TODO: if any of the build step fails, the release should be deleted.
with:
# UPDATEME: Replace "rust-ci" with your binary name but keep the star (*).
files: 'swaydisplays*'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
190 changes: 157 additions & 33 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ edition = "2021"
license = "GPL-3.0-or-later"

[dependencies]
cursive = "0.20"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"


[dependencies.cursive]
version = "0.20"
default-features = false
features = ["crossterm-backend"]

0 comments on commit ff2be10

Please sign in to comment.