<commit_before>name: test

on: [push, pull_request]

jobs:
  test:
    strategy:
      matrix:
        os: [ubuntu-latest, macos-latest, windows-latest]
        go: ['1.15.15', '1.16.7', '1.17.0-rc2']
    name: Test with Go ${{ matrix.go }} on ${{ matrix.os }}
    runs-on: ${{ matrix.os }}
    env:
      DISPLAY: ':99.0'
    defaults:
      run:
        shell: bash
    steps:
      - name: Checkout
        uses: actions/checkout@v2

      - name: Setup Go
        uses: actions/setup-go@v2
        with:
          go-version: ${{ matrix.go }}
          stable: false

      - name: Setup JDK
        uses: actions/setup-java@v2
        with:
          java-version: '11'
          distribution: 'adopt'

      - name: Install dependencies
        if: ${{ matrix.os == 'ubuntu-latest' }}
        run: |
          sudo apt-get update
          sudo apt-get install libasound2-dev libgl1-mesa-dev libpulse-dev libxcursor-dev libxi-dev libxinerama-dev libxrandr-dev libxxf86vm-dev

      - name: Install wasmbrowsertest
        run: |
          # TODO: Use go install github.com/agnivade/wasmbrowsertest@... on Go 1.16 or later.
          mkdir /tmp/wasmbrowsertest
          cd /tmp/wasmbrowsertest
          go mod init foo
          go get github.com/agnivade/wasmbrowsertest
          go build -o wasmbrowsertest github.com/agnivade/wasmbrowsertest
          mv ./wasmbrowsertest $(go env GOPATH)/bin/go_js_wasm_exec

      - name: Prepare ebitenmobile test
        run: |
          local_ebiten=$(pwd)
          cd /tmp
          git clone --depth=1 https://github.com/hajimehoshi/go-inovation
          cd go-inovation
          go mod edit -replace=github.com/hajimehoshi/ebiten/v2=$local_ebiten
          go mod tidy

      - name: Xvfb
        if: ${{ matrix.os == 'ubuntu-latest' }}
        run: |
          Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &

      - name: go vet
        if: ${{ matrix.os != 'windows-latest' }} # TODO: Fix go vet errors on Windows. (#1306)
        run: |
          go vet -tags=example -v ./...

      - name: go build
        run: |
          go build -tags=example -v ./...
          env GOOS=js GOARCH=wasm go build -tags=example -v ./...
          env GOOS=windows GOARCH=amd64 go build -tags=example -v ./...
          env GOOS=windows GOARCH=386 go build -tags=example -v ./...

      - name: go test
        if: ${{ matrix.os == 'ubuntu-latest' }} # TODO: Add more test environments (#1305)
        run: |
          go test -tags=example -v ./...

      - name: go test (Wasm)
        # TODO: Investigate times out on Windows. (#1313)
        if: ${{ matrix.os != 'windows-latest' }}
        run: |
          env GOOS=js GOARCH=wasm go test -tags=example -v ./...
          env GOOS=js GOARCH=wasm go test -tags=example,ebitenwebgl1 -v ./...

      - name: Install ebitenmobile
        run: |
          go install ./cmd/ebitenmobile

      - name: ebitenmobile bind (Android)
        run: |
          cd /tmp/go-inovation
          ebitenmobile bind -target android -javapkg com.hajimehoshi.goinovation -o inovation.aar -v github.com/hajimehoshi/go-inovation/mobile

      - name: ebitenmobile bind (iOS)
        if: ${{ matrix.os == 'macos-latest' }}
        run: |
          cd /tmp/go-inovation
          ebitenmobile bind -target ios -o Inovation.framework -v github.com/hajimehoshi/go-inovation/mobile<commit_msg>Bug fix: go-inovation requires Go 1.16 or newer<commit_after>name: test

on: [push, pull_request]

