79 lines
		
	
	
		
			2.6 KiB
		
	
	
	
		
			YAML
		
	
	
	
	
	
			
		
		
	
	
			79 lines
		
	
	
		
			2.6 KiB
		
	
	
	
		
			YAML
		
	
	
	
	
	
on:
 | 
						|
  push:
 | 
						|
    branches:
 | 
						|
      - main
 | 
						|
    paths:
 | 
						|
      - 'src/wasm-lib/**.rs'
 | 
						|
      - '**/Cargo.toml'
 | 
						|
      - '**/Cargo.lock'
 | 
						|
      - '**/rust-toolchain.toml'
 | 
						|
      - .github/workflows/cargo-test.yml
 | 
						|
 | 
						|
  pull_request:
 | 
						|
    paths:
 | 
						|
      - 'src/wasm-lib/**.rs'
 | 
						|
      - '**/Cargo.toml'
 | 
						|
      - '**/Cargo.lock'
 | 
						|
      - '**/rust-toolchain.toml'
 | 
						|
      - .github/workflows/cargo-test.yml
 | 
						|
  workflow_dispatch:
 | 
						|
permissions: read-all
 | 
						|
concurrency:
 | 
						|
  group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
 | 
						|
  cancel-in-progress: true
 | 
						|
name: cargo test of wasm-lib
 | 
						|
jobs:
 | 
						|
  cargotest:
 | 
						|
    name: cargo test
 | 
						|
    runs-on: ubuntu-latest-8-cores
 | 
						|
    strategy:
 | 
						|
      matrix:
 | 
						|
        dir: ['src/wasm-lib']
 | 
						|
    steps:
 | 
						|
      - uses: actions/checkout@v4
 | 
						|
      - name: Install latest rust
 | 
						|
        uses: actions-rs/toolchain@v1
 | 
						|
        with:
 | 
						|
          toolchain: stable
 | 
						|
          override: true
 | 
						|
      - name: install dependencies
 | 
						|
        if: matrix.dir ==  'src-tauri'
 | 
						|
        run: |
 | 
						|
          sudo apt-get update
 | 
						|
          sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev libappindicator3-dev librsvg2-dev patchelf
 | 
						|
      - name: Install vector
 | 
						|
        run: |
 | 
						|
          curl --proto '=https' --tlsv1.2 -sSfL https://sh.vector.dev > /tmp/vector.sh
 | 
						|
          chmod +x /tmp/vector.sh
 | 
						|
          /tmp/vector.sh -y -no-modify-path
 | 
						|
          mkdir -p /tmp/vector
 | 
						|
          cp .github/workflows/vector.toml /tmp/vector.toml
 | 
						|
          sed -i "s#GITHUB_WORKFLOW#${GITHUB_WORKFLOW}#g" /tmp/vector.toml
 | 
						|
          sed -i "s#GITHUB_REPOSITORY#${GITHUB_REPOSITORY}#g" /tmp/vector.toml
 | 
						|
          sed -i "s#GITHUB_SHA#${GITHUB_SHA}#g" /tmp/vector.toml
 | 
						|
          sed -i "s#GITHUB_REF_NAME#${GITHUB_REF_NAME}#g" /tmp/vector.toml
 | 
						|
          sed -i "s#GH_ACTIONS_AXIOM_TOKEN#${{secrets.GH_ACTIONS_AXIOM_TOKEN}}#g" /tmp/vector.toml
 | 
						|
          cat /tmp/vector.toml
 | 
						|
          ${HOME}/.vector/bin/vector --config /tmp/vector.toml &
 | 
						|
      - uses: taiki-e/install-action@cargo-llvm-cov
 | 
						|
      - uses: taiki-e/install-action@nextest
 | 
						|
      - name: Rust Cache
 | 
						|
        uses: Swatinem/rust-cache@v2.6.1
 | 
						|
      - name: cargo test
 | 
						|
        shell: bash
 | 
						|
        run: |-
 | 
						|
          cd "${{ matrix.dir }}"
 | 
						|
          cargo llvm-cov nextest --all --lcov --output-path lcov.info --test-threads=1 --no-fail-fast -P ci 2>&1 | tee /tmp/github-actions.log
 | 
						|
        env:
 | 
						|
          KITTYCAD_API_TOKEN: ${{secrets.KITTYCAD_API_TOKEN}}
 | 
						|
          RUST_MIN_STACK: 10485760000
 | 
						|
      - name: Upload to codecov.io
 | 
						|
        uses: codecov/codecov-action@v4
 | 
						|
        with:
 | 
						|
          token: ${{secrets.CODECOV_TOKEN}}
 | 
						|
          fail_ci_if_error: true
 | 
						|
          flags: wasm-lib
 | 
						|
          verbose: true
 | 
						|
          files: lcov.info
 | 
						|
 |