diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml deleted file mode 100644 index 4e243b468..000000000 --- a/.github/workflows/codeql-analysis.yml +++ /dev/null @@ -1,80 +0,0 @@ -# For most projects, this workflow file will not need changing; you simply need -# to commit it to your repository. -# -# You may wish to alter this file to override the set of languages analyzed, -# or to provide custom queries or build logic. -# -# ******** NOTE ******** -# We have attempted to detect the languages in your repository. Please check -# the `language` matrix defined below to confirm you have the correct set of -# supported CodeQL languages. -# -name: "CodeQL" -on: - push: - branches: ["develop", "master"] - pull_request: - branches: ["develop", "master"] - schedule: - - cron: '19 8 * * 5' -jobs: - analyze: - name: Analyze - # Runner size impacts CodeQL analysis time. To learn more, please see: - # - https://gh.io/recommended-hardware-resources-for-running-codeql - # - https://gh.io/supported-runners-and-hardware-resources - # - https://gh.io/using-larger-runners - # Consider using larger runners for possible analysis time improvements. - runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }} - timeout-minutes: ${{ (matrix.language == 'swift' && 120) || 360 }} - permissions: - actions: read - contents: read - security-events: write - strategy: - fail-fast: false - matrix: - language: ['javascript-typescript', 'python'] - # CodeQL supports [ 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift' ] - # Use only 'java-kotlin' to analyze code written in Java, Kotlin or both - # Use only 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both - # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support - steps: - - name: Checkout repository - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - - name: Set up Python - uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0 - if: matrix.language == 'python' - with: - python-version-file: .python-version - cache: pipenv - # Initializes the CodeQL tools for scanning. - - name: Initialize CodeQL - uses: github/codeql-action/init@23acc5c183826b7a8a97bce3cecc52db901f8251 # v3.25.10 - with: - languages: ${{ matrix.language }} - # If you wish to specify custom queries, you can do so here or in a config file. - # By default, queries listed here will override any specified in a config file. - # Prefix the list here with "+" to use these queries and those in the config file. - # Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift). - # If this step fails, then you should remove it and run the build manually (see below) - - name: Autobuild - # For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs - # queries: security-extended,security-and-quality - - uses: github/codeql-action/autobuild@23acc5c183826b7a8a97bce3cecc52db901f8251 # v3.25.10 - # - run: | - # echo "Run, Build Application using script" - # ./location_of_script_within_repo/buildscript.sh - - name: Perform CodeQL Analysis - # ℹ️ Command-line programs to run using the OS shell. - # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun - - # If the Autobuild fails above, remove it and uncomment the following three lines. - # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance. - uses: github/codeql-action/analyze@23acc5c183826b7a8a97bce3cecc52db901f8251 # v3.25.10 - with: - category: "/language:${{matrix.language}}" -concurrency: - group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.ref }} - cancel-in-progress: true diff --git a/.github/workflows/pr-format.yml b/.github/workflows/pr-format.yml index 293f57413..27fe0fd5b 100644 --- a/.github/workflows/pr-format.yml +++ b/.github/workflows/pr-format.yml @@ -35,13 +35,9 @@ jobs: cache: pipenv - if: github.event_name != 'pull_request' || github.event.action != 'closed' run: sed -i -e "s/python_version = \".*\"/python_version = \"$(echo ${{ steps.setup_python.outputs.python-version }} | sed -e 's/\([0-9]*\.[0-9]*\).*/\1/g')\"/g" Pipfile - - name: Install pipenv - id: install_pipenv - if: github.event_name != 'pull_request' || github.event.action != 'closed' - run: bash "${GITHUB_WORKSPACE}/scripts/pr_format/pr_format/install_pipenv.sh" - name: Install dependencies if: github.event_name != 'pull_request' || github.event.action != 'closed' - run: bash "${GITHUB_WORKSPACE}/scripts/pr_format/pr_format/pipenv_install.sh" + run: bash "${GITHUB_WORKSPACE}/scripts/pipenv_install.sh" # formatする # --exit-codeをつけることで、autopep8内でエラーが起きれば1、差分があれば2のエラーステータスコードが返ってくる。正常時は0が返る - name: Format files diff --git a/.github/workflows/pr-test.yml b/.github/workflows/pr-test.yml index be47db040..0d5e23600 100644 --- a/.github/workflows/pr-test.yml +++ b/.github/workflows/pr-test.yml @@ -20,9 +20,11 @@ jobs: python-version-file: .python-version cache: pipenv - name: Install pipenv + run: bash "${GITHUB_WORKSPACE}/scripts/pipenv_install.sh" + - name: Set venv path env: DEST_PATH: "/home/runner/work/_temp/_github_workflow/.venv" - run: bash "${GITHUB_WORKSPACE}/scripts/pr_test/pr_super_lint/install_pipenv.sh" + run: bash "${GITHUB_WORKSPACE}/scripts/pr_test/pr_super_lint/set_venv_path.sh" - name: Set up Node.js uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2 with: diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 000000000..34b9e5c44 --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +pipenv==2024.0.1 diff --git a/scripts/pipenv_install.sh b/scripts/pipenv_install.sh new file mode 100755 index 000000000..2f7b478c5 --- /dev/null +++ b/scripts/pipenv_install.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +pip install -r requirements.txt +pipenv --version +pipenv install --dev diff --git a/scripts/pr_test/pr_super_lint/set_venv_path.sh b/scripts/pr_test/pr_super_lint/set_venv_path.sh index 43a1dcb2e..6c08a1cec 100755 --- a/scripts/pr_test/pr_super_lint/set_venv_path.sh +++ b/scripts/pr_test/pr_super_lint/set_venv_path.sh @@ -4,4 +4,10 @@ # 参考URL: https://bit.ly/2KJhjqk venv_path=$(pipenv --venv) echo "${venv_path}" -echo "venv_path=${venv_path}" >>"${GITHUB_ENV}" +VENV_PATH="${venv_path}" + +# https://github.com/github/super-linter/issues/157#issuecomment-648850330 +# -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" +# ここに cp -r することで、super-linterのなかに.venvを配置できる +# また、元ディレクトリにも残っているので、キャッシュが作られる +cp -r "${VENV_PATH}" "${DEST_PATH}"