From 9d638a041a57ff417f3a2db77044934617198237 Mon Sep 17 00:00:00 2001 From: Federico Borello <156438142+fborello-lambda@users.noreply.github.com> Date: Tue, 16 Jul 2024 16:35:03 -0300 Subject: [PATCH] feat: add just and ci (#2) * feat: add just and ci * fix: lint * fix(alsa-error): install libasound2-dev --------- Co-authored-by: tomyrd Co-authored-by: Tomas Rodriguez Dala <43424983+tomyrd@users.noreply.github.com> --- .github/workflows/build.yml | 38 +++++++++++++++++++++++++++++++++ .github/workflows/pr_action.yml | 27 +++++++++++++++++++++++ README.md | 15 +++++++++++++ justfile | 22 +++++++++++++++++++ 4 files changed, 102 insertions(+) create mode 100644 .github/workflows/build.yml create mode 100644 .github/workflows/pr_action.yml create mode 100644 README.md create mode 100644 justfile diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..763d6c2 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,38 @@ +name: Build Rust Project + +on: + push: + tags: + - "v*.*.*" + +env: + CARGO_TERM_COLOR: always + +jobs: + build-and-upload: + name: Build and upload + strategy: + matrix: + os: [ubuntu-latest, macos-latest] + runs-on: ${{ matrix.os }} + steps: + - name: Checkout + uses: actions/checkout@v4.1.7 + - name: Use the rust-toolchain + uses: actions-rust-lang/setup-rust-toolchain@v1 + - name: Install just + uses: extractions/setup-just@v1 + - run: echo "WORKING_DIR=$(basename $(pwd))" >> $GITHUB_ENV + - name: Install Dependencies + if: ${{ matrix.os }} == 'ubuntu-latest' + run: sudo apt-get install g++ pkg-config libx11-dev libasound2-dev libudev-dev libxkbcommon-x11-0 + - name: Build + shell: bash + run: | + just build-release + echo "${{ env.WORKING_DIR }}" + mv "target/release/${{ env.WORKING_DIR }}" "${{ matrix.os }}.bin" + - name: Release + uses: softprops/action-gh-release@v2 + with: + files: ${{ matrix.os }}.bin diff --git a/.github/workflows/pr_action.yml b/.github/workflows/pr_action.yml new file mode 100644 index 0000000..db88ab3 --- /dev/null +++ b/.github/workflows/pr_action.yml @@ -0,0 +1,27 @@ +name: cargo fmt, clippy and test on PR + +on: + pull_request: + +env: + CARGO_TERM_COLOR: always + +jobs: + check: + name: check fmt and clippy + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4.1.7 + - name: Use the rust-toolchain + uses: actions-rust-lang/setup-rust-toolchain@v1 + - name: Install dependencies + shell: bash + run: | + sudo apt-get install g++ pkg-config libx11-dev libasound2-dev libudev-dev libxkbcommon-x11-0 + - name: Check fmt + uses: actions-rust-lang/rustfmt@v1 + - name: Check clippy + run: cargo clippy + - name: Check test + run: cargo test --all-features diff --git a/README.md b/README.md new file mode 100644 index 0000000..e8ca712 --- /dev/null +++ b/README.md @@ -0,0 +1,15 @@ +# Bevy HandsOn + +> [!NOTE] +> WIP + +## Justfile + +Using `just` instead of `make`. + +After installation, the project can be built just by running `just`. + +- [Packages](https://github.com/casey/just?tab=readme-ov-file#packages) + - Ubuntu → `apt install just` + - MacOs → `brew install just` +- [Editor Support](https://github.com/casey/just?tab=readme-ov-file#editor-support) diff --git a/justfile b/justfile new file mode 100644 index 0000000..26b17f8 --- /dev/null +++ b/justfile @@ -0,0 +1,22 @@ +default: lint build-debug test + +build-release: + cargo build --release +alias br := build-release + +build-debug: + cargo build +alias bd := build-debug + +test: + cargo test +alias t := test + +lint: + cargo clippy +alias l := lint + +[positional-arguments] +@git_tag *args='': + git tag $1 -f + git push --tags -f