diff --git a/.github/workflows/ci-cd.yml b/.github/workflows/ci-cd.yml new file mode 100644 index 0000000..4554a6d --- /dev/null +++ b/.github/workflows/ci-cd.yml @@ -0,0 +1,45 @@ +name: CI/CD + +on: + workflow_dispatch: + workflow_call: + pull_request: + push: + branches: + - main + - dev + paths: + - "src/**/**.rs" + - "crates/**/**.rs" + - "kernel/*.rs" + +jobs: + quality-gate: + permissions: + contents: read + + uses: RustLangES/.github/.github/workflows/quality-gate.yml@main + with: + runs-on: ubuntu-latest + checks-command: "--all --check" + clippy-command: "-- -D warnings" + tests-command: "test" + + build: + permissions: + contents: read + + needs: quality-gate + name: Build + runs-on: ubuntu-latest + steps: + + - uses: actions/checkout@v4 + - uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af + with: + toolchain: stable + + - uses: actions-rs/cargo@844f36862e911db73fe0815f00a4a2602c279505 + with: + command: build + args: "--release --all-features" \ No newline at end of file diff --git a/.github/workflows/quality-gate.yml b/.github/workflows/quality-gate.yml deleted file mode 100644 index e833e61..0000000 --- a/.github/workflows/quality-gate.yml +++ /dev/null @@ -1,22 +0,0 @@ -name: Quality Gate -on: - workflow_dispatch: - workflow_call: - pull_request: - push: - branches: - - main - - dev - paths: - - "src/**/**.rs" - - "crates/**/**.rs" - - "kernel/*.rs" - -jobs: - quality-gate: - uses: RustLangES/.github/.github/workflows/quality-gate.yml@main - with: - runs-on: ubuntu-latest - checks-command: "--all --check" - clippy-command: "-- -D warnings" - tests-command: "test" \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..126d558 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,67 @@ +name: Release Build and Publish + +permissions: + contents: write + +on: + push: + tags: + - "v*" + workflow_dispatch: + inputs: + release_name: + description: "Name of release" + required: false + default: "" + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@stable + + - name: Build release + run: cargo build --release + + - name: Convert BIOS image to ISO + run: | + mkdir -p isos + cp target/bios.img isos/bios.img + xorriso -as mkisofs -o isos/bios.iso isos/bios.img + + - name: Convert UEFI image to ISO + run: | + cp target/uefi.img isos/uefi.img + xorriso -as mkisofs -o isos/uefi.iso isos/uefi.img + + - name: Get tag or manual release name + id: tag_name + run: | + if [ -n "${{ github.event.inputs.release_name }}" ]; then + echo "RELEASE_NAME=${{ github.event.inputs.release_name }}" >> $GITHUB_ENV + else + echo "RELEASE_NAME=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV + fi + + - name: Get commit history with mentions + id: commit_history + run: | + if [ -n "${{ github.event.inputs.release_name }}" ]; then + # Si es un lanzamiento manual, muestra los últimos 10 commits + echo "COMMIT_HISTORY=$(git log --pretty=format:'- %s (by @%an)' -n 10)" >> $GITHUB_ENV + else + # Si es un lanzamiento automático, muestra los commits desde el último tag + echo "COMMIT_HISTORY=$(git log --pretty=format:'- %s (by @%an)' $(git describe --tags --abbrev=0)..HEAD)" >> $GITHUB_ENV + fi + + - name: Create Release + uses: softprops/action-gh-release@v2 + with: + tag_name: ${{ env.RELEASE_NAME }} + name: ${{ env.RELEASE_NAME }} + body: ${{ env.COMMIT_HISTORY }} + files: | + isos/bios.iso + isos/uefi.iso diff --git a/Makefile b/Makefile index 02c906a..6d5ff1b 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,5 @@ +all: build lint fmt test run + build: cargo build @@ -11,4 +13,7 @@ fmt-fix: cargo fmt test: - cargo test \ No newline at end of file + cargo test + +run: + cargo run \ No newline at end of file diff --git a/README.md b/README.md index 9814c87..6a972ff 100644 --- a/README.md +++ b/README.md @@ -6,4 +6,13 @@ Memsos is a tool written in rust with the objective to check your memory in a fast way, memsos works for both uefi and bios. +## Requirements + +If using arch you need to install `qemu-system-x86` + +## Generate Images + +To generate the images we only need to run `cargo build`, they are created in `target/`. +Then we can try it with `cargo run` + ### In dev