<commit_before>name: Build, test

on: [push]

jobs:
  build-test-deploy:
    runs-on: ubuntu-20.04

    steps:
    - uses: actions/checkout@v2

    - name: Set docker image tag
      run: |
        TAG=$(date '+%Y%m%d')-$(git rev-parse --short HEAD)
        echo "DOCKER_TAG=${TAG}" >> $GITHUB_ENV

    - name: Cache Docker layers
      uses: actions/cache@v2
      with:
        path: /tmp/.buildx-cache
        key: ${{ runner.os }}-buildx-${{ env.DOCKER_TAG }}
        restore-keys: |
          ${{ runner.os }}-buildx-

    - name: Set up Docker Buildx
      id: buildx
      uses: docker/setup-buildx-action@v1
      with:
        install: true

    - name: Build itk-js-base
      run: |
        ./src/Docker/itk-js-base/build.sh --load --cache-from type=local,src=/tmp/.buildx-cache --cache-to type=local,dest=/tmp/.buildx-cache

    - name: Build itk-js
      run: |
        ./src/Docker/itk-js/build.sh --load --cache-from type=local,src=/tmp/.buildx-cache --cache-to type=local,dest=/tmp/.buildx-cache
        sudo rm -rf ./src/Docker/itk-js/ITKBridgeJavaScriptModuleCopy

    - name: Build itk-js-vtk
      run: |
        ./src/Docker/itk-js-vtk/build.sh --load --cache-from type=local,src=/tmp/.buildx-cache --cache-to type=local,dest=/tmp/.buildx-cache

    - uses: actions/setup-node@v2
      with:
        node-version: '10'

    - name: 'Free up disk space'
      run: |
        # Workaround for https://github.com/actions/virtual-environments/issues/709
        df -h
        sudo apt-get clean
        sudo rm -rf "/usr/local/share/boost"
        sudo rm -rf "$AGENT_TOOLSDIRECTORY"
        df -h

    - name: Install packages
      run: |
        npm ci

    - name: Build
      run: |
        npm run build

    - name: Lint tests
      run: |
        npm run test:lint

    - name: Node tests
      run: |
        npm run test:node

    - name: Browser tests
      run: |
        # Allow writing test/output.html
        sudo chmod 777 test
        # To debug locally, run `./test/run.sh -d`
        ./test/run.sh

    - name: Test building a pipeline
      run: |
        cd test/MedianFilterPipeline
        docker run --rm insighttoolkit/itk-js:${{ env.DOCKER_TAG }} > ./itk-js
        chmod +x ./itk-js
        rm -rf web-build
        ./itk-js web-build
        cd -

    - name: Build and publish docs
      if: github.ref == 'refs/heads/master'
      run: |
        git config --global user.name "Circle CI"
        git config --global user.email "<EMAIL>"<commit_msg>ci(Docs): Correct CI Git username<commit_after>name: Build, test

on: [push]

jobs:
  build-test-deploy:
    runs-on: ubuntu-20.04

    steps:
    - uses: actions/checkout@v2

    - name: Set docker image tag
      run: |
        TAG=$(date '+%Y%m%d')-$(git rev-parse --short HEAD)
        echo "DOCKER_TAG=${TAG}" >> $GITHUB_ENV

    - name: Cache Docker layers
      uses: actions/cache@v2
      with:
        path: /tmp/.buildx-cache
        key: ${{ runner.os }}-buildx-${{ env.DOCKER_TAG }}
        restore-keys: |
          ${{ runner.os }}-buildx-

    - name: Set up Docker Buildx
      id: buildx
      uses: docker/setup-buildx-action@v1
      with:
        install: true

    - name: Build itk-js-base
      run: |
        ./src/Docker/itk-js-base/build.sh --load --cache-from type=local,src=/tmp/.buildx-cache --cache-to type=local,dest=/tmp/.buildx-cache

    - name: Build itk-js
      run: |
        ./src/Docker/itk-js/build.sh --load --cache-from type=local,src=/tmp/.buildx-cache --cache-to type=local,dest=/tmp/.buildx-cache
        sudo rm -rf ./src/Docker/itk-js/ITKBridgeJavaScriptModuleCopy

    - name: Build itk-js-vtk
      run: |
        ./src/Docker/itk-js-vtk/build.sh --load --cache-from type=local,src=/tmp/.buildx-cache --cache-to type=local,dest=/tmp/.buildx-cache

    - uses: actions/setup-node@v2
      with:
        node-version: '10'

    - name: 'Free up disk space'
      run: |
        # Workaround for https://github.com/actions/virtual-environments/issues/709
        df -h
        sudo apt-get clean
        sudo rm -rf "/usr/local/share/boost"
        sudo rm -rf "$AGENT_TOOLSDIRECTORY"
        df -h

    - name: Install packages
      run: |
        npm ci

    - name: Build
      run: |
        npm run build

    - name: Lint tests
      run: |
        npm run test:lint

    - name: Node tests
      run: |
        npm run test:node

    - name: Browser tests
      run: |
        # Allow writing test/output.html
        sudo chmod 777 test
        # To debug locally, run `./test/run.sh -d`
        ./test/run.sh

    - name: Test building a pipeline
      run: |
        cd test/MedianFilterPipeline
        docker run --rm insighttoolkit/itk-js:${{ env.DOCKER_TAG }} > ./itk-js
        chmod +x ./itk-js
        rm -rf web-build
        ./itk-js web-build
        cd -

    - name: Build and publish docs
      if: github.ref == 'refs/heads/master'
      run: |
        git config --global user.name "GitHub Actions CI"
        git config --global user.email "<EMAIL>"
{'fraction_non_alphanumeric': 0.13764940239043824, 'fraction_numerical': 0.006374501992031873, 'mean_word_length': 1.7587912087912088, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, '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': '905106', 'n_tokens_mistral': 1810, 'n_tokens_neox': 1685, 'n_words': 412}