Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set Up The Build System and CI and CDs for easy development. #9

Merged
merged 3 commits into from
May 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/dockerBuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ on:
branches:
- "*"
pull_request:
branches: [ "master" ]
branches: ["master"]
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build the Docker image
run: docker build . --file Dockerfile --tag anotheros:$(date +%s)
- uses: actions/checkout@v4
- name: Build the Docker image
run: docker build . --file Dockerfile --tag anotheros:$(date +%s)
9 changes: 4 additions & 5 deletions .github/workflows/dockerPublish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ name: Docker Image CD

on:
schedule:
- cron: '43 11 * * *'
- cron: "43 11 * * *"
push:
branches: [ "master"]
branches: ["master"]
# Publish semver tags as releases.
tags: [ 'v*.*.*' ]
tags: ["v*.*.*"]
pull_request:
branches: [ "master" ]
branches: ["master"]
workflow_dispatch:

env:
Expand All @@ -22,7 +22,6 @@ env:
# github.repository as <account>/<repo>
IMAGE_NAME: ${{ github.repository }}


jobs:
build:
runs-on: ubuntu-latest
Expand Down
31 changes: 20 additions & 11 deletions .github/workflows/rustBuildCI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,26 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Checkout repository
uses: actions/checkout@v4

- name: Install Rust
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile complete --default-toolchain stable
- name: Install Rust
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile complete --default-toolchain stable

- name: Setup env
run: . "$HOME/.cargo/env"
- name: Setup System
run: sudo apt update && sudo apt install gcc clang qemu-utils qemu-system-x86 qemu-system-gui cmake make -y
- name: Setup env
run: . "$HOME/.cargo/env"
- name: Setup System
run: sudo apt update && sudo apt install gcc clang qemu-utils qemu-system-x86 qemu-system-gui cmake make -y

- name: Build with Cargo
run: rustup override set nightly && rustup target add x86_64-unknown-none && rustup component add rust-src && rustup component add llvm-tools && cargo build
- name: Build with Cargo
run: rustup override set nightly && rustup target add x86_64-unknown-none && rustup component add rust-src && rustup component add llvm-tools && cargo build

- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: build-artifact
path: .
retention-days: 90
if-no-files-found: error
compression-level: 0
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
uefi.img
bios.img
xauth.txt
7 changes: 7 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@ fn main() {
let bios_path = out_dir.join("bios.img");
bootloader::BiosBoot::new(&kernel).create_disk_image(&bios_path).unwrap();

// create local disk images for testing
let current_dir = std::env::current_dir().unwrap();
let local_uefi_path = current_dir.join("uefi.img");
bootloader::UefiBoot::new(&kernel).create_disk_image(&local_uefi_path).unwrap();
let local_bios_path = current_dir.join("bios.img");
bootloader::BiosBoot::new(&kernel).create_disk_image(&local_bios_path).unwrap();

// pass the disk image paths as env variables to the `main.rs`
println!("cargo:rustc-env=UEFI_PATH={}", uefi_path.display());
println!("cargo:rustc-env=BIOS_PATH={}", bios_path.display());
Expand Down