Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pipenvのバージョンをrequirements.txtで管理する #4090

Merged
merged 5 commits into from
Jun 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions .github/workflows/pr-format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/pr-test-hato-bot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ jobs:
with:
python-version-file: .python-version
cache: pipenv
- name: Install dependencies
run: bash "${GITHUB_WORKSPACE}/scripts/pipenv_install.sh"
- name: Test
run: bash "${GITHUB_WORKSPACE}/scripts/pr_test_hato_bot/pr_test/test.sh"
concurrency:
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/pr-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ ENV ENV="${ENV}"
WORKDIR /usr/src/app

COPY .npmrc .npmrc
COPY requirements.txt requirements.txt
COPY Pipfile Pipfile
COPY Pipfile.lock Pipfile.lock
COPY package.json package.json
Expand All @@ -35,7 +36,7 @@ RUN apt-get update && \
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_20.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list && \
apt-get update && \
apt-get install -y --no-install-recommends nodejs && \
pip install pipenv==2024.0.1 --no-cache-dir && \
pip install -r requirements.txt --no-cache-dir && \
if [ "${ENV}" = 'dev' ]; then \
pipenv install --system --dev; \
else \
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pipenv==2024.0.1
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env bash

pip install -r requirements.txt
pipenv --version
pipenv install --dev
25 changes: 0 additions & 25 deletions scripts/pr_format/pr_format/install_pipenv.sh

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,18 +1,5 @@
#!/usr/bin/env bash

file_name=Dockerfile
package_name=pipenv

if [ -f ${file_name} ]; then
package_name_v=$(grep -oE "${package_name}[^ ]+" ${file_name})
else
package_name_v=${package_name}
fi

pip install "${package_name_v}"
pipenv --version
pipenv install --dev

# 環境ファイルを使ってenvにsetしている
# 参考URL: https://bit.ly/2KJhjqk
venv_path=$(pipenv --venv)
Expand Down
13 changes: 0 additions & 13 deletions scripts/pr_test_hato_bot/pr_test/test.sh
Original file line number Diff line number Diff line change
@@ -1,17 +1,4 @@
#!/usr/bin/env bash

file_name=Dockerfile
package_name=pipenv

if [ -f ${file_name} ]; then
PATTERN="${package_name}[^ ]+"
package_name_with_version=$(grep -oE "${PATTERN}" ${file_name})
else
package_name_with_version=${package_name}
fi

pip install "${package_name_with_version}"
pipenv --version
pipenv install --dev
cp .env.example .env
pipenv run python -m unittest
Loading