Add GH Actions build workflow
This commit is contained in:
		
							parent
							
								
									ecec3c96e1
								
							
						
					
					
						commit
						a4a3289712
					
				|  | @ -0,0 +1,108 @@ | |||
| name: Build | ||||
| 
 | ||||
| on: | ||||
|   push: | ||||
|     branches: | ||||
|       - '*' | ||||
|   pull_request: | ||||
| 
 | ||||
| jobs: | ||||
|   test: | ||||
|     name: Test | ||||
| 
 | ||||
|     strategy: | ||||
|       matrix: | ||||
|         platform: [ | ||||
|           ubuntu-latest, | ||||
|           macos-latest, | ||||
|           windows-latest | ||||
|         ] | ||||
| 
 | ||||
|     runs-on: ${{ matrix.platform }} | ||||
|     timeout-minutes: 15 | ||||
| 
 | ||||
|     steps: | ||||
|     - name: "Checkout Repository" | ||||
|       uses: actions/checkout@v1 | ||||
| 
 | ||||
|     - name: Install Rustup (macOS) | ||||
|       run: | | ||||
|         curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y | ||||
|         echo ::add-path::$HOME/.cargo/bin | ||||
|       if: runner.os == 'macOS' | ||||
| 
 | ||||
|     - name: Set Rustup profile to minimal | ||||
|       run: rustup set profile minimal | ||||
| 
 | ||||
|     - name: "Switch to Rust nightly" | ||||
|       run: rustup default nightly | ||||
| 
 | ||||
|     - name: "Print Rust Version" | ||||
|       run: | | ||||
|         rustc -Vv | ||||
|         cargo -Vv | ||||
| 
 | ||||
|     - name: "Install Rustup Components" | ||||
|       run: rustup component add rust-src llvm-tools-preview | ||||
| 
 | ||||
|     - name: "Install build tools" | ||||
|       run: cargo install cargo-make | ||||
| 
 | ||||
|     - name: "Deny Warnings" | ||||
|       run: cargo make build | ||||
|       env: | ||||
|         RUSTFLAGS: "-D warnings" | ||||
| 
 | ||||
|     - name: Install QEMU (Linux) | ||||
|       run: | | ||||
|         sudo apt update | ||||
|         sudo apt install qemu-system-aarch64 | ||||
|       if: runner.os == 'Linux' | ||||
| 
 | ||||
|     - name: Install QEMU (macOS) | ||||
|       run: brew install qemu | ||||
|       if: runner.os == 'macOS' | ||||
|       env: | ||||
|         HOMEBREW_NO_AUTO_UPDATE: 1 | ||||
|         HOMEBREW_NO_BOTTLE_SOURCE_FALLBACK: 1 | ||||
|         HOMEBREW_NO_INSTALL_CLEANUP: 1 | ||||
| 
 | ||||
|     - name: Install Scoop (Windows) | ||||
|       run: | | ||||
|         Invoke-Expression (New-Object System.Net.WebClient).DownloadString('https://get.scoop.sh') | ||||
|         echo ::add-path::$HOME\scoop\shims | ||||
|       if: runner.os == 'Windows' | ||||
|       shell: pwsh | ||||
| 
 | ||||
|     - name: Install QEMU (Windows) | ||||
|       run: scoop install qemu | ||||
|       if: runner.os == 'Windows' | ||||
|       shell: pwsh | ||||
| 
 | ||||
|     - name: "Print QEMU Version" | ||||
|       run: qemu-system-aarch64 --version | ||||
| 
 | ||||
|     - name: 'Build kernel' | ||||
|       run: cargo make build | ||||
| 
 | ||||
|     # TODO: add tests runner | ||||
| 
 | ||||
|   check_formatting: | ||||
|     name: "Check Formatting" | ||||
|     runs-on: ubuntu-latest | ||||
|     timeout-minutes: 2 | ||||
|     steps: | ||||
|     - uses: actions/checkout@v1 | ||||
|     - run: rustup toolchain install nightly --profile minimal --component rustfmt | ||||
|     - run: cargo +nightly fmt -- --check | ||||
| 
 | ||||