jobs:
  test:
    strategy:
      matrix:
        os: [ubuntu-latest, macos-latest, windows-latest]
        go: ['1.15.15', '1.16.7', '1.17.0-rc2']
    name: Test with Go ${{ matrix.go }} on ${{ matrix.os }}
    runs-on: ${{ matrix.os }}
    env:
      DISPLAY: ':99.0'
    defaults:
      run:
        shell: bash
    steps:
      - name: Checkout
        uses: actions/checkout@v2

      - name: Setup Go
        uses: actions/setup-go@v2
        with:
          go-version: ${{ matrix.go }}
          stable: false

      - name: Setup JDK
        uses: actions/setup-java@v2
        with:
          java-version: '11'
          distribution: 'adopt'

      - name: Install dependencies
        if: ${{ matrix.os == 'ubuntu-latest' }}
        run: |
          sudo apt-get update
          sudo apt-get install libasound2-dev libgl1-mesa-dev libpulse-dev libxcursor-dev libxi-dev libxinerama-dev libxrandr-dev libxxf86vm-dev

      - name: Install wasmbrowsertest
        run: |
          # TODO: Use go install github.com/agnivade/wasmbrowsertest@... on Go 1.16 or later.
          mkdir /tmp/wasmbrowsertest
          cd /tmp/wasmbrowsertest
          go mod init foo
          go get github.com/agnivade/wasmbrowsertest
          go build -o wasmbrowsertest github.com/agnivade/wasmbrowsertest
          mv ./wasmbrowsertest $(go env GOPATH)/bin/go_js_wasm_exec

      - name: Prepare ebitenmobile test
        if: ${{ !startsWith(matrix.go, '1.15.') }}
        run: |
          local_ebiten=$(pwd)
          cd /tmp
          git clone --depth=1 https://github.com/hajimehoshi/go-inovation
          cd go-inovation
          go mod edit -replace=github.com/hajimehoshi/ebiten/v2=$local_ebiten
          go mod tidy

      - name: Xvfb
        if: ${{ matrix.os == 'ubuntu-latest' }}
        run: |
          Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &

      - name: go vet
        if: ${{ matrix.os != 'windows-latest' }} # TODO: Fix go vet errors on Windows. (#1306)
        run: |
          go vet -tags=example -v ./...

      - name: go build
        run: |
          go build -tags=example -v ./...
          env GOOS=js GOARCH=wasm go build -tags=example -v ./...
          env GOOS=windows GOARCH=amd64 go build -tags=example -v ./...
          env GOOS=windows GOARCH=386 go build -tags=example -v ./...

      - name: go test
        if: ${{ matrix.os == 'ubuntu-latest' }} # TODO: Add more test environments (#1305)
        run: |
          go test -tags=example -v ./...

      - name: go test (Wasm)
        # TODO: Investigate times out on Windows. (#1313)
        if: ${{ matrix.os != 'windows-latest' }}
        run: |
          env GOOS=js GOARCH=wasm go test -tags=example -v ./...
          env GOOS=js GOARCH=wasm go test -tags=example,ebitenwebgl1 -v ./...

      - name: Install ebitenmobile
        run: |
          go install ./cmd/ebitenmobile

      - name: ebitenmobile bind (Android)
        if: ${{ !startsWith(matrix.go, '1.15.') }}
        run: |
          cd /tmp/go-inovation
          ebitenmobile bind -target android -javapkg com.hajimehoshi.goinovation -o inovation.aar -v github.com/hajimehoshi/go-inovation/mobile

      - name: ebitenmobile bind (iOS)
        if: ${{ matrix.os == 'macos-latest' && !startsWith(matrix.go, '1.15.') }}
        run: |
          cd /tmp/go-inovation
          ebitenmobile bind -target ios -o Inovation.framework -v github.com/hajimehoshi/go-inovation/mobile
{'fraction_non_alphanumeric': 0.1279120243090725, 'fraction_numerical': 0.01996816669078281, 'mean_word_length': 1.7826086956521738, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '88959', 'n_tokens_mistral': 2432, 'n_tokens_neox': 2249, 'n_words': 582}