Skip to content

Commit

Permalink
Add Windows compilation target
Browse files Browse the repository at this point in the history
Previously, the ci steps were skipped for the Windows compilation
target. This new approach runs the ci steps on a Windows machine.
This is suboptimal for multiple reasons:
* the `ci` script does not work on a machine. Thus, calls to the script
  are removed by this change.
* our local workflow involves cross-compilation, and thus it is
  slightly different from github workflow
* the release builds are currently built via cross-compilation
The reason we can't use `ubuntu-latest` as a build machine is that the
`cargo test` requires an interpreter for a `.exe` file.
  • Loading branch information
SoloJacobs committed Nov 7, 2023
1 parent 2531d30 commit f942086
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 38 deletions.
50 changes: 19 additions & 31 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,41 +3,29 @@ name: CI
on: [push, pull_request]

jobs:
linux:
runs-on: ubuntu-latest

ci:
runs-on: ${{ matrix.type.os }}
name: ${{ matrix.type.target }} (${{ matrix.type.os }})
strategy:
matrix:
include:
- name: Rust formatting
step: cargo-fmt-check
- name: Rust linting
step: cargo-clippy
- name: Rust tests
step: cargo-test

type:
- { os: windows-latest, target: x86_64-pc-windows-gnu }
- { os: ubuntu-latest, target: x86_64-unknown-linux-gnu }
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup environment
run: ./setup
- name: Checkout repository
uses: actions/checkout@v4

- name: ${{ matrix.name }}
env:
STEP: ${{ matrix.step }}
run: ./ci "${STEP}"
- name: "Setup Rust"
uses: actions-rust-lang/[email protected]
with:
components: rustfmt, clippy
target: ${{ matrix.type.target }}

check_success:
if: always()
- run: cargo fmt -- --check
working-directory: ${{ github.workspace }}/v2/robotmk/

needs:
- linux
- run: cargo test --all-targets --target ${{ matrix.type.target }}
working-directory: ${{ github.workspace }}/v2/robotmk/

runs-on: ubuntu-latest

steps:
- name: Decide whether the needed jobs succeeded or failed
uses: re-actors/alls-green@release/v1
with:
jobs: ${{ toJSON(needs) }}
- run: cargo clippy --all-targets --target ${{ matrix.type.target }} -- --deny warnings
working-directory: ${{ github.workspace }}/v2/robotmk/
5 changes: 3 additions & 2 deletions ci
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ main() {
self="${topdir}/ci"
cargo_toml_path="${topdir}/v2/robotmk/Cargo.toml"
mode="${1}"
target="${2:-x86_64-unknown-linux-gnu}"
shift

case "${mode}" in
Expand All @@ -13,11 +14,11 @@ main() {
;;

'cargo-clippy')
cargo clippy --manifest-path "${cargo_toml_path}" --all-targets -- --deny warnings
cargo clippy --manifest-path "${cargo_toml_path}" --all-targets --target "${target}" -- --deny warnings
;;

'cargo-test')
cargo test --manifest-path "${cargo_toml_path}" --all-targets
cargo test --manifest-path "${cargo_toml_path}" --all-targets --target "${target}"
;;

'check-all')
Expand Down
5 changes: 0 additions & 5 deletions setup
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,7 @@
set -e

main() {
setup_rust
git config core.hooksPath .githooks
}

setup_rust() {
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s - -y
}

main

0 comments on commit f942086

Please sign in to comment.