From 1c7d4b81162060d9574f48c147a2f5fe63622a10 Mon Sep 17 00:00:00 2001 From: Alexander Koz Date: Thu, 17 Mar 2022 21:33:10 +0400 Subject: [PATCH] CI: refactor gh-workflow; add intregration test --- .github/workflows/rust.yml | 44 ------------ .github/workflows/tests.yml | 135 ++++++++++++++++++++++++++++++++++++ 2 files changed, 135 insertions(+), 44 deletions(-) delete mode 100644 .github/workflows/rust.yml create mode 100644 .github/workflows/tests.yml diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml deleted file mode 100644 index b20f1e1..0000000 --- a/.github/workflows/rust.yml +++ /dev/null @@ -1,44 +0,0 @@ -name: Rust - -on: - push: - branches: [ main ] - pull_request: - branches: [ main ] - -env: - CARGO_TERM_COLOR: always - -jobs: - build_windows: - - runs-on: windows-latest - - steps: - - uses: actions/checkout@v2 - - name: Build Windows - run: cargo build --verbose - - name: Run tests - run: cargo test --verbose - - build_mac: - - runs-on: macos-latest - - steps: - - uses: actions/checkout@v2 - - name: Build Mac - run: cargo build --verbose - - name: Run tests - run: cargo test --verbose - - build_linux: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - name: Build Linux - run: cargo build --verbose - - name: Run tests - run: cargo test --verbose diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..ea8d095 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,135 @@ +name: Tests +on: + pull_request: + push: + branches: [main, master] + +env: + RUSTUP_MAX_RETRIES: 10 + CARGO_INCREMENTAL: 1 + CARGO_NET_RETRY: 10 + CARGO_TERM_COLOR: always + +jobs: + build: + defaults: + run: + shell: bash + + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: + - macos-latest + - ubuntu-latest + - windows-latest + + steps: + - uses: actions/checkout@v2 + + - name: Tests + run: cargo test --verbose + + format: + defaults: + run: + shell: bash + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Install Rust toolchain + uses: actions-rs/toolchain@v1 + with: + profile: minimal + components: rustfmt + + - name: Check + run: cargo fmt -- --check + + integration: + defaults: + run: + shell: bash + + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + # https://download.panic.com/playdate_sdk/PlaydateSDK-latest.pkg + # https://download-keycdn.panic.com/playdate_sdk/PlaydateSDK-#{version}.pkg + os: + - macos-latest + - ubuntu-latest + # - windows-latest + sdk: + - latest + + steps: + - uses: actions/checkout@v2 + - name: Install Rust toolchain + uses: actions-rs/toolchain@v1 + with: + toolchain: nightly + components: rust-src + target: thumbv7em-none-eabihf + profile: minimal + override: true + + - name: Install + run: cargo install --path . --force + + - name: Checkout Crankstart + uses: actions/checkout@v3 + with: + repository: rtsuk/crankstart + path: crankstart + + - name: install SDK (macos) + if: ${{ matrix.os == 'macos-latest' }} + run: | + curl -L --silent --show-error --fail "https://download.panic.com/playdate_sdk/PlaydateSDK-${{ matrix.sdk }}.pkg" -o sdk.pkg + sudo installer -store -pkg "sdk.pkg" -target / + cat ~/.Playdate/config + + - name: install SDK (linux) + if: ${{ matrix.os == 'ubuntu-latest' }} + run: | + curl -L --silent --show-error --fail "https://download.panic.com/playdate_sdk/Linux/PlaydateSDK-${{ matrix.sdk }}.tar.gz" -o sdk.tar.gz + mkdir sdk + tar -zxf sdk.tar.gz -C sdk + cd sdk/*/ + sudo ./setup.sh || true + echo "PLAYDATE_SDK_PATH=$PWD" >> $GITHUB_ENV + echo "$PWD/bin" >> $GITHUB_PATH + # echo "$PLAYDATE_SDK_PATH" > "$HOME/.Playdate/config" + + - name: install SDK (windows) + if: ${{ matrix.os == 'windows-latest' }} + run: | + curl -L --silent --show-error --fail "https://download.panic.com/playdate_sdk/Windows/PlaydateSDK-${{ matrix.sdk }}.exe" -o sdk.exe + # TODO: install sdk.exe + ./sdk.exe --quiet + + - name: info + run: | + which pdc + pdc --version + + # temp, remove when #8 merged + - run: cargo install cargo-xbuild + + - name: Build Examples + env: + RUST_LOG: trace + run: | + cd crankstart + # build projects without graphical dependencies: + # hello world + crank build --release --example=hello_world + crank build --release --example=hello_world --device + # life game + crank build --release --example=life + crank build --release --example=life --device