|   clippy: | ||||
|     name: "Clippy" | ||||
|     runs-on: ubuntu-latest | ||||
|     timeout-minutes: 10 | ||||
|     steps: | ||||
|     - uses: actions/checkout@v1 | ||||
|     - run: rustup toolchain install nightly --profile minimal --component clippy | ||||
|     - run: rustup component add rust-src llvm-tools-preview | ||||
|     - run: cargo install cargo-make | ||||
|     - run: cargo make clippy | ||||
							
								
								
									
										6
									
								
								Justfile
								
								
								
								
							
							
						
						
									
										6
									
								
								Justfile
								
								
								
								
							|  | @ -4,7 +4,13 @@ qemu: | |||
| device: | ||||
|     cargo make sdcard | ||||
| 
 | ||||
| build: | ||||
|     # Build default hw kernel | ||||
|     cargo make build | ||||
| 
 | ||||
| clean: | ||||
|     cargo make clean | ||||
|     rm -f kernel8 kernel8.img | ||||
| 
 | ||||
| clippy: | ||||
|     cargo make clippy | ||||
|  |  | |||
|  | @ -12,6 +12,8 @@ CARGO_MAKE_EXTEND_WORKSPACE_MAKEFILE = "false" | |||
| 
 | ||||
| DEFAULT_TARGET = "aarch64-vesper-metta" | ||||
| 
 | ||||
| BUILD_STD = "-Zbuild-std=core,compiler_builtins,alloc" | ||||
| 
 | ||||
| DEVICE_FEATURES = "noserial" | ||||
| QEMU_FEATURES = "qemu" | ||||
| 
 | ||||
|  | @ -68,3 +70,7 @@ run_task = "do-on-members" | |||
| [tasks.sdeject] | ||||
| env = { "CARGO_MAKE_MEMBER_TASK" = "sdeject" } | ||||
| run_task = "do-on-members" | ||||
| 
 | ||||
| [tasks.clippy] | ||||
| env = { "CARGO_MAKE_MEMBER_TASK" = "clippy" } | ||||
| run_task = "do-on-members" | ||||
|  |  | |||
|  | @ -70,3 +70,5 @@ which are in turn based on [Raspi3 tutorials by bzt](https://github.com/bztsrc/r | |||
| Various references from [OSDev Wiki](https://wiki.osdev.org/Raspberry_Pi_Bare_Bones) and [RaspberryPi.org manuals](https://www.raspberrypi.org/app/uploads/2012/02/BCM2835-ARM-Peripherals.pdf). | ||||
| 
 | ||||
| [](https://sagiegurari.github.io/cargo-make) | ||||
| 
 | ||||
|  | ||||
|  |  | |||
|  | @ -11,12 +11,12 @@ script = [ | |||
| 
 | ||||
| [tasks.build] | ||||
| env = { "TARGET_FEATURES" = "" } | ||||
| args = ["build", "-Zbuild-std=core,compiler_builtins,alloc", "--target=${TARGET_JSON}", "--release", "--features=${TARGET_FEATURES}"] | ||||
| args = ["build", "${BUILD_STD}", "--target=${TARGET_JSON}", "--release", "--features=${TARGET_FEATURES}"] | ||||
| 
 | ||||
| [tasks.build-qemu] | ||||
| env = { "TARGET_FEATURES" = "${QEMU_FEATURES}" } | ||||
| command = "cargo" | ||||
| args = ["build", "-Zbuild-std=core,compiler_builtins,alloc", "--target=${TARGET_JSON}", "--release", "--features=${TARGET_FEATURES}"] | ||||
| args = ["build", "${BUILD_STD}", "--target=${TARGET_JSON}", "--release", "--features=${TARGET_FEATURES}"] | ||||
| 
 | ||||
| [tasks.qemu] | ||||
| dependencies = ["build-qemu", "kernel-binary"] | ||||
|  | @ -33,3 +33,7 @@ args = ["${KERNEL_BIN}", "/Volumes/BOOT/"] | |||
| dependencies = ["sdcard"] | ||||
| command = "diskutil" | ||||
| args = ["unmount", "/Volumes/BOOT/"] | ||||
| 
 | ||||
| [tasks.clippy] | ||||
| command = "cargo" | ||||
| args = ["clippy", "${BUILD_STD}", "--target=${TARGET_JSON}", "--", "-D", "warnings"] | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue