on:
  pull_request:
    types:
      - opened
      - edited
      - reopened
      - synchronize
    paths-ignore: [ '**.md', '**.png', '**.jpg', '**.jpeg', '**.svg', '/docs/**' ]

name: Static checks dragonball
jobs:
  test-dragonball:
    runs-on: self-hosted
    env:
      RUST_BACKTRACE: "1"
    steps:
      - uses: actions/checkout@v3
      - name: Set env
        if: ${{ !contains(github.event.pull_request.labels.*.name, 'force-skip-ci') }}
        run: |
          echo "GOPATH=${{ github.workspace }}" >> $GITHUB_ENV
      - name: Install Rust
        if: ${{ !contains(github.event.pull_request.labels.*.name, 'force-skip-ci') }}
        run: |
          ./ci/install_rust.sh
          PATH=$PATH:"$HOME/.cargo/bin"
      - name: Run Unit Test
        if: ${{ !contains(github.event.pull_request.labels.*.name, 'force-skip-ci') }}
        run: |
          cd src/dragonball
          cargo version
          rustc --version
          sudo -E env PATH=$PATH LIBC=gnu SUPPORT_VIRTUALIZATION=true make test
