Merge pull request #15 from oldrev/dependabot/cargo/syn-2.0.79 #426
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CICD | |
on: | |
push: | |
branches: | |
- master | |
- dev | |
paths: | |
- '.github/workflows/**' | |
- 'src/**' | |
- 'tests/**' | |
- 'crates/**' | |
- 'node-plugins/**' | |
- '*.rs' | |
- '*.toml' | |
- '*.ini' | |
- '*.lock' | |
pull_request: | |
branches: | |
- master | |
paths: | |
- '.github/workflows/**' | |
- 'src/**' | |
- 'tests/**' | |
- 'crates/**' | |
- 'node-plugins/**' | |
- '*.rs' | |
- '*.toml' | |
- '*.ini' | |
- '*.lock' | |
permissions: | |
contents: read | |
env: | |
RUSTFLAGS: -Dwarnings | |
jobs: | |
build-and-test-windows: | |
name: Build and Test on Windows | |
runs-on: windows-latest | |
strategy: | |
matrix: | |
target: [x86_64-pc-windows-msvc, x86_64-pc-windows-gnu] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.12' | |
cache: 'pip' | |
- name: Install Python dependencies | |
run: pip install -r ./tests/requirements.txt | |
- name: Setup msys2 toolchains | |
if: endsWith(matrix.target, '-gnu') | |
uses: msys2/setup-msys2@v2 | |
with: | |
release: false | |
install: mingw-w64-x86_64-gcc mingw-w64-i686-gcc | |
- name: Prepare env for windows | |
if: endsWith(matrix.target, '-gnu') | |
run: | | |
# Add symlinks to the target-specific GNU sysroots for Clang | |
New-Item -Path "C:\Program Files\LLVM\x86_64-w64-mingw32" -ItemType SymbolicLink -Value "C:\msys64\mingw64\x86_64-w64-mingw32" | |
New-Item -Path "C:\Program Files\LLVM\i686-w64-mingw32" -ItemType SymbolicLink -Value "C:\msys64\mingw64\i686-w64-mingw32" | |
# Add paths to GCC executables to PATH | |
echo "C:\msys64\mingw64\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append | |
echo "C:\msys64\mingw32\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append | |
# Configure CC_<target> environment variables | |
echo "CC_x86_64_pc_windows_gnu=x86_64-w64-mingw32-gcc" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append | |
echo "CC_i686_pc_windows_gnu=i686-w64-mingw32-gcc" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append | |
# echo "HOST_CC=x86_64-w64-mingw32-gcc" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append | |
- name: Set up Rust toolchain | |
uses: actions-rust-lang/setup-rust-toolchain@v1 | |
with: | |
target: ${{ matrix.target }} | |
components: llvm-tools-preview | |
- name: Cache Rust dependencies | |
uses: actions/cache@v4 | |
with: | |
path: ~/.cargo/registry | |
key: ${{ runner.os }}-cargo-${{ hashFiles('Cargo.lock') }} | |
restore-keys: | | |
${{ runner.os }}-cargo- | |
- name: Build | |
run: cargo build --profile ci --workspace --target ${{ matrix.target }} --features full | |
- name: Run Rust tests | |
run: cargo test run --workspace --no-fail-fast --features full --target ${{ matrix.target }} --profile ci | |
build-and-test-linux: | |
name: Build and Test on Linux (x86-64) | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
target: [x86_64-unknown-linux-gnu] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.12' | |
cache: 'pip' | |
- name: Install Python dependencies | |
run: pip install -r ./tests/requirements.txt | |
- name: Set up Rust toolchain | |
uses: actions-rust-lang/setup-rust-toolchain@v1 | |
with: | |
target: ${{ matrix.target }} | |
components: llvm-tools-preview | |
- name: Cache Rust dependencies | |
uses: actions/cache@v4 | |
with: | |
path: ~/.cargo/registry | |
key: ${{ runner.os }}-cargo-${{ hashFiles('Cargo.lock') }} | |
restore-keys: | | |
${{ runner.os }}-cargo- | |
- name: Build | |
run: cargo build --profile ci --workspace --target ${{ matrix.target }} --features full | |
env: | |
PYTHON_SYS_EXECUTABLE: ${{ env.PYTHON_SYS_EXECUTABLE }} | |
- name: Run Rust tests | |
run: cargo test run --workspace --no-fail-fast --features full --target ${{ matrix.target }} --profile ci | |
- name: Run Python tests | |
env: | |
EDGELINK_BUILD_TARGET: ${{ matrix.target }} | |
EDGELINK_BUILD_PROFILE: ci | |
run: pytest ./tests -v | |
build-and-test-on-arm-linux: | |
name: Build and Test on ARM Linux | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
target: [aarch64-unknown-linux-gnu, armv7-unknown-linux-gnueabihf, armv7-unknown-linux-gnueabi] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up Rust toolchain | |
uses: actions-rust-lang/setup-rust-toolchain@v1 | |
with: | |
target: ${{ matrix.target }} | |
components: llvm-tools-preview | |
- name: Cache Rust dependencies | |
uses: actions/cache@v4 | |
with: | |
path: ~/.cargo/registry | |
key: ${{ runner.os }}-cargo-${{ hashFiles('Cargo.lock') }} | |
restore-keys: | | |
${{ runner.os }}-cargo- | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.12' | |
cache: 'pip' | |
- name: Install Python dependencies | |
run: pip install -r ./tests/requirements.txt | |
- name: Install dependencies | |
run: sudo apt-get -y install qemu-user qemu-user-static | |
- name: Install cross-compilation tools for ARM 64 | |
if: matrix.target == 'aarch64-unknown-linux-gnu' | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y gcc-aarch64-linux-gnu libc-dev-arm64-cross | |
echo "EDGELINK_TOOLCHAIN_TRIPLE=aarch64-linux-gnu" >> $GITHUB_ENV | |
echo "EDGELINK_QEMU_CMD=qemu-aarch64-static" >> $GITHUB_ENV | |
- name: Install cross-compilation tools for ARM 32 (gnueabihf) | |
if: matrix.target == 'armv7-unknown-linux-gnueabihf' | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y gcc-arm-linux-gnueabihf libc-dev-armhf-cross | |
echo "EDGELINK_TOOLCHAIN_TRIPLE=arm-linux-gnueabihf" >> $GITHUB_ENV | |
echo "EDGELINK_QEMU_CMD=qemu-arm-static" >> $GITHUB_ENV | |
- name: Install cross-compilation tools for ARM 32 (gnueabi) | |
if: matrix.target == 'armv7-unknown-linux-gnueabi' | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y gcc-arm-linux-gnueabi libc-dev-armel-cross | |
echo "EDGELINK_TOOLCHAIN_TRIPLE=arm-linux-gnueabi" >> $GITHUB_ENV | |
echo "EDGELINK_QEMU_CMD=qemu-arm-static" >> $GITHUB_ENV | |
- name: Build | |
run: cargo build --profile ci --workspace --target ${{ matrix.target }} --features full --exclude edgelink-pymod | |
- name: Build tests without running | |
run: cargo test --profile ci --target ${{ matrix.target }} --features full --exclude edgelink-pymod --no-run --message-format=json | tee ./target/${{ matrix.target }}/ci/cargo-build-test.json | |
- name: Run unit tests in QEMU ARM | |
run: python3 ./scripts/cross-unittest.py ${{ env.EDGELINK_QEMU_CMD }} ${{ env.EDGELINK_TOOLCHAIN_TRIPLE }} ./target/${{ matrix.target }}/ci/cargo-build-test.json | |
env: | |
EDGELINK_TOOLCHAIN_TRIPLE: ${{ env.EDGELINK_TOOLCHAIN_TRIPLE }} | |
EDGELINK_QEMU_CMD: ${{ env.EDGELINK_QEMU_CMD }} | |
fmt: | |
name: Format checking | |
runs-on: ubuntu-latest | |
if: github.event_name != 'pull_request' | |
timeout-minutes: 45 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Rust toolchain | |
uses: actions-rust-lang/setup-rust-toolchain@v1 | |
with: | |
target: x86_64-unknown-linux-gnu | |
components: rustfmt | |
- name: Cache Rust dependencies | |
uses: actions/cache@v4 | |
with: | |
path: ~/.cargo/registry | |
key: ${{ runner.os }}-cargo-${{ hashFiles('Cargo.lock') }} | |
restore-keys: | | |
${{ runner.os }}-cargo- | |
- name: Check code formatting | |
run: cargo fmt --check --all | |
clippy: | |
name: Format and Clippy | |
runs-on: ubuntu-latest | |
if: github.event_name != 'pull_request' | |
timeout-minutes: 45 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Rust toolchain | |
uses: actions-rust-lang/setup-rust-toolchain@v1 | |
with: | |
target: x86_64-unknown-linux-gnu | |
components: clippy | |
- name: Cache Rust dependencies | |
uses: actions/cache@v4 | |
with: | |
path: ~/.cargo/registry | |
key: ${{ runner.os }}-cargo-${{ hashFiles('Cargo.lock') }} | |
restore-keys: | | |
${{ runner.os }}-cargo- | |
- name: Clippy | |
run: cargo clippy --all-features --tests --all |