From d1bd5489681f8858f3590e388f06b3d01fe77366 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Kr=C3=B6ning?= Date: Thu, 24 Jun 2021 14:37:01 +0200 Subject: [PATCH] Rework CI --- .github/workflows/format.yml | 35 +++---- .github/workflows/kvm.yml | 44 --------- .github/workflows/kvm_test.yml | 43 +++++++++ .github/workflows/publish.yml | 61 ------------ .github/workflows/publish_docs.yml | 44 +++++++++ .github/workflows/test.yml | 147 +++++++++++------------------ bors.toml | 8 +- 7 files changed, 159 insertions(+), 223 deletions(-) delete mode 100644 .github/workflows/kvm.yml create mode 100644 .github/workflows/kvm_test.yml delete mode 100644 .github/workflows/publish.yml create mode 100644 .github/workflows/publish_docs.yml diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml index a57e6a4ce..88c7105af 100644 --- a/.github/workflows/format.yml +++ b/.github/workflows/format.yml @@ -1,36 +1,23 @@ -name: Format check +name: Format on: - pull_request: push: branches: - master - staging - trying + pull_request: + +env: + CARGO_TERM_COLOR: always jobs: - check: - name: Format check + format: + name: Format runs-on: ubuntu-latest - - strategy: - matrix: - os: [ubuntu-latest] - rust: [nightly] - include: - - os: ubuntu-latest - rust: 'nightly' - components: 'rustfmt' - targets: 'x86_64-unknown-linux-gnu' - - steps: - - uses: hecrj/setup-rust-action@v1 - with: - rust-version: ${{ matrix.rust }} - components: ${{ matrix.components || '' }} - targets: ${{ matrix.targets || '' }} - - name: Checkout - uses: actions/checkout@v2 - - name: Check Formatting + - uses: actions/checkout@v2 + - name: Rustup (apply rust-toolchain.toml) + run: rustup show + - name: Format run: cargo fmt -- --check diff --git a/.github/workflows/kvm.yml b/.github/workflows/kvm.yml deleted file mode 100644 index dffee9dcc..000000000 --- a/.github/workflows/kvm.yml +++ /dev/null @@ -1,44 +0,0 @@ -name: KVM Tests - -on: - pull_request: - push: - branches: - - master - - staging - - trying - -jobs: - kvm: - name: KVM Tests - runs-on: [self-hosted] - - steps: - - uses: hecrj/setup-rust-action@v1 - with: - rust-version: nightly - components: 'rust-src, llvm-tools-preview' - targets: 'x86_64-unknown-linux-gnu' - - uses: actions/checkout@v2.3.4 - with: - submodules: true - - name: Check Cargo availability - run: cargo --version - - name: Build (debug) - run: - cargo build -p rusty_demo - - name: Build (release) - run: - cargo build -p rusty_demo --release - - name: Check test environment - shell: bash - run: | - lscpu - kvm-ok - cargo install --git https://github.com/hermitcore/uhyve.git - - name: Test debug version - run: - RUST_LOG=debug uhyve -v -c 1 target/x86_64-unknown-hermit/release/rusty_demo - - name: Test release version - run: - RUST_LOG=debug uhyve -v -c 1 target/x86_64-unknown-hermit/release/rusty_demo diff --git a/.github/workflows/kvm_test.yml b/.github/workflows/kvm_test.yml new file mode 100644 index 000000000..b67b809a4 --- /dev/null +++ b/.github/workflows/kvm_test.yml @@ -0,0 +1,43 @@ +name: KVM Test + +on: + push: + branches: + - master + - staging + - trying + pull_request: + +env: + CARGO_TERM_COLOR: always + +jobs: + kvm_test: + name: KVM Test + runs-on: [self-hosted] + + steps: + - uses: actions/checkout@v2 + with: + submodules: true + - name: Rustup (apply rust-toolchain.toml) + run: rustup show + - name: Build dev profile + run: cargo build --package rusty_demo + - name: Install uhyve + run: cargo install uhyve --locked + - name: Check KVM availability + shell: bash + run: | + lscpu + kvm-ok + - name: Test debug version + run: uhyve --verbose --cpus 1 target/x86_64-unknown-hermit/debug/rusty_demo + env: + RUST_LOG: debug + - name: Build release profile + run: cargo build --package rusty_demo --release + - name: Test release version + run: uhyve --verbose --cpus 1 target/x86_64-unknown-hermit/release/rusty_demo + env: + RUST_LOG: debug diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml deleted file mode 100644 index 2ea416454..000000000 --- a/.github/workflows/publish.yml +++ /dev/null @@ -1,61 +0,0 @@ -name: Build docs - -on: - push: - branches: - - master - -jobs: - publish: - runs-on: ${{ matrix.os }} - - strategy: - matrix: - os: [ubuntu-latest] - rust: [nightly] - include: - - os: ubuntu-latest - rust: 'nightly' - components: 'rust-src, llvm-tools-preview' - targets: 'x86_64-unknown-linux-gnu' - - steps: - - uses: hecrj/setup-rust-action@v1 - with: - rust-version: ${{ matrix.rust }} - components: ${{ matrix.components || '' }} - targets: ${{ matrix.targets || '' }} - - uses: actions/checkout@v2 - with: - submodules: true - - name: Check Cargo availability - run: cargo --version - - name: Install nasm - run: sudo apt-get update --fix-missing && sudo apt-get install nasm - - name: Generate documentation - uses: actions-rs/cargo@v1 - with: - command: doc - args: --workspace -Z build-std=std,core,alloc,panic_abort --target x86_64-unknown-hermit - - name: Generate index.html - run: | - cat > target/x86_64-unknown-hermit/doc/index.html < - - - Redirect! - - - -

Redirect

- - - EOL - - name: Deploy documentation - if: success() - uses: crazy-max/ghaction-github-pages@v1 - with: - target_branch: gh-pages - build_dir: target/x86_64-unknown-hermit/doc - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/publish_docs.yml b/.github/workflows/publish_docs.yml new file mode 100644 index 000000000..ec5440d32 --- /dev/null +++ b/.github/workflows/publish_docs.yml @@ -0,0 +1,44 @@ +name: Publish Docs + +on: + push: + branches: + - master + +env: + CARGO_TERM_COLOR: always + +jobs: + publish_docs: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + with: + submodules: true + - name: Rustup (apply rust-toolchain.toml) + run: rustup show + - name: Generate documentation + run: cargo doc + - name: Generate index.html + run: | + cat > target/x86_64-unknown-hermit/doc/index.html < + + + Redirect! + + + +

Redirect

+ + + EOL + - name: Deploy documentation + if: success() + uses: crazy-max/ghaction-github-pages@v1 + with: + target_branch: gh-pages + build_dir: target/x86_64-unknown-hermit/doc + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 3ad872d10..371e5ed74 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,106 +1,73 @@ -name: Build and test +name: Test on: - pull_request: push: branches: - master - staging - trying - schedule: - - cron: '0 0 * * 6' + pull_request: + +env: + CARGO_TERM_COLOR: always + +defaults: + run: + shell: bash jobs: build: name: Test runs-on: ${{ matrix.os }} - # these tests based on the nightly compiler, which can be broken - # consequently, we continue on an error - #continue-on-error: true - strategy: matrix: - os: [ubuntu-latest, windows-latest, macOS-latest] - rust: [nightly] - include: - - os: macOS-latest - rust: 'nightly' - components: 'rust-src, llvm-tools-preview' - targets: 'x86_64-apple-darwin' - - os: windows-latest - rust: 'nightly' - components: 'rust-src, llvm-tools-preview' - targets: 'x86_64-pc-windows-msvc' - - os: ubuntu-latest - rust: 'nightly' - components: 'rust-src, llvm-tools-preview' - targets: 'x86_64-unknown-linux-gnu' - + os: [ubuntu-latest, macos-latest, windows-latest] steps: - - uses: hecrj/setup-rust-action@v1 - with: - rust-version: ${{ matrix.rust }} - components: ${{ matrix.components || '' }} - targets: ${{ matrix.targets || '' }} - - uses: actions/checkout@v2 - with: - submodules: true - - name: Check Cargo availability - run: cargo --version - - name: Install qemu/nasm (apt) - run: sudo apt-get update --fix-missing && sudo apt-get install qemu-system-x86 nasm - if: ${{ matrix.os == 'ubuntu-latest' }} - - name: Install qemu/nasm (macos) - run: | + - uses: actions/checkout@v2 + with: + submodules: true + - name: Rustup (apply rust-toolchain.toml) + run: rustup show + - name: Build dev profile + run: cargo build --package rusty_demo + - name: Install QEMU, NASM (ubuntu) + if: ${{ matrix.os == 'ubuntu-latest' }} + run: | + sudo apt-get update + sudo apt-get install qemu-system-x86 nasm + - name: Install QEMU, NASM (macos) + if: ${{ matrix.os == 'macos-latest' }} + run: | + brew update brew install qemu nasm - if: ${{ matrix.os == 'macOS-latest' }} - - name: Install nasm (windows) - uses: crazy-max/ghaction-chocolatey@v1 - with: - args: install nasm - if: ${{ matrix.os == 'windows-latest' }} - - name: Install qemu (windows) - uses: crazy-max/ghaction-chocolatey@v1 - with: - args: install qemu --version=2020.08.14 - if: ${{ matrix.os == 'windows-latest' }} - - name: Set path to qemu/nasm (Windows) - run: | - echo "C:\Program Files\qemu" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append - echo "C:\Program Files\nasm" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append - if: ${{ matrix.os == 'windows-latest' }} - - name: Building dev version - run: - cargo build -p rusty_demo -Z build-std=std,core,alloc,panic_abort --target x86_64-unknown-hermit - - name: Building release version - run: - cargo build -p rusty_demo -Z build-std=std,core,alloc,panic_abort --target x86_64-unknown-hermit --release - #env: - # RUSTFLAGS: -Clinker-plugin-lto - - name: Build loader (unix) - working-directory: loader - run: make - if: ${{ ( matrix.os == 'macOS-latest' ) || ( matrix.os == 'ubuntu-latest' ) }} - # Workaround since makefile doesn't work when using powershell - - name: Build loader (windows) - working-directory: loader - run: | - cargo build -Z build-std=core,alloc --target x86_64-unknown-hermit-loader.json - $VAR_RUSTC_SYSROOT = (rustc --print sysroot) - echo "Sysroot - $VAR_RUSTC_SYSROOT" - $LLVM_OBJCOPY = ((Get-ChildItem -Path $VAR_RUSTC_SYSROOT -Include llvm-objcopy.exe -File -Recurse -ErrorAction SilentlyContinue)).Fullname - echo "LLVM Objcopy - $LLVM_OBJCOPY" - Invoke-Expression "$LLVM_OBJCOPY --strip-debug -O elf32-i386 target/x86_64-unknown-hermit-loader/debug/rusty-loader" - if: ${{ matrix.os == 'windows-latest' }} - - name: Test dev version - run: - qemu-system-x86_64 -display none -smp 1 -m 64M -serial stdio -kernel loader/target/x86_64-unknown-hermit-loader/debug/rusty-loader -initrd target/x86_64-unknown-hermit/debug/rusty_demo -cpu qemu64,apic,fsgsbase,rdtscp,xsave,fxsr,rdrand - - name: Test release version - run: - qemu-system-x86_64 -display none -smp 1 -m 64M -serial stdio -kernel loader/target/x86_64-unknown-hermit-loader/debug/rusty-loader -initrd target/x86_64-unknown-hermit/release/rusty_demo -cpu qemu64,apic,fsgsbase,rdtscp,xsave,fxsr,rdrand - - name: Build httpd with DHCP support - run: - cargo build --manifest-path examples/httpd/Cargo.toml --features dhcpv4 - - name: Build httpd without DHCP support - run: - cargo build --manifest-path examples/httpd/Cargo.toml + - name: Install QEMU, NASM, GNU make (windows) + if: ${{ matrix.os == 'windows-latest' }} + run: | + choco install qemu nasm make + echo "C:\Program Files\qemu" >> $GITHUB_PATH + echo "C:\Program Files\NASM" >> $GITHUB_PATH + - name: Build loader + run: | + sed -i.old 's/OBJCOPY := $(shell find $(SYSROOT) -name llvm-objcopy)/OBJCOPY := $(shell find $(SYSROOT) -name llvm-objcopy -o -name llvm-objcopy.exe)/g' loader/Makefile + make -C loader release=1 + - name: Test dev profile + run: | + qemu-system-x86_64 -display none -smp 1 -m 128M -serial stdio \ + -cpu qemu64,apic,fsgsbase,rdtscp,xsave,fxsr,rdrand \ + -kernel loader/target/x86_64-unknown-hermit-loader/release/rusty-loader \ + -initrd target/x86_64-unknown-hermit/debug/rusty_demo + - name: Build release profile + run: + cargo build --package rusty_demo --release + - name: Test release profile + run: | + qemu-system-x86_64 -display none -smp 1 -m 128M -serial stdio \ + -cpu qemu64,apic,fsgsbase,rdtscp,xsave,fxsr,rdrand \ + -kernel loader/target/x86_64-unknown-hermit-loader/release/rusty-loader \ + -initrd target/x86_64-unknown-hermit/release/rusty_demo + - name: Build httpd with DHCP support + run: + cargo build --package httpd --features dhcpv4 + - name: Build httpd without DHCP support + run: + cargo build --package httpd diff --git a/bors.toml b/bors.toml index 423392b4c..c1fbf3d1d 100644 --- a/bors.toml +++ b/bors.toml @@ -1,8 +1,8 @@ status = [ - "Test (macOS-latest, nightly)", - "Test (windows-latest, nightly)", - "Test (ubuntu-latest, nightly)", - "Format check (ubuntu-latest, nightly)", + "Test (ubuntu-latest)", + "Test (macOS-latest)", + "Test (windows-latest)", + "Format", "Clippy", "KVM Tests", ]