Skip to content

Commit

Permalink
refactor: lock Python dependencies with Pipenv
Browse files Browse the repository at this point in the history
  • Loading branch information
Menci authored and Enter-tainer committed Jul 10, 2022
1 parent 2c8b93c commit a69499d
Show file tree
Hide file tree
Showing 16 changed files with 389 additions and 45 deletions.
6 changes: 3 additions & 3 deletions .bashrc
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,9 @@ alias l='ls -CF'
# User specific aliases and functions
alias wiki-upd='export LC_ALL=C.UTF-8 && cd /OI-wiki && git pull origin master'
alias wiki-theme='export LC_ALL=C.UTF-8 && cd /OI-wiki && ./scripts/pre-build/install-theme.sh'
alias wiki-bld='export LC_ALL=C.UTF-8 && cd /OI-wiki && mkdocs build -v'
alias wiki-svr='export LC_ALL=C.UTF-8 && cd /OI-wiki && mkdocs serve -v'
alias wiki-bld-math='export LC_ALL=C.UTF-8 && cd /OI-wiki && mkdocs build -v && env NODE_OPTIONS="--max_old_space_size=3072" yarn ts-node-esm ./scripts/post-build/math/render_math.ts'
alias wiki-bld='export LC_ALL=C.UTF-8 && cd /OI-wiki && pipenv run mkdocs build -v'
alias wiki-svr='export LC_ALL=C.UTF-8 && cd /OI-wiki && pipenv run mkdocs serve -v'
alias wiki-bld-math='export LC_ALL=C.UTF-8 && cd /OI-wiki && pipenv run mkdocs build -v && env NODE_OPTIONS="--max_old_space_size=3072" yarn ts-node-esm ./scripts/post-build/math/render_math.ts'
alias wiki-o='export LC_ALL=C.UTF-8 && cd /OI-wiki && yarn remark ./docs -o --silent'

# Alias definitions.
Expand Down
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@ CODE_OF_CONDUCT.md @Ir1d
README.md @Ir1d
gulpfile.cjs @Ir1d @Enter-tainer
package.json @Ir1d @Enter-tainer
requirements.txt @Ir1d
Pipenv @Ir1d
tsconfig.json @Menci
netlify.toml @Menci
13 changes: 8 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,18 @@ jobs:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/setup-python@v2
- uses: actions/setup-python@v4
with:
python-version: '3.x'
python-version: '3.10'
cache: pipenv
- uses: actions/setup-node@v2
with:
node-version: '18.x'
check-latest: true
- name: Install Python dependencies
run: pip install -r requirements.txt
run: |
curl https://raw.githubusercontent.com/pypa/pipenv/master/get-pipenv.py | python3
pipenv install
- name: Cache Node.js dependencies
uses: actions/cache@v2
id: cache-node
Expand All @@ -39,7 +42,7 @@ jobs:
- name: Page Build
run: |
./scripts/pre-build/pre-build.sh
mkdocs build -v
pipenv run mkdocs build -v
- name: Render commits info
run: ./scripts/post-build/commits-info/render-commits-info.sh
env:
Expand All @@ -51,7 +54,7 @@ jobs:
- name: Gulp minify
run: yarn gulp -f gulpfile.cjs minify
- name: Generate redirects
run: python scripts/post-build/redirect/generate-redirects.py
run: pipenv run python scripts/post-build/redirect/generate-redirects.py
- name: Deploy to gh-pages
if: ${{ github.event_name == 'push' }}
uses: peaceiris/actions-gh-pages@v3
Expand Down
10 changes: 9 additions & 1 deletion .github/workflows/celebration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,13 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v4
with:
python-version: '3.10'
cache: pipenv
- name: Install Python dependencies
run: |
curl https://raw.githubusercontent.com/pypa/pipenv/master/get-pipenv.py | python3
pipenv install
- name: Celebrate
run: python scripts/celebration.py ${{ secrets.GITHUB_TOKEN }}
run: pipenv run python scripts/celebration.py "${{ secrets.GITHUB_TOKEN }}"
13 changes: 9 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,17 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: actions/setup-python@v4
with:
python-version: '3.x'
python-version: '3.10'
cache: pipenv
- name: Install Python dependencies
run: |
curl https://raw.githubusercontent.com/pypa/pipenv/master/get-pipenv.py | python3
pipenv install
- name: Install C++
run: sudo apt install g++
run: sudo apt-get install -y g++
- name: Make the File list
run: find . -name *.cpp > res.txt
- name: Check the Code
run: python3 scripts/test.py
run: pipenv run python scripts/test.py
7 changes: 3 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
FROM ubuntu:latest
FROM ubuntu:22.04

LABEL org.oi-wiki.image.authors="[email protected] [email protected] [email protected]"

WORKDIR /
RUN apt-get update \
&& apt-get install -y git wget curl python3 python3-pip gcc g++ make \
&& curl https://bootstrap.pypa.io/get-pip.py | python3 \
&& apt-get install -y git wget curl pipenv gcc g++ make \
&& curl -sL https://deb.nodesource.com/setup_18.x | bash - \
&& apt-get install -y nodejs

# If you can't connect to GitHub, set WIKI_REPO to any mirror repo.
RUN git clone ${WIKI_REPO:-https://github.com/OI-wiki/OI-wiki.git} --depth=1 \
&& cd OI-wiki \
&& pip install -U -r requirements.txt \
&& pipenv install --pypi-mirror ${PYPI_MIRROR:-https://pypi.org/simple/} \
&& yarn --frozen-lockfile

ADD .bashrc /root/
Expand Down
15 changes: 15 additions & 0 deletions Pipfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"

[packages]
mkdocs = "*"
pymdown-extensions = "*"
pygments = "*"
beautifulsoup4 = "*"

[dev-packages]

[requires]
python_version = "3.10"
Loading

0 comments on commit a69499d

Please sign in to comment.