Skip to content

Commit

Permalink
Merge pull request #238 from boozook/dev/refactoring/tools
Browse files Browse the repository at this point in the history
Tools refactoring
  • Loading branch information
boozook authored Apr 1, 2024
2 parents 815afcd + c5977be commit 242a336
Show file tree
Hide file tree
Showing 77 changed files with 7,292 additions and 2,750 deletions.
135 changes: 135 additions & 0 deletions .github/workflows/dev-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
name: Dev
on:
workflow_dispatch:
inputs:
source:
description: "Source ref used to build bindings. Uses `github.ref`` by default."
required: false
sha:
description: "Source SHA used to build bindings. Uses `github.sha`` by default."
required: false
push:
branches: [dev/**, refactor/**]

env:
CARGO_NET_RETRY: 10
RUSTUP_MAX_RETRIES: 10
CARGO_TERM_COLOR: always
CARGO_TERM_PROGRESS_WHEN: never
CARGO_INCREMENTAL: 1
# logging:
RUST_LOG: trace
CARGO_PLAYDATE_LOG: trace

jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- macos-14
# - macos-latest
- ubuntu-latest
- windows-latest
defaults:
run:
shell: bash

steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.source || github.ref || github.event.ref }}

- name: Cache
uses: actions/[email protected]
with:
path: |
target/
~/.cargo
key: ${{ runner.os }}-dev-build-${{ hashFiles('Cargo.lock') }}

- name: Config
run: |
mkdir -p .cargo
cp -rf .github/config.toml .cargo/config.toml
- name: Cache LLVM
id: cache-llvm
if: runner.os == 'Windows'
uses: actions/[email protected]
with:
path: ${{ runner.temp }}/llvm
key: llvm-14.0

# See:
# https://github.com/rust-lang/rust-bindgen/issues/1797
# https://rust-lang.github.io/rust-bindgen/requirements.html#windows
- name: Install LLVM
if: runner.os == 'Windows'
uses: KyleMayes/[email protected]
with:
version: "14.0"
directory: ${{ runner.temp }}/llvm
cached: ${{ steps.cache-llvm.outputs.cache-hit }}
env: true


- name: Install linux deps
if: runner.os == 'Linux'
run: |
sudo apt install pkg-config -y
sudo apt install libudev-dev -y
- name: cargo
continue-on-error: true
run: cargo build --bin=cargo-playdate
- name: Upload
uses: actions/upload-artifact@v4
with:
name: cargo-playdate-${{ runner.os }}-${{ runner.arch }}${{ ((runner.os == 'Windows') && '.exe') || ' ' }}
path: target/debug/cargo-playdate${{ ((runner.os == 'Windows') && '.exe') || ' ' }}
if-no-files-found: warn
retention-days: 3
overwrite: true


- name: pdtool
continue-on-error: true
run: cargo build -p=playdate-tool --bin=pdtool

- name: Upload
id: upload
uses: actions/upload-artifact@v4
with:
name: pdtool-${{ runner.os }}-${{ runner.arch }}${{ ((runner.os == 'Windows') && '.exe') || ' ' }}
path: target/debug/pdtool${{ ((runner.os == 'Windows') && '.exe') || ' ' }}
if-no-files-found: warn
retention-days: 3
overwrite: true
- name: Artifact
run: |
echo 'ID: ${{ steps.upload.outputs.artifact-id }}'
echo 'URL: ${{ steps.upload.outputs.artifact-url }}'
- name: pdtool with tracing
continue-on-error: true
run: cargo build -p=playdate-tool --bin=pdtool --features=tracing

- name: Upload
uses: actions/upload-artifact@v4
with:
name: pdtool+tracing-${{ runner.os }}-${{ runner.arch }}${{ ((runner.os == 'Windows') && '.exe') || ' ' }}
path: target/debug/pdtool${{ ((runner.os == 'Windows') && '.exe') || ' ' }}
if-no-files-found: warn
retention-days: 3
overwrite: true
- name: Artifact
run: |
echo 'ID: ${{ steps.upload.outputs.artifact-id }}'
echo 'URL: ${{ steps.upload.outputs.artifact-url }}'
outputs:
artifact-id: ${{ steps.upload.outputs.artifact-id }}
artifact-url: ${{ steps.upload.outputs.artifact-url }}
68 changes: 50 additions & 18 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ jobs:
fail-fast: false
matrix:
os:
- macos-latest
- macos-14
# - macos-latest
- ubuntu-latest
# - windows-latest
sdk:
Expand All @@ -55,6 +56,7 @@ jobs:
- 2.4.0

steps:
- run: arch
- uses: actions/checkout@v4

- name: Cache
Expand All @@ -63,7 +65,7 @@ jobs:
path: |
target/
~/.cargo
key: ${{ runner.os }}-cargo-tests-${{ hashFiles('Cargo.lock') }}
key: ${{ runner.os }}-${{ runner.arch }}-cargo-${{ hashFiles('Cargo.lock') }}

- name: Config
run: |
Expand Down Expand Up @@ -97,6 +99,14 @@ jobs:
version: ${{ matrix.sdk }}
custom-url: ${{ matrix.sdk == 'beta' && ((runner.os == 'macOS' && secrets.SDK_BETA_MACOS) || (runner.os == 'Linux' && secrets.SDK_BETA_LINUX) || (runner.os == 'Windows' && secrets.SDK_BETA_WINDOWS)) || '' }}


- name: Install linux deps
if: runner.os == 'Linux'
run: |
sudo apt install pkg-config -y
sudo apt install libudev-dev -y
- name: SDK ${{ steps.sdk.outputs.version }} installed
run: which pdc && pdc --version

Expand Down Expand Up @@ -164,9 +174,10 @@ jobs:
fail-fast: false
matrix:
os:
- macos-latest
- macos-14
# - macos-latest
- ubuntu-latest
# - windows-latest
- windows-latest
sdk:
- latest

Expand All @@ -179,27 +190,33 @@ jobs:
path: |
target/
~/.cargo
key: ${{ runner.os }}-cargo-tests-${{ hashFiles('Cargo.lock') }}
key: ${{ runner.os }}-${{ runner.arch }}-cargo-${{ hashFiles('Cargo.lock') }}

- name: Config
run: |
mkdir -p .cargo
cp -rf .github/config.toml .cargo/config.toml
- name: Install Deps
if: runner.os == 'Windows'
run: |
# mingw-w64-x86_64-libusb
choco install pkgconfiglite
pkg-config --cflags --libs libusb-1.0
pkg-config --cflags --libs libusb
# - name: Install Deps
# if: runner.os == 'Windows'
# run: |
# # mingw-w64-x86_64-libusb
# choco install pkgconfiglite
# pkg-config --cflags --libs libusb-1.0
# pkg-config --cflags --libs libusb

- name: Install Playdate SDK ${{ matrix.sdk }}
id: sdk
uses: pd-rs/get-playdate-sdk@main
with:
version: ${{ matrix.sdk }}

- name: Install linux deps
if: runner.os == 'Linux'
run: |
sudo apt install pkg-config -y
sudo apt install libudev-dev -y
- name: SDK ${{ steps.sdk.outputs.version }} installed
run: which pdc && pdc --version

Expand All @@ -220,7 +237,8 @@ jobs:
fail-fast: false
matrix:
os:
- macos-latest
- macos-14
# - macos-latest
- ubuntu-latest
# - windows-latest
sdk:
Expand All @@ -237,7 +255,7 @@ jobs:
path: |
target/
~/.cargo
key: ${{ runner.os }}-cargo-tests-${{ hashFiles('Cargo.lock') }}
key: ${{ runner.os }}-${{ runner.arch }}-cargo-${{ hashFiles('Cargo.lock') }}

- name: Config
run: |
Expand Down Expand Up @@ -272,6 +290,12 @@ jobs:
pkg-config --cflags --libs libusb-1.0
pkg-config --cflags --libs libusb
- name: Install linux deps
if: runner.os == 'Linux'
run: |
sudo apt install pkg-config -y
sudo apt install libudev-dev -y
- name: Install Playdate SDK ${{ matrix.sdk }}
id: sdk
uses: pd-rs/get-playdate-sdk@main
Expand Down Expand Up @@ -318,7 +342,8 @@ jobs:
fail-fast: false
matrix:
os:
- macos-latest
- macos-14
# - macos-latest
- ubuntu-latest
# - windows-latest
sdk:
Expand All @@ -334,10 +359,10 @@ jobs:
with:
path: |
~/.cargo
key: ${{ runner.os }}-cargo-tests-examples-${{ hashFiles('Cargo.lock') }}
key: ${{ runner.os }}-${{ runner.arch }}-cargo-examples-${{ hashFiles('Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-tests-examples-${{ hashFiles('Cargo.lock') }}
${{ runner.os }}-cargo-tests-${{ hashFiles('Cargo.lock') }}
${{ runner.os }}-${{ runner.arch }}-cargo-examples-${{ hashFiles('Cargo.lock') }}
${{ runner.os }}-${{ runner.arch }}-cargo-${{ hashFiles('Cargo.lock') }}
- name: Config
run: |
Expand Down Expand Up @@ -374,6 +399,13 @@ jobs:
version: ${{ matrix.sdk }}
custom-url: ${{ matrix.sdk == 'beta' && ((runner.os == 'macOS' && secrets.SDK_BETA_MACOS) || (runner.os == 'Linux' && secrets.SDK_BETA_LINUX) || (runner.os == 'Windows' && secrets.SDK_BETA_WINDOWS)) || '' }}

- name: Install linux deps
if: runner.os == 'Linux'
run: |
sudo apt install pkg-config -y
sudo apt install libudev-dev -y
- name: SDK ${{ steps.sdk.outputs.version }} installed
run: which pdc && pdc --version

Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,8 @@ jobs:
fail-fast: true
matrix:
os:
- macos-latest
- macos-14
# - macos-latest
- ubuntu-latest
# - windows-latest
sdk:
Expand Down
Loading

0 comments on commit 242a336

Please sign in to comment.