From 5d1559f4753c7370188ba2a464cb0048c7d159f4 Mon Sep 17 00:00:00 2001 From: Philipp Oppermann Date: Tue, 10 Sep 2019 20:32:49 +0200 Subject: [PATCH 1/4] Build post-01 on GitHub Actions --- .github/workflows/build-code.yml | 59 ++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 .github/workflows/build-code.yml diff --git a/.github/workflows/build-code.yml b/.github/workflows/build-code.yml new file mode 100644 index 00000000..98899db4 --- /dev/null +++ b/.github/workflows/build-code.yml @@ -0,0 +1,59 @@ +name: Build Code + +on: [push, pull_request] + +jobs: + build: + name: "Build" + + strategy: + matrix: + platform: [ + ubuntu-latest, + macos-latest, + windows-latest + ] + + runs-on: ${{ matrix.platform }} + + steps: + - name: "Checkout Repository" + uses: actions/checkout@v1 + + - name: Install Rustup + run: | + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain nightly + echo ::add-path::$HOME/.cargo/bin + if: runner.os == 'macOS' + + - name: "Print Rust Version" + run: | + rustc -Vv + cargo -Vv + + - name: "Add thumbv7em-none-eabihf Target" + run: rustup target add thumbv7em-none-eabihf + + - name: "Build for thumbv7em-none-eabihf" + run: cargo build --target thumbv7em-none-eabihf + + - name: "Build for Linux" + if: runner.os == 'Linux' + run: cargo rustc -- -C link-arg=-nostartfiles + + - name: "Build for macOS" + if: runner.os == 'macOS' + run: cargo rustc -- -C link-args="-e __start -static -nostartfiles" + + - name: "Build for Windows" + if: runner.os == 'Windows' + run: cargo rustc -- -C link-args="/ENTRY:_start /SUBSYSTEM:console" + + + check_formatting: + name: "Check Formatting" + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + - run: rustup component add rustfmt + - run: cargo fmt -- --check From 398aaf578c8b6e3bbc85bac0698b25a7aba4d721 Mon Sep 17 00:00:00 2001 From: Philipp Oppermann Date: Tue, 10 Sep 2019 23:47:26 +0200 Subject: [PATCH 2/4] Rename job to `Test` --- .github/workflows/build-code.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-code.yml b/.github/workflows/build-code.yml index 98899db4..05b1f6cc 100644 --- a/.github/workflows/build-code.yml +++ b/.github/workflows/build-code.yml @@ -3,8 +3,8 @@ name: Build Code on: [push, pull_request] jobs: - build: - name: "Build" + test: + name: "Test" strategy: matrix: From 72aa3a45802711588ed086671ec33a94f9f6d087 Mon Sep 17 00:00:00 2001 From: Philipp Oppermann Date: Tue, 10 Sep 2019 23:25:47 +0200 Subject: [PATCH 3/4] Update github actions script for post-02 --- .github/workflows/build-code.yml | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/.github/workflows/build-code.yml b/.github/workflows/build-code.yml index 05b1f6cc..28e212da 100644 --- a/.github/workflows/build-code.yml +++ b/.github/workflows/build-code.yml @@ -31,23 +31,17 @@ jobs: rustc -Vv cargo -Vv - - name: "Add thumbv7em-none-eabihf Target" - run: rustup target add thumbv7em-none-eabihf + - name: "Install Rustup Components" + run: rustup component add rust-src llvm-tools-preview + - name: "Install cargo-xbuild" + run: cargo install cargo-xbuild --debug + - name: "Install bootimage" + run: cargo install bootimage --debug - - name: "Build for thumbv7em-none-eabihf" - run: cargo build --target thumbv7em-none-eabihf - - - name: "Build for Linux" - if: runner.os == 'Linux' - run: cargo rustc -- -C link-arg=-nostartfiles - - - name: "Build for macOS" - if: runner.os == 'macOS' - run: cargo rustc -- -C link-args="-e __start -static -nostartfiles" - - - name: "Build for Windows" - if: runner.os == 'Windows' - run: cargo rustc -- -C link-args="/ENTRY:_start /SUBSYSTEM:console" + - name: "Run cargo xbuild" + run: cargo xbuild + - name: "Create Bootimage" + run: cargo bootimage check_formatting: From 210af19293b91e34515d9dbeca1bebc17ce6c4b9 Mon Sep 17 00:00:00 2001 From: Philipp Oppermann Date: Wed, 11 Sep 2019 09:49:32 +0200 Subject: [PATCH 4/4] Github Actions: Install QEMU and run cargo xtest --- .github/workflows/build-code.yml | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/.github/workflows/build-code.yml b/.github/workflows/build-code.yml index 28e212da..d6da5377 100644 --- a/.github/workflows/build-code.yml +++ b/.github/workflows/build-code.yml @@ -43,6 +43,32 @@ jobs: - name: "Create Bootimage" run: cargo bootimage + # install QEMU + - name: Install QEMU (Linux) + run: sudo apt update && sudo apt install qemu-system-x86 + 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-x86_64 --version + + - name: "Run cargo xtest" + run: cargo xtest check_formatting: name: "Check Formatting"