From 6ee96e291db87ccea9b8451a23de0aa0d93d194d Mon Sep 17 00:00:00 2001 From: Evgenii Kliuchnikov Date: Mon, 3 Jul 2023 19:13:24 +0000 Subject: Internal changes PiperOrigin-RevId: 545262005 --- .github/workflows/build_test.yml | 31 ++++++++--------- .github/workflows/codeql.yml | 63 +++++++++++++++++++++++++++++++++++ .github/workflows/scorecard.yml | 72 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 151 insertions(+), 15 deletions(-) create mode 100644 .github/workflows/codeql.yml create mode 100644 .github/workflows/scorecard.yml (limited to '.github') diff --git a/.github/workflows/build_test.yml b/.github/workflows/build_test.yml index a7b23d6..ff5e8fd 100644 --- a/.github/workflows/build_test.yml +++ b/.github/workflows/build_test.yml @@ -33,7 +33,7 @@ jobs: build_system: cmake c_compiler: gcc-9 cxx_compiler: g++-9 - os: ubuntu-18.04 + os: ubuntu-20.04 # TODO: consider running this combination in docker #- name: cmake:clang3.5 @@ -114,12 +114,13 @@ jobs: # TODO: consider running this combination in docker #- name: python2.7:gcc5 - - name: python27:clang9 - build_system: python - c_compiler: clang-9 - python_version: 2.7 - cxx_compiler: clang++-9 - os: ubuntu-18.04 + # TODO: consider running this combination in docker + #- name: python27:clang9 + # build_system: python + # c_compiler: clang-9 + # python_version: 2.7 + # cxx_compiler: clang++-9 + # os: ubuntu-20.04 # TODO: consider running this combination in docker #- name: python27-win @@ -202,7 +203,7 @@ jobs: - name: bazel-win:root build_system: bazel bazel_project: . - os: windows-latest + os: windows-2019 # TODO: use single dll on windows, otherwise it fails to link #- name: bazel-win:go @@ -213,7 +214,7 @@ jobs: - name: bazel-win:java build_system: bazel bazel_project: java - os: windows-latest + os: windows-2019 # TODO: blocked by Bazel Closure rules issue #- name: bazel-win:js @@ -224,7 +225,7 @@ jobs: - name: bazel-win:research build_system: bazel bazel_project: research - os: windows-latest + os: windows-2019 - name: make build_system: make @@ -245,7 +246,7 @@ jobs: steps: - name: Install extra deps @ Ubuntu if: ${{ runner.os == 'Linux' }} - # Already installed: bazel, clang{10-12}, cmake, gcc{9,10}, java{8,11}, maven, python{2.7,3.5-3.9} + # Already installed: bazel, clang{10-12}, cmake, gcc{9,10}, java{8,11}, maven, python{3.5-3.9} run: | EXTRA_PACKAGES="${{ matrix.extra_apt_pkgs || '' }}" sudo apt update @@ -293,7 +294,7 @@ jobs: if: ${{ matrix.build_system == 'bazel' }} run: | cd ${GITHUB_WORKSPACE}/${{ matrix.bazel_project }} - bazel build -c opt ...:all + bazelisk build -c opt ...:all - name: Fix symlinks for Bazel (Windows) if: ${{ matrix.build_system == 'bazel' && runner.os == 'Windows' && matrix.bazel_project == 'java' }} @@ -337,9 +338,9 @@ jobs: if: ${{ matrix.build_system == 'bazel' }} run: | cd ${GITHUB_WORKSPACE}/${{ matrix.bazel_project }} - bazel query "tests(...)" --output=label > ${RUNNER_TEMP}/tests.lst - [ -s ${RUNNER_TEMP}/tests.lst ] && bazel test -c opt ...:all - bazel clean + bazelisk query "tests(...)" --output=label > ${RUNNER_TEMP}/tests.lst + [ -s ${RUNNER_TEMP}/tests.lst ] && bazelisk test -c opt ...:all + bazelisk clean - name: Build / Test with Maven if: ${{ matrix.build_system == 'maven' }} diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml new file mode 100644 index 0000000..bd043c9 --- /dev/null +++ b/.github/workflows/codeql.yml @@ -0,0 +1,63 @@ +name: "CodeQL" + +on: + push: + branches: [ "master" ] + pull_request: + # The branches below must be a subset of the branches above + branches: [ "master" ] + schedule: + - cron: '18 15 * * 0' + +jobs: + analyze: + name: Analyze + runs-on: 'ubuntu-latest' + timeout-minutes: 360 + permissions: + actions: read + contents: read + security-events: write + + strategy: + fail-fast: false + matrix: + language: [ 'cpp', 'java', 'javascript', 'python' ] + # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby', 'swift' ] + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v2 + with: + languages: ${{ matrix.language }} + config: | + paths-ignore: + - research + + - if: matrix.language == 'cpp' + name: Build CPP + uses: github/codeql-action/autobuild@v2 + + - if: matrix.language == 'cpp' || matrix.language == 'java' + name: Build Java + run: | + cd ${GITHUB_WORKSPACE}/java + bazelisk build --spawn_strategy=local --nouse_action_cache -c opt ...:all + + - if: matrix.language == 'javascript' + name: Build JS + uses: github/codeql-action/autobuild@v2 + + - if: matrix.language == 'cpp' || matrix.language == 'python' + name: Build Python + run: | + python setup.py build_ext + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v2 + with: + category: "/language:${{matrix.language}}" diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml new file mode 100644 index 0000000..a71f9f8 --- /dev/null +++ b/.github/workflows/scorecard.yml @@ -0,0 +1,72 @@ +# This workflow uses actions that are not certified by GitHub. They are provided +# by a third-party and are governed by separate terms of service, privacy +# policy, and support documentation. + +name: Scorecard supply-chain security +on: + # For Branch-Protection check. Only the default branch is supported. See + # https://github.com/ossf/scorecard/blob/main/docs/checks.md#branch-protection + branch_protection_rule: + # To guarantee Maintained check is occasionally updated. See + # https://github.com/ossf/scorecard/blob/main/docs/checks.md#maintained + schedule: + - cron: '23 21 * * 1' + push: + branches: [ "master" ] + +# Declare default permissions as read only. +permissions: read-all + +jobs: + analysis: + name: Scorecard analysis + runs-on: ubuntu-latest + permissions: + # Needed to upload the results to code-scanning dashboard. + security-events: write + # Needed to publish results and get a badge (see publish_results below). + id-token: write + # Uncomment the permissions below if installing in a private repository. + # contents: read + # actions: read + + steps: + - name: "Checkout code" + uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0 + with: + persist-credentials: false + + - name: "Run analysis" + uses: ossf/scorecard-action@e38b1902ae4f44df626f11ba0734b14fb91f8f86 # v2.1.2 + with: + results_file: results.sarif + results_format: sarif + # (Optional) "write" PAT token. Uncomment the `repo_token` line below if: + # - you want to enable the Branch-Protection check on a *public* repository, or + # - you are installing Scorecard on a *private* repository + # To create the PAT, follow the steps in https://github.com/ossf/scorecard-action#authentication-with-pat. + # repo_token: ${{ secrets.SCORECARD_TOKEN }} + + # Public repositories: + # - Publish results to OpenSSF REST API for easy access by consumers + # - Allows the repository to include the Scorecard badge. + # - See https://github.com/ossf/scorecard-action#publishing-results. + # For private repositories: + # - `publish_results` will always be set to `false`, regardless + # of the value entered here. + publish_results: true + + # Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF + # format to the repository Actions tab. + - name: "Upload artifact" + uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # v3.1.0 + with: + name: SARIF file + path: results.sarif + retention-days: 5 + + # Upload the results to GitHub's code scanning dashboard. + - name: "Upload to code-scanning" + uses: github/codeql-action/upload-sarif@17573ee1cc1b9d061760f3a006fc4aac4f944fd5 # v2.2.4 + with: + sarif_file: results.sarif -- cgit v1.1