Skip to content

Windowsでのテスト, CIが通るよう修正 #25

Windowsでのテスト, CIが通るよう修正

Windowsでのテスト, CIが通るよう修正 #25

Workflow file for this run

name: Linux Test
on:
push:
branches: [ master, main ]
pull_request:
branches: [ master, main ]
jobs:
# ──────────────────────────────
# 1. x86_64 と i686 用ジョブ
# ──────────────────────────────
cross:
name: Test on Linux (x86_64 & i686)
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- target_arch: x86_64-unknown-linux-gnu
needs_multilib: false
- target_arch: i686-unknown-linux-gnu
needs_multilib: true
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive
- name: Install build tools and cross-compilers
run: |
sudo apt-get update -qq
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y \
build-essential cmake git wget clang pkg-config
if [ "${{ matrix.needs_multilib }}" = "true" ]; then
sudo apt-get install -y gcc-multilib g++-multilib
fi
shell: bash
- name: Install target libraries and configure pkg-config
run: |
TARGET="${{ matrix.target_arch }}"
if [ "$TARGET" = "x86_64-unknown-linux-gnu" ]; then
sudo apt-get install -y libpcsclite-dev libdvbv5-dev libudev-dev
else
sudo dpkg --add-architecture i386
sudo apt-get update -qq
sudo apt-get install -y \
libpcsclite-dev:i386 libdvbv5-dev:i386 libudev-dev:i386
# Configure pkg-config for cross-compilation
echo "PKG_CONFIG_SYSROOT_DIR_$TARGET=/" >> $GITHUB_ENV
echo "PKG_CONFIG_LIBDIR_$TARGET=/usr/lib/i386-linux-gnu/pkgconfig" >> $GITHUB_ENV
echo "PKG_CONFIG_PATH_$TARGET=" >> $GITHUB_ENV
fi
shell: bash
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
target: ${{ matrix.target_arch }}
override: true
default: true
- name: Cargo Check & Test
run: |
cargo check -F dvb --target ${{ matrix.target_arch }}
cargo test -F dvb --target ${{ matrix.target_arch }}
shell: bash
# ──────────────────────────────
# 2. aarch64 用ジョブ(QEMU → docker run)
# ──────────────────────────────
aarch64:
name: Test on Linux (ARM64 via Docker+QEMU)
runs-on: ubuntu-latest
needs: cross
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive
# 1) ホスト上に QEMU の binfmt_misc 登録
- name: Set up QEMU emulation
uses: docker/setup-qemu-action@v3
with:
platforms: linux/arm64
# 2) ARM64 コンテナ内でビルド
- name: Run build inside ARM64 container
run: |
docker run --rm --privileged \
--platform linux/arm64 \
-v "${{ github.workspace }}:/work" \
-w /work \
ubuntu:22.04 \
bash -lc "\
apt-get update -qq && \
DEBIAN_FRONTEND=noninteractive apt-get install -y \
build-essential cmake git wget clang pkg-config \
libpcsclite-dev libdvbv5-dev libudev-dev gcc-aarch64-linux-gnu && \
curl https://sh.rustup.rs -sSf | sh -s -- -y && \
source \$HOME/.cargo/env && \
rustup target add aarch64-unknown-linux-gnu && \
echo 'PKG_CONFIG_SYSROOT_DIR=/;PKG_CONFIG_LIBDIR=/usr/lib/aarch64-linux-gnu/pkgconfig;PKG_CONFIG_PATH=' | tee /etc/environment && \
cargo check -F dvb --target aarch64-unknown-linux-gnu && \
cargo test -F dvb --target aarch64-unknown-linux-gnu \
"
shell: bash