Skip to content
This repository was archived by the owner on Mar 13, 2024. It is now read-only.

Commit 964446a

Browse files
committed
move requirements assests to lockfiles zip
1 parent 323424f commit 964446a

File tree

5 files changed

+32
-15
lines changed

5 files changed

+32
-15
lines changed

.containerignore

Lines changed: 0 additions & 7 deletions
This file was deleted.

.dockerignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
build/
2+
dist/
3+
.mypy_cache
4+
.tox
5+
.venv*
6+
venv*
7+
.devcontainer.json
8+
.pre-commit-config.yaml
9+
.vscode
10+
README.rst

.github/workflows/code.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ jobs:
110110
run: |
111111
docker run --name test build bash /project/.github/workflows/container_tests.sh
112112
docker cp test:/project/dist .
113+
docker cp test:/project/lockfiles .
113114
docker cp test:/project/cov.xml .
114115
115116
- name: Upload coverage to Codecov
@@ -141,6 +142,12 @@ jobs:
141142
name: dist
142143
path: dist
143144

145+
- name: Upload lock files
146+
uses: actions/upload-artifact@v3
147+
with:
148+
name: lockfiles
149+
path: lockfiles
150+
144151
release:
145152
# upload to PyPI and make a release on every tag
146153
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
@@ -156,7 +163,9 @@ jobs:
156163
uses: softprops/action-gh-release@1e07f4398721186383de40550babbdf2b84acfc5 # v0.1.14
157164
with:
158165
prerelease: ${{ contains(github.ref_name, 'a') || contains(github.ref_name, 'b') || contains(github.ref_name, 'rc') }}
159-
files: dist/*
166+
files: |
167+
dist/
168+
lockfiles/
160169
generate_release_notes: true
161170
env:
162171
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/container_tests.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ source /venv/bin/activate
66

77
touch requirements_dev.txt
88
pip install -r requirements_dev.txt -e .[dev]
9-
pip freeze --exclude-editable > dist/requirements_dev.txt
9+
mkdir -p lockfiles
10+
pip freeze --exclude-editable > lockfiles/requirements_dev.txt
1011

1112
pipdeptree
1213

Dockerfile

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,29 +17,33 @@ RUN apt-get update && apt-get upgrade -y && \
1717
&& busybox --install
1818

1919
COPY . /project
20+
WORKDIR /project
2021

21-
RUN cd /project && \
22-
pip install --upgrade pip build && \
22+
# make the wheel outside of the venv so 'build' does not dirty requirements.txt
23+
RUN pip install --upgrade pip build && \
2324
export SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct) && \
2425
python -m build --sdist --wheel && \
2526
touch requirements.txt
2627

28+
# set up a virtual environment and put it in PATH
2729
RUN python -m venv /venv
2830
ENV PATH=/venv/bin:$PATH
2931
ENV TOX_DIRECT=1
3032

31-
RUN cd /project && \
32-
pip install --upgrade pip && \
33+
# install the wheel and generate the requirements file
34+
RUN pip install --upgrade pip && \
3335
pip install -r requirements.txt dist/*.whl && \
34-
pip freeze > dist/requirements.txt && \
36+
mkdir -p lockfiles && \
37+
pip freeze > lockfiles/requirements.txt && \
3538
# we don't want to include our own wheel in requirements - remove with sed
3639
# and replace with a comment to avoid a zero length asset upload later
37-
sed -i '/file:/s/^/# Requirements for /' dist/requirements.txt
40+
sed -i '/file:/s/^/# Requirements for /' lockfiles/requirements.txt
3841

3942
FROM python:3.10-slim as runtime
4043

4144
# Add apt-get system dependecies for runtime here if needed
4245

46+
# copy the virtual environment from the build stage and put it in PATH
4347
COPY --from=build /venv/ /venv/
4448
ENV PATH=/venv/bin:$PATH
4549

0 commit comments

Comments
 (0)