From 80d68ecf81a5b421ef7c961d3d52f898458974a1 Mon Sep 17 00:00:00 2001 From: Angela P Wen Date: Tue, 15 Nov 2022 11:40:21 -0800 Subject: [PATCH 1/8] Add Swift language autodetect test --- .github/workflows/__swift-autodetect.yml | 65 ++++++++++++++++++++++++ pr-checks/checks/swift-autodetect.yml | 28 ++++++++++ 2 files changed, 93 insertions(+) create mode 100644 .github/workflows/__swift-autodetect.yml create mode 100644 pr-checks/checks/swift-autodetect.yml diff --git a/.github/workflows/__swift-autodetect.yml b/.github/workflows/__swift-autodetect.yml new file mode 100644 index 0000000000..f05e53fb25 --- /dev/null +++ b/.github/workflows/__swift-autodetect.yml @@ -0,0 +1,65 @@ +# Warning: This file is generated automatically, and should not be modified. +# Instead, please modify the template in the pr-checks directory and run: +# pip install ruamel.yaml && python3 sync.py +# to regenerate this file. + +name: PR Check - Swift analysis with language autodetection +env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GO111MODULE: auto +on: + push: + branches: + - main + - releases/v1 + - releases/v2 + pull_request: + types: + - opened + - synchronize + - reopened + - ready_for_review + workflow_dispatch: {} +jobs: + swift-autodetect: + strategy: + matrix: + include: + - os: macos-latest + version: latest + - os: macos-latest + version: cached + - os: macos-latest + version: nightly-latest + name: Swift analysis with language autodetection + timeout-minutes: 45 + runs-on: ${{ matrix.os }} + steps: + - name: Check out repository + uses: actions/checkout@v3 + - name: Prepare test + id: prepare-test + uses: ./.github/prepare-test + with: + version: ${{ matrix.version }} + - uses: ./../action/init + with: + tools: ${{ steps.prepare-test.outputs.tools-url }} + env: + TEST_MODE: true + - uses: ./../action/autobuild + - uses: ./../action/analyze + id: analysis + env: + TEST_MODE: true + - name: Check database + shell: bash + run: | + SWIFT_DB="${{ fromJson(steps.analysis.outputs.db-locations).swift }}" + if [[ ! -d "$SWIFT_DB" ]]; then + echo "Did not create a database for Swift." + exit 1 + fi + env: + CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT: 'true' + INTERNAL_CODEQL_ACTION_DEBUG_LOC: true diff --git a/pr-checks/checks/swift-autodetect.yml b/pr-checks/checks/swift-autodetect.yml new file mode 100644 index 0000000000..b22619b3b6 --- /dev/null +++ b/pr-checks/checks/swift-autodetect.yml @@ -0,0 +1,28 @@ +# This check should be combined into `multi-language-autodetect.yml` once Swift is GA'ed +# and the `CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT` environment variable is not needed. +name: "Swift analysis with language autodetection" +description: "Tests creation of a Swift database when language is not specified in `init`" +versions: ["latest", "cached", "nightly-latest"] +# Swift autobuilder is only supported on MacOS for private beta +operatingSystems: ["macos"] +env: + CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT: "true" +steps: + - uses: ./../action/init + with: + tools: ${{ steps.prepare-test.outputs.tools-url }} + env: + TEST_MODE: true + - uses: ./../action/autobuild + - uses: ./../action/analyze + id: analysis + env: + TEST_MODE: true + - name: Check database + shell: bash + run: | + SWIFT_DB="${{ fromJson(steps.analysis.outputs.db-locations).swift }}" + if [[ ! -d "$SWIFT_DB" ]]; then + echo "Did not create a database for Swift." + exit 1 + fi From dfe79c87ced8d0cfbe458f45e7877216bac53cfa Mon Sep 17 00:00:00 2001 From: Angela P Wen Date: Wed, 16 Nov 2022 15:28:19 -0800 Subject: [PATCH 2/8] Update generated check --- .github/workflows/__swift-autodetect.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/__swift-autodetect.yml b/.github/workflows/__swift-autodetect.yml index f05e53fb25..51e8bcc982 100644 --- a/.github/workflows/__swift-autodetect.yml +++ b/.github/workflows/__swift-autodetect.yml @@ -62,4 +62,4 @@ jobs: fi env: CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT: 'true' - INTERNAL_CODEQL_ACTION_DEBUG_LOC: true + CODEQL_ACTION_TEST_MODE: true From 11436f9a1458fe32926780eb55f038443da4f585 Mon Sep 17 00:00:00 2001 From: Angela P Wen Date: Thu, 17 Nov 2022 14:23:37 -0800 Subject: [PATCH 3/8] Remove `TEST_MODE` environment variable Co-authored-by: Henry Mercer --- pr-checks/checks/swift-autodetect.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/pr-checks/checks/swift-autodetect.yml b/pr-checks/checks/swift-autodetect.yml index b22619b3b6..88e52ab799 100644 --- a/pr-checks/checks/swift-autodetect.yml +++ b/pr-checks/checks/swift-autodetect.yml @@ -11,13 +11,9 @@ steps: - uses: ./../action/init with: tools: ${{ steps.prepare-test.outputs.tools-url }} - env: - TEST_MODE: true - uses: ./../action/autobuild - uses: ./../action/analyze id: analysis - env: - TEST_MODE: true - name: Check database shell: bash run: | From 7e7081170ef17d4a4f6185cd1960abca937aa871 Mon Sep 17 00:00:00 2001 From: Angela P Wen Date: Thu, 17 Nov 2022 14:40:55 -0800 Subject: [PATCH 4/8] Update autogenerated checks --- .github/workflows/__swift-autodetect.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/__swift-autodetect.yml b/.github/workflows/__swift-autodetect.yml index 51e8bcc982..984588ac83 100644 --- a/.github/workflows/__swift-autodetect.yml +++ b/.github/workflows/__swift-autodetect.yml @@ -45,13 +45,9 @@ jobs: - uses: ./../action/init with: tools: ${{ steps.prepare-test.outputs.tools-url }} - env: - TEST_MODE: true - uses: ./../action/autobuild - uses: ./../action/analyze id: analysis - env: - TEST_MODE: true - name: Check database shell: bash run: | From 87cd70c21a3db24e5d2757c84d761ac567dcfaae Mon Sep 17 00:00:00 2001 From: Angela P Wen Date: Thu, 17 Nov 2022 14:41:33 -0800 Subject: [PATCH 5/8] Update multi language autodetect check --- .../workflows/__multi-language-autodetect.yml | 21 ++++++++++++++++++- .../checks/multi-language-autodetect.yml | 20 +++++++++++++++++- 2 files changed, 39 insertions(+), 2 deletions(-) diff --git a/.github/workflows/__multi-language-autodetect.yml b/.github/workflows/__multi-language-autodetect.yml index 7a3ddab379..0cb5d323f2 100644 --- a/.github/workflows/__multi-language-autodetect.yml +++ b/.github/workflows/__multi-language-autodetect.yml @@ -74,7 +74,10 @@ jobs: run: ./build.sh - uses: ./../action/analyze id: analysis - - shell: bash + - name: Check language autodetect for all languages excluding Ruby, Swift + if: (matrix.version == 'stable-20211005' || matrix.version == 'stable-20220120' + || matrix.version == 'stable-20220401') + shell: bash run: | CPP_DB=${{ fromJson(steps.analysis.outputs.db-locations).cpp }} if [[ ! -d $CPP_DB ]] || [[ ! $CPP_DB == ${{ runner.temp }}/customDbLocation/* ]]; then @@ -106,5 +109,21 @@ jobs: echo "Did not create a database for Python, or created it in the wrong location." exit 1 fi + - name: Check language autodetect for Ruby, Swift + if: (matrix.version == 'cached' || matrix.version == 'latest' || matrix.version + == 'nightly-latest') + shell: bash + run: |- + RUBY_DB=${{ fromJson(steps.analysis.outputs.db-locations).ruby }} + if [[ ! -d $RUBY_DB ]] || [[ ! $RUBY_DB == ${{ runner.temp }}/customDbLocation/* ]]; then + echo "Did not create a database for Ruby, or created it in the wrong location." + exit 1 + fi + SWIFT_DB=${{ fromJson(steps.analysis.outputs.db-locations).swift }} + if [[ ! -d $SWIFT_DB ]] || [[ ! $SWIFT_DB == ${{ runner.temp }}/customDbLocation/* ]]; then + echo "Did not create a database for Swift, or created it in the wrong location." + exit 1 + fi env: + CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT: 'true' # Remove when Swift is GA. CODEQL_ACTION_TEST_MODE: true diff --git a/pr-checks/checks/multi-language-autodetect.yml b/pr-checks/checks/multi-language-autodetect.yml index 2dcb112de0..79722bdde7 100644 --- a/pr-checks/checks/multi-language-autodetect.yml +++ b/pr-checks/checks/multi-language-autodetect.yml @@ -1,6 +1,8 @@ name: "Multi-language repository" description: "An end-to-end integration test of a multi-language repository using automatic language detection" operatingSystems: ["ubuntu", "macos"] +env: + CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT: "true" # Remove when Swift is GA. steps: - uses: ./../action/init with: @@ -11,7 +13,9 @@ steps: run: ./build.sh - uses: ./../action/analyze id: analysis - - shell: bash + - name: Check language autodetect for all languages excluding Ruby, Swift + if: "(matrix.version == 'stable-20211005' || matrix.version == 'stable-20220120' || matrix.version == 'stable-20220401')" + shell: bash run: | CPP_DB=${{ fromJson(steps.analysis.outputs.db-locations).cpp }} if [[ ! -d $CPP_DB ]] || [[ ! $CPP_DB == ${{ runner.temp }}/customDbLocation/* ]]; then @@ -43,3 +47,17 @@ steps: echo "Did not create a database for Python, or created it in the wrong location." exit 1 fi + - name: Check language autodetect for Ruby, Swift + if: "(matrix.version == 'cached' || matrix.version == 'latest' || matrix.version == 'nightly-latest')" + shell: bash + run: | + RUBY_DB=${{ fromJson(steps.analysis.outputs.db-locations).ruby }} + if [[ ! -d $RUBY_DB ]] || [[ ! $RUBY_DB == ${{ runner.temp }}/customDbLocation/* ]]; then + echo "Did not create a database for Ruby, or created it in the wrong location." + exit 1 + fi + SWIFT_DB=${{ fromJson(steps.analysis.outputs.db-locations).swift }} + if [[ ! -d $SWIFT_DB ]] || [[ ! $SWIFT_DB == ${{ runner.temp }}/customDbLocation/* ]]; then + echo "Did not create a database for Swift, or created it in the wrong location." + exit 1 + fi \ No newline at end of file From 541382a92ea88e6bf27891851d34059ee77a7ae0 Mon Sep 17 00:00:00 2001 From: Angela P Wen Date: Thu, 17 Nov 2022 15:35:52 -0800 Subject: [PATCH 6/8] Remove Swift-specific autodetect check --- .github/workflows/__swift-autodetect.yml | 61 ------------------------ pr-checks/checks/swift-autodetect.yml | 24 ---------- 2 files changed, 85 deletions(-) delete mode 100644 .github/workflows/__swift-autodetect.yml delete mode 100644 pr-checks/checks/swift-autodetect.yml diff --git a/.github/workflows/__swift-autodetect.yml b/.github/workflows/__swift-autodetect.yml deleted file mode 100644 index 984588ac83..0000000000 --- a/.github/workflows/__swift-autodetect.yml +++ /dev/null @@ -1,61 +0,0 @@ -# Warning: This file is generated automatically, and should not be modified. -# Instead, please modify the template in the pr-checks directory and run: -# pip install ruamel.yaml && python3 sync.py -# to regenerate this file. - -name: PR Check - Swift analysis with language autodetection -env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - GO111MODULE: auto -on: - push: - branches: - - main - - releases/v1 - - releases/v2 - pull_request: - types: - - opened - - synchronize - - reopened - - ready_for_review - workflow_dispatch: {} -jobs: - swift-autodetect: - strategy: - matrix: - include: - - os: macos-latest - version: latest - - os: macos-latest - version: cached - - os: macos-latest - version: nightly-latest - name: Swift analysis with language autodetection - timeout-minutes: 45 - runs-on: ${{ matrix.os }} - steps: - - name: Check out repository - uses: actions/checkout@v3 - - name: Prepare test - id: prepare-test - uses: ./.github/prepare-test - with: - version: ${{ matrix.version }} - - uses: ./../action/init - with: - tools: ${{ steps.prepare-test.outputs.tools-url }} - - uses: ./../action/autobuild - - uses: ./../action/analyze - id: analysis - - name: Check database - shell: bash - run: | - SWIFT_DB="${{ fromJson(steps.analysis.outputs.db-locations).swift }}" - if [[ ! -d "$SWIFT_DB" ]]; then - echo "Did not create a database for Swift." - exit 1 - fi - env: - CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT: 'true' - CODEQL_ACTION_TEST_MODE: true diff --git a/pr-checks/checks/swift-autodetect.yml b/pr-checks/checks/swift-autodetect.yml deleted file mode 100644 index 88e52ab799..0000000000 --- a/pr-checks/checks/swift-autodetect.yml +++ /dev/null @@ -1,24 +0,0 @@ -# This check should be combined into `multi-language-autodetect.yml` once Swift is GA'ed -# and the `CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT` environment variable is not needed. -name: "Swift analysis with language autodetection" -description: "Tests creation of a Swift database when language is not specified in `init`" -versions: ["latest", "cached", "nightly-latest"] -# Swift autobuilder is only supported on MacOS for private beta -operatingSystems: ["macos"] -env: - CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT: "true" -steps: - - uses: ./../action/init - with: - tools: ${{ steps.prepare-test.outputs.tools-url }} - - uses: ./../action/autobuild - - uses: ./../action/analyze - id: analysis - - name: Check database - shell: bash - run: | - SWIFT_DB="${{ fromJson(steps.analysis.outputs.db-locations).swift }}" - if [[ ! -d "$SWIFT_DB" ]]; then - echo "Did not create a database for Swift." - exit 1 - fi From c48901b56ea3f5f18dc929f817512928e4892cb0 Mon Sep 17 00:00:00 2001 From: Angela P Wen Date: Thu, 17 Nov 2022 16:24:11 -0800 Subject: [PATCH 7/8] Remove Ruby autodetect check --- .github/workflows/__ruby-autodetect.yml | 66 ------------------------- pr-checks/checks/ruby-autodetect.yml | 22 --------- 2 files changed, 88 deletions(-) delete mode 100644 .github/workflows/__ruby-autodetect.yml delete mode 100644 pr-checks/checks/ruby-autodetect.yml diff --git a/.github/workflows/__ruby-autodetect.yml b/.github/workflows/__ruby-autodetect.yml deleted file mode 100644 index 3895159c65..0000000000 --- a/.github/workflows/__ruby-autodetect.yml +++ /dev/null @@ -1,66 +0,0 @@ -# Warning: This file is generated automatically, and should not be modified. -# Instead, please modify the template in the pr-checks directory and run: -# pip install ruamel.yaml && python3 sync.py -# to regenerate this file. - -name: PR Check - Ruby analysis using autodetect -env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - GO111MODULE: auto -on: - push: - branches: - - main - - releases/v1 - - releases/v2 - pull_request: - types: - - opened - - synchronize - - reopened - - ready_for_review - workflow_dispatch: {} -jobs: - ruby-autodetect: - strategy: - matrix: - include: - - os: ubuntu-latest - version: latest - - os: macos-latest - version: latest - - os: ubuntu-latest - version: cached - - os: macos-latest - version: cached - - os: ubuntu-latest - version: nightly-latest - - os: macos-latest - version: nightly-latest - name: Ruby analysis using autodetect - timeout-minutes: 45 - runs-on: ${{ matrix.os }} - steps: - - name: Check out repository - uses: actions/checkout@v3 - - name: Prepare test - id: prepare-test - uses: ./.github/prepare-test - with: - version: ${{ matrix.version }} - - uses: ./../action/init - with: - tools: ${{ steps.prepare-test.outputs.tools-url }} - - uses: ./../action/analyze - id: analysis - - name: Check database - shell: bash - run: | - RUBY_DB="${{ fromJson(steps.analysis.outputs.db-locations).ruby }}" - if [[ ! -d "$RUBY_DB" ]]; then - echo "Did not create a database for Ruby." - exit 1 - fi - env: - CODEQL_ENABLE_EXPERIMENTAL_FEATURES: 'true' - CODEQL_ACTION_TEST_MODE: true diff --git a/pr-checks/checks/ruby-autodetect.yml b/pr-checks/checks/ruby-autodetect.yml deleted file mode 100644 index daad374af3..0000000000 --- a/pr-checks/checks/ruby-autodetect.yml +++ /dev/null @@ -1,22 +0,0 @@ -# This check should be combined into `multi-language-autodetect.yml` once Ruby is GA'ed -# and the `CODEQL_ENABLE_EXPERIMENTAL_FEATURES` environment variable is not needed. -name: "Ruby analysis using autodetect" -description: "Tests creation of a Ruby database when language isn't specified in init" -versions: ["latest", "cached", "nightly-latest"] -operatingSystems: ["ubuntu", "macos"] -env: - CODEQL_ENABLE_EXPERIMENTAL_FEATURES: "true" -steps: - - uses: ./../action/init - with: - tools: ${{ steps.prepare-test.outputs.tools-url }} - - uses: ./../action/analyze - id: analysis - - name: Check database - shell: bash - run: | - RUBY_DB="${{ fromJson(steps.analysis.outputs.db-locations).ruby }}" - if [[ ! -d "$RUBY_DB" ]]; then - echo "Did not create a database for Ruby." - exit 1 - fi From 93b9feecd596d7d31fb13091f1fa1b996bd74412 Mon Sep 17 00:00:00 2001 From: Angela P Wen Date: Fri, 18 Nov 2022 09:00:46 -0800 Subject: [PATCH 8/8] Remove if condition for non-Ruby/Swift languages --- .github/workflows/__multi-language-autodetect.yml | 2 -- pr-checks/checks/multi-language-autodetect.yml | 1 - 2 files changed, 3 deletions(-) diff --git a/.github/workflows/__multi-language-autodetect.yml b/.github/workflows/__multi-language-autodetect.yml index 0cb5d323f2..956a6280c2 100644 --- a/.github/workflows/__multi-language-autodetect.yml +++ b/.github/workflows/__multi-language-autodetect.yml @@ -75,8 +75,6 @@ jobs: - uses: ./../action/analyze id: analysis - name: Check language autodetect for all languages excluding Ruby, Swift - if: (matrix.version == 'stable-20211005' || matrix.version == 'stable-20220120' - || matrix.version == 'stable-20220401') shell: bash run: | CPP_DB=${{ fromJson(steps.analysis.outputs.db-locations).cpp }} diff --git a/pr-checks/checks/multi-language-autodetect.yml b/pr-checks/checks/multi-language-autodetect.yml index 79722bdde7..99f1f6f33b 100644 --- a/pr-checks/checks/multi-language-autodetect.yml +++ b/pr-checks/checks/multi-language-autodetect.yml @@ -14,7 +14,6 @@ steps: - uses: ./../action/analyze id: analysis - name: Check language autodetect for all languages excluding Ruby, Swift - if: "(matrix.version == 'stable-20211005' || matrix.version == 'stable-20220120' || matrix.version == 'stable-20220401')" shell: bash run: | CPP_DB=${{ fromJson(steps.analysis.outputs.db-locations).cpp }}