# Objective - Example execution on linux/vulkan on CI is segfaulting for unclear reasons - This makes a lot of noise on PRs ## Solution - Switch example execution on Linux to validation jobs (on PR merged). It will still crash but not block merging, and we'll know when it's fixed - Switch example execution on Windows to CI jobs (on PR push). It's a bit longer than on Linux but provides a useful status - Disable job commenting on PR with job execution to reduce noise --------- Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
		
			
				
	
	
		
			240 lines
		
	
	
		
			7.7 KiB
		
	
	
	
		
			YAML
		
	
	
	
	
	
			
		
		
	
	
			240 lines
		
	
	
		
			7.7 KiB
		
	
	
	
		
			YAML
		
	
	
	
	
	
name: validation jobs
 | 
						|
 | 
						|
on:
 | 
						|
  merge_group:
 | 
						|
  pull_request:
 | 
						|
  push:
 | 
						|
    branches:
 | 
						|
      - main
 | 
						|
 | 
						|
env:
 | 
						|
  CARGO_TERM_COLOR: always
 | 
						|
  NIGHTLY_TOOLCHAIN: nightly
 | 
						|
 | 
						|
jobs:
 | 
						|
  build-and-install-on-iOS:
 | 
						|
    if: ${{ github.event_name == 'merge_group' }}
 | 
						|
    runs-on: macos-latest
 | 
						|
    timeout-minutes: 30
 | 
						|
    steps:
 | 
						|
      - uses: actions/checkout@v3
 | 
						|
 | 
						|
      - uses: dtolnay/rust-toolchain@stable
 | 
						|
 | 
						|
      - uses: actions/cache@v3
 | 
						|
        with:
 | 
						|
          path: |
 | 
						|
            target            
 | 
						|
          key: ${{ runner.os }}-ios-install-${{ matrix.toolchain }}-${{ hashFiles('**/Cargo.lock') }}
 | 
						|
 | 
						|
      - name: Add iOS targets
 | 
						|
        run: rustup target add aarch64-apple-ios x86_64-apple-ios
 | 
						|
 | 
						|
      - name: Build and install iOS app in iOS Simulator.
 | 
						|
        run: cd examples/mobile && make install
 | 
						|
 | 
						|
  build-android:
 | 
						|
    if: ${{ github.event_name == 'merge_group' }}
 | 
						|
    runs-on: ubuntu-latest
 | 
						|
    timeout-minutes: 30
 | 
						|
    steps:
 | 
						|
      - uses: actions/checkout@v3
 | 
						|
 | 
						|
      - uses: dtolnay/rust-toolchain@stable
 | 
						|
 | 
						|
      - uses: actions/cache@v3
 | 
						|
        with:
 | 
						|
          path: |
 | 
						|
            ~/.cargo/bin/
 | 
						|
            ~/.cargo/registry/index/
 | 
						|
            ~/.cargo/registry/cache/
 | 
						|
            ~/.cargo/git/db/
 | 
						|
            target/            
 | 
						|
          key: ${{ runner.os }}-cargo-build-android-${{ hashFiles('**/Cargo.toml') }}
 | 
						|
 | 
						|
      - name: Install Android targets
 | 
						|
        run: rustup target add aarch64-linux-android armv7-linux-androideabi
 | 
						|
 | 
						|
      - name: Install Cargo APK
 | 
						|
        run: cargo install --force cargo-apk
 | 
						|
 | 
						|
      - name: Build APK
 | 
						|
        run: ANDROID_NDK_ROOT=$ANDROID_NDK_LATEST_HOME cargo apk build --package bevy_mobile_example
 | 
						|
 | 
						|
  run-examples-linux-vulkan:
 | 
						|
    if: ${{ github.event_name == 'merge_group' }}
 | 
						|
    runs-on: ubuntu-latest
 | 
						|
    timeout-minutes: 30
 | 
						|
    steps:
 | 
						|
      - name: Install Bevy dependencies
 | 
						|
        run: |
 | 
						|
          sudo apt-get update;
 | 
						|
          DEBIAN_FRONTEND=noninteractive sudo apt-get install --no-install-recommends -yq \
 | 
						|
            libasound2-dev libudev-dev;          
 | 
						|
      - name: install xvfb, llvmpipe and lavapipe
 | 
						|
        run: |
 | 
						|
          sudo apt-get update -y -qq
 | 
						|
          sudo add-apt-repository ppa:oibaf/graphics-drivers -y
 | 
						|
          sudo apt-get update
 | 
						|
          sudo apt install -y xvfb libegl1-mesa libgl1-mesa-dri libxcb-xfixes0-dev mesa-vulkan-drivers          
 | 
						|
      - uses: actions/checkout@v3
 | 
						|
      - uses: actions/cache@v3
 | 
						|
        with:
 | 
						|
          path: |
 | 
						|
            ~/.cargo/bin/
 | 
						|
            ~/.cargo/registry/index/
 | 
						|
            ~/.cargo/registry/cache/
 | 
						|
            ~/.cargo/git/db/
 | 
						|
            target/            
 | 
						|
          key: ${{ runner.os }}-cargo-run-examples-${{ hashFiles('**/Cargo.toml') }}
 | 
						|
      - uses: dtolnay/rust-toolchain@stable
 | 
						|
      - name: Build bevy
 | 
						|
        # this uses the same command as when running the example to ensure build is reused
 | 
						|
        run: |
 | 
						|
          TRACE_CHROME=trace-alien_cake_addict.json CI_TESTING_CONFIG=.github/example-run/alien_cake_addict.ron cargo build --example alien_cake_addict --features "bevy_ci_testing,trace,trace_chrome"          
 | 
						|
      - name: Run examples
 | 
						|
        run: |
 | 
						|
          for example in .github/example-run/*.ron; do
 | 
						|
            example_name=`basename $example .ron`
 | 
						|
            echo -n $example_name > last_example_run
 | 
						|
            echo "running $example_name - "`date`
 | 
						|
            time TRACE_CHROME=trace-$example_name.json CI_TESTING_CONFIG=$example xvfb-run cargo run --example $example_name --features "bevy_ci_testing,trace,trace_chrome"
 | 
						|
            sleep 10
 | 
						|
            if [ `find ./ -maxdepth 1 -name 'screenshot-*.png' -print -quit` ]; then
 | 
						|
              mkdir screenshots-$example_name
 | 
						|
              mv screenshot-*.png screenshots-$example_name/
 | 
						|
            fi
 | 
						|
          done
 | 
						|
          zip traces.zip trace*.json
 | 
						|
          zip -r screenshots.zip screenshots-*          
 | 
						|
      - name: save traces
 | 
						|
        uses: actions/upload-artifact@v3
 | 
						|
        with:
 | 
						|
          name: example-traces.zip
 | 
						|
          path: traces.zip
 | 
						|
      - name: save screenshots
 | 
						|
        uses: actions/upload-artifact@v3
 | 
						|
        with:
 | 
						|
          name: screenshots.zip
 | 
						|
          path: screenshots.zip
 | 
						|
      - uses: actions/upload-artifact@v2
 | 
						|
        if: ${{ failure() && github.event_name == 'pull_request' }}
 | 
						|
        with:
 | 
						|
          name: example-run
 | 
						|
          path: example-run/
 | 
						|
 | 
						|
  run-examples-on-wasm:
 | 
						|
    if: ${{ github.event_name == 'merge_group' }}
 | 
						|
    runs-on: ubuntu-latest
 | 
						|
    timeout-minutes: 60
 | 
						|
    steps:
 | 
						|
      - uses: actions/checkout@v3
 | 
						|
 | 
						|
      - uses: dtolnay/rust-toolchain@stable
 | 
						|
        with:
 | 
						|
          target: wasm32-unknown-unknown
 | 
						|
 | 
						|
      - uses: actions/cache@v3
 | 
						|
        with:
 | 
						|
          path: |
 | 
						|
            ~/.cargo/bin/
 | 
						|
            ~/.cargo/registry/index/
 | 
						|
            ~/.cargo/registry/cache/
 | 
						|
            ~/.cargo/git/db/
 | 
						|
            ~/.github/start-wasm-example/node_modules
 | 
						|
            target/            
 | 
						|
          key: ${{ runner.os }}-wasm-run-examples-${{ hashFiles('**/Cargo.toml') }}
 | 
						|
 | 
						|
      - name: install xvfb, llvmpipe and lavapipe
 | 
						|
        run: |
 | 
						|
          sudo apt-get update -y -qq
 | 
						|
          sudo add-apt-repository ppa:oibaf/graphics-drivers -y
 | 
						|
          sudo apt-get update
 | 
						|
          sudo apt install -y xvfb libegl1-mesa libgl1-mesa-dri libxcb-xfixes0-dev mesa-vulkan-drivers          
 | 
						|
 | 
						|
      - name: Install wasm-bindgen
 | 
						|
        run: cargo install --force wasm-bindgen-cli
 | 
						|
 | 
						|
      - name: Setup playwright
 | 
						|
        run: |
 | 
						|
          cd .github/start-wasm-example
 | 
						|
          npm install
 | 
						|
          npx playwright install --with-deps
 | 
						|
          cd ../..          
 | 
						|
 | 
						|
      - name: First WASM build
 | 
						|
        run: |
 | 
						|
          cargo build --release --example ui --target wasm32-unknown-unknown          
 | 
						|
 | 
						|
      - name: Run examples
 | 
						|
        shell: bash
 | 
						|
        run: |
 | 
						|
          # start a webserver
 | 
						|
          python3 -m http.server --directory examples/wasm &
 | 
						|
 | 
						|
          xvfb-run cargo run -p build-wasm-example -- --browsers chromium --browsers firefox --frames 25 --test 2d_shapes lighting text_debug breakout          
 | 
						|
 | 
						|
      - name: Save screenshots
 | 
						|
        uses: actions/upload-artifact@v3
 | 
						|
        with:
 | 
						|
          name: screenshots
 | 
						|
          path: .github/start-wasm-example/screenshot-*.png
 | 
						|
 | 
						|
  build-without-default-features:
 | 
						|
    if: ${{ github.event_name == 'merge_group' }}
 | 
						|
    timeout-minutes: 30
 | 
						|
    strategy:
 | 
						|
      max-parallel: 1
 | 
						|
      matrix:
 | 
						|
        crate: [bevy_ecs, bevy_reflect, bevy]
 | 
						|
    runs-on: ubuntu-latest
 | 
						|
    steps:
 | 
						|
      - uses: actions/checkout@v3
 | 
						|
      - uses: dtolnay/rust-toolchain@stable
 | 
						|
      - name: Install alsa and udev
 | 
						|
        run: sudo apt-get update; sudo apt-get install --no-install-recommends libasound2-dev libudev-dev
 | 
						|
      - name: Build
 | 
						|
        run: cargo build -p ${{ matrix.crate }} --no-default-features
 | 
						|
        env:
 | 
						|
          CARGO_INCREMENTAL: 0
 | 
						|
          RUSTFLAGS: "-C debuginfo=0 -D warnings"
 | 
						|
 | 
						|
  build-without-default-features-status:
 | 
						|
    if: |
 | 
						|
      always() &&
 | 
						|
      github.event_name == 'merge_group'      
 | 
						|
    needs: build-without-default-features
 | 
						|
    runs-on: ubuntu-latest
 | 
						|
    steps:
 | 
						|
      - name: Successful
 | 
						|
        if: ${{ !(contains(needs.*.result, 'failure')) }}
 | 
						|
        run: exit 0
 | 
						|
      - name: Failing
 | 
						|
        if: ${{ contains(needs.*.result, 'failure') }}
 | 
						|
        run: exit 1
 | 
						|
 | 
						|
  check-unused-dependencies:
 | 
						|
    if: ${{ github.event_name == 'merge_group' }}
 | 
						|
    runs-on: ubuntu-latest
 | 
						|
    timeout-minutes: 30
 | 
						|
    steps:
 | 
						|
      - uses: actions/checkout@v3
 | 
						|
      - uses: actions/cache@v3
 | 
						|
        with:
 | 
						|
          path: |
 | 
						|
            ~/.cargo/bin/
 | 
						|
            ~/.cargo/registry/index/
 | 
						|
            ~/.cargo/registry/cache/
 | 
						|
            ~/.cargo/git/db/
 | 
						|
            target/            
 | 
						|
          key: ${{ runner.os }}-cargo-check-unused-dependencies-${{ hashFiles('**/Cargo.toml') }}
 | 
						|
      - uses: dtolnay/rust-toolchain@master
 | 
						|
        with:
 | 
						|
          toolchain: ${{ env.NIGHTLY_TOOLCHAIN }}
 | 
						|
      - name: Installs cargo-udeps
 | 
						|
        run: cargo install --force cargo-udeps
 | 
						|
      - name: Install alsa and udev
 | 
						|
        run: sudo apt-get update; sudo apt-get install --no-install-recommends libasound2-dev libudev-dev
 | 
						|
      - name: Run cargo udeps
 | 
						|
        run: cargo udeps
 |