Skip to content

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

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

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

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
pkgconfig_triple: x86_64-linux-gnu
- target_arch: i686-unknown-linux-gnu
needs_multilib: true
pkgconfig_triple: i386-linux-gnu
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: |
if [ "${{ matrix.needs_multilib }}" = "true" ]; then
sudo dpkg --add-architecture i386
sudo apt-get update -qq
sudo apt-get install -y \
pkg-config:i386 \
libpcsclite-dev:i386 \
libdvbv5-dev:i386 \
libudev-dev:i386
else
sudo apt-get install -y \
libpcsclite-dev \
libdvbv5-dev \
libudev-dev
fi
# Set PKG_CONFIG_PATH dynamically based on architecture triple
export PKG_CONFIG_PATH="/usr/lib/${{ matrix.pkgconfig_triple }}/pkgconfig"
echo "PKG_CONFIG_PATH=$PKG_CONFIG_PATH" >> $GITHUB_ENV
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: |
export PKG_CONFIG_ALLOW_SYSTEM_LIBS=1
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
- name: Set up QEMU emulation
uses: docker/setup-qemu-action@v3
with:
platforms: linux/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 && \
export PKG_CONFIG_PATH=$(pkg-config --variable pc_path pkg-config | tr ":" "\n" | grep aarch64 || echo /usr/lib/aarch64-linux-gnu/pkgconfig) && \
echo "PKG_CONFIG_PATH=$PKG_CONFIG_PATH" >> /etc/environment && \
curl https://sh.rustup.rs -sSf | sh -s -- -y && \
source $HOME/.cargo/env && \
rustup target add aarch64-unknown-linux-gnu && \
cargo check -F dvb --target aarch64-unknown-linux-gnu && \
cargo test -F dvb --target aarch64-unknown-linux-gnu
'
shell: bash