<commit_before># Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# Format reference: https://docs.github.com/en/actions/reference

name: Compiler CI

# https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#on
on:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]
  schedule:
    # Daily at 12pm UTC
    - cron: '0 12 * * *'

env:
  VERSION_NODEJS: '10.21.0'
  UNSYMLINK_DIR: bazel-bin-unsymlink

# https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobs
jobs:
  build-and-test:
    name: Build and Test
    runs-on: ubuntu-latest
    steps:
      - name: Setup Java
        # https://github.com/marketplace/actions/setup-java-jdk
        uses: actions/setup-java@v1
        with:
          java-version: '11'
          java-package: jdk
          architecture: x64

        # Clone closure-compiler repo from the commit under test into current directory.
      - name: Checkout Current closure-compiler Commit
        # https://github.com/marketplace/actions/checkout
        uses: actions/checkout@v2

      # https://github.com/bazelbuild/setup-bazelisk
      - uses: bazelbuild/setup-bazelisk@v1

      - name: Build and Test
        run: bazelisk test //:all

      - name: Unsymlink Bazel Artifacts
        # upload-artifact doesn't support paths with symlinks
        run: |
          mkdir -p ${{ env.UNSYMLINK_DIR }}
          cp -t ${{ env.UNSYMLINK_DIR }} bazel-bin/compiler_unshaded_deploy.jar
          cp -t ${{ env.UNSYMLINK_DIR }} bazel-bin/*_bundle.jar

        # Share the following files with other jobs in this workflow. They can be grabbed using ID
        # `unshaded_compiler`. This is made possible by uploading the files to GitHub controlled
        # storage.
      - name: Share Unshaded Compiler
        # https://github.com/marketplace/actions/upload-a-build-artifact
        uses: actions/upload-artifact@v2
        with:
          name: unshaded_compiler
          path: ${{ env.UNSYMLINK_DIR }}/compiler_unshaded_deploy.jar
          if-no-files-found: error

        # If this build will be uploadaded as a SNAPSHOT, share the Sonatype bundles with the other
        # jobs in this workflow. They can be grabbed using ID `snapshot_bundles`. This is made
        # possible by uploading the files to GitHub controlled storage.
      - name: Share Snapshot Bundles
        # https://github.com/marketplace/actions/upload-a-build-artifact
        if: ${{ github.event_name == 'schedule' }}
        uses: actions/upload-artifact@v2
        with:
          name: snapshot_bundles
          path: ${{ env.UNSYMLINK_DIR }}/*_bundle.jar
          if-no-files-found: error

  test-closure-compiler-npm:
    name: Make Sure closure-compiler-npm is Compatible with this Compiler Build
    runs-on: ubuntu-latest
    needs:
      - build-and-test
    steps:
      - name: Setup Node.js
        # https://github.com/marketplace/actions/setup-node-js-environment
        uses: actions/setup-node@v1
        with:
          node-version: ${{ env.VERSION_NODEJS }}

        # Clone closure-compiler-npm repo from master into the current directory.
      - name: Checkout Current closure-compiler-npm Commit
        # https://github.com/marketplace/actions/checkout
        uses: actions/checkout@v2
        with:
          repository: google/closure-compiler-npm
          ref: master

        # Clone closure-compiler repo from the commit under test into the npm repo compiler
        # submodule
      - name: Checkout Current closure-compiler Commit
        # https://github.com/marketplace/actions/checkout
        uses: actions/checkout@v2
        with:
          path: compiler

        # Grab the compiler binary that was shared from `build-and-test` and put the file into
        # ./compiler/bazel-bin.
      - name: Grab Unshaded Compiler
        # https://github.com/marketplace/actions/download-a-build-artifact
        uses: actions/download-artifact@v2
        with:
          name: unshaded_compiler
          # Put the binary where bazel would have put it.
          path: compiler/bazel-bin

      - name: Test closure-compiler-npm
        run: compiler/.github/ci_support/test_closure-compiler-npm.sh compiler/bazel-bin/compiler_unshaded_deploy.jar

  deploy-snapshots:
    name: Deploy Snapshot Bundles to Sonatype
    runs-on: ubuntu-latest
    if: ${{ github.event_name == 'schedule' }}
    needs:
      - build-and-test
      - test-closure-compiler-npm
    steps:
        # This also installs Maven, which is being used to do the SNAPSHOT deployment.
        # TODO(nickreid): Delete this if we can find/write an upload tool other than Maven.
      - name: Setup Java
        # https://github.com/marketplace/actions/setup-java-jdk
        uses: actions/setup-java@v1
        with:
          java-version: '11'
          java-package: jdk
          architecture: x64

        # Clone closure-compiler repo from the commit under test into current directory.
      - name: Checkout Current closure-compiler Commit
        # https://github.com/marketplace/actions/checkout
        uses: actions/checkout@v2

      - name: Setup Node.js
        uses: actions/setup-node@v1
        with:<commit_msg>Bump actions/setup-node from 1 to 3<commit_after># Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# Format reference: https://docs.github.com/en/actions/reference

name: Compiler CI

# https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#on
on:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]
  schedule:
    # Daily at 12pm UTC
    - cron: '0 12 * * *'

env:
  VERSION_NODEJS: '10.21.0'
  UNSYMLINK_DIR: bazel-bin-unsymlink

# https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobs
jobs:
  build-and-test:
    name: Build and Test
    runs-on: ubuntu-latest
    steps:
      - name: Setup Java
        # https://github.com/marketplace/actions/setup-java-jdk
        uses: actions/setup-java@v1
        with:
          java-version: '11'
          java-package: jdk
          architecture: x64

        # Clone closure-compiler repo from the commit under test into current directory.
      - name: Checkout Current closure-compiler Commit
        # https://github.com/marketplace/actions/checkout
        uses: actions/checkout@v2

      # https://github.com/bazelbuild/setup-bazelisk
      - uses: bazelbuild/setup-bazelisk@v1

      - name: Build and Test
        run: bazelisk test //:all

      - name: Unsymlink Bazel Artifacts
        # upload-artifact doesn't support paths with symlinks
        run: |
          mkdir -p ${{ env.UNSYMLINK_DIR }}
          cp -t ${{ env.UNSYMLINK_DIR }} bazel-bin/compiler_unshaded_deploy.jar
          cp -t ${{ env.UNSYMLINK_DIR }} bazel-bin/*_bundle.jar

        # Share the following files with other jobs in this workflow. They can be grabbed using ID
        # `unshaded_compiler`. This is made possible by uploading the files to GitHub controlled
        # storage.
      - name: Share Unshaded Compiler
        # https://github.com/marketplace/actions/upload-a-build-artifact
        uses: actions/upload-artifact@v2
        with:
          name: unshaded_compiler
          path: ${{ env.UNSYMLINK_DIR }}/compiler_unshaded_deploy.jar
          if-no-files-found: error

        # If this build will be uploadaded as a SNAPSHOT, share the Sonatype bundles with the other
        # jobs in this workflow. They can be grabbed using ID `snapshot_bundles`. This is made
        # possible by uploading the files to GitHub controlled storage.
      - name: Share Snapshot Bundles
        # https://github.com/marketplace/actions/upload-a-build-artifact
        if: ${{ github.event_name == 'schedule' }}
        uses: actions/upload-artifact@v2
        with:
          name: snapshot_bundles
          path: ${{ env.UNSYMLINK_DIR }}/*_bundle.jar
          if-no-files-found: error

  test-closure-compiler-npm:
    name: Make Sure closure-compiler-npm is Compatible with this Compiler Build
    runs-on: ubuntu-latest
    needs:
      - build-and-test
    steps:
      - name: Setup Node.js
        # https://github.com/marketplace/actions/setup-node-js-environment
        uses: actions/setup-node@v3
        with:
          node-version: ${{ env.VERSION_NODEJS }}

        # Clone closure-compiler-npm repo from master into the current directory.
      - name: Checkout Current closure-compiler-npm Commit
        # https://github.com/marketplace/actions/checkout
        uses: actions/checkout@v2
        with:
          repository: google/closure-compiler-npm
          ref: master

        # Clone closure-compiler repo from the commit under test into the npm repo compiler
        # submodule
      - name: Checkout Current closure-compiler Commit
        # https://github.com/marketplace/actions/checkout
        uses: actions/checkout@v2
        with:
          path: compiler

        # Grab the compiler binary that was shared from `build-and-test` and put the file into
        # ./compiler/bazel-bin.
      - name: Grab Unshaded Compiler
        # https://github.com/marketplace/actions/download-a-build-artifact
        uses: actions/download-artifact@v2
        with:
          name: unshaded_compiler
          # Put the binary where bazel would have put it.
          path: compiler/bazel-bin

      - name: Test closure-compiler-npm
        run: compiler/.github/ci_support/test_closure-compiler-npm.sh compiler/bazel-bin/compiler_unshaded_deploy.jar

  deploy-snapshots:
    name: Deploy Snapshot Bundles to Sonatype
    runs-on: ubuntu-latest
    if: ${{ github.event_name == 'schedule' }}
    needs:
      - build-and-test
      - test-closure-compiler-npm
    steps:
        # This also installs Maven, which is being used to do the SNAPSHOT deployment.
        # TODO(nickreid): Delete this if we can find/write an upload tool other than Maven.
      - name: Setup Java
        # https://github.com/marketplace/actions/setup-java-jdk
        uses: actions/setup-java@v1
        with:
          java-version: '11'
          java-package: jdk
          architecture: x64

        # Clone closure-compiler repo from the commit under test into current directory.
      - name: Checkout Current closure-compiler Commit
        # https://github.com/marketplace/actions/checkout
        uses: actions/checkout@v2

      - name: Setup Node.js
        uses: actions/setup-node@v3
        with:
{'fraction_non_alphanumeric': 0.09166811619412071, 'fraction_numerical': 0.006783788484953905, 'mean_word_length': 2.420285544318858, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 30, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7215641', 'n_tokens_mistral': 3427, 'n_tokens_neox': 3272, 'n_words': 964}