Skip to content

Commit d20154a

Browse files
committed
Make it possible to change CWD before tests execution
Fixes: #47
1 parent 5c071a5 commit d20154a

File tree

3 files changed

+16
-0
lines changed

3 files changed

+16
-0
lines changed

.github/workflows/build-and-push.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@ jobs:
6464
TOXENV: ${{ matrix.toxenv }}
6565
run: |
6666
docker run --rm --platform linux/${{ matrix.arch }} -e DNF_INSTALL="libffi-devel pkgconfig(libgit2) /usr/bin/cowsay" fedorapython/fedora-python-tox:${{ matrix.arch }} sh -c "/run_tests.sh; pip install -I --no-deps --compile --no-binary :all: cffi pygit2~=1.5.0 && cowsay DONE"
67+
- name: Test external project with WORKDIR
68+
run: |
69+
docker run --rm --platform linux/${{ matrix.arch }} -e TOXENV=py310-minimal -e GIT_URL=https://github.com/trezor/trezor-firmware.git -e WORKDIR=python fedorapython/fedora-python-tox:${{ matrix.arch }}
6770
- name: Login to DockerHub
6871
uses: docker/login-action@v1
6972
if: github.event_name == 'push' || github.event_name == 'schedule'

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,14 @@ You can install packages by any RPM *Provides*, for example:
173173
* pkgconfig names, e.g. `pkgconfig(libgit2)`, or
174174
* commands, e.g. `/usr/bin/cowsay`.
175175

176+
# WORKDIR
177+
178+
If your `tox.ini` file is not in the root directory of your project, set `WORKDIR` to the path you want to cd to before the tests are executed.
179+
180+
```
181+
docker run --rm -it -e TOXENV=py310-minimal -e GIT_URL=https://github.com/trezor/trezor-firmware.git -e WORKDIR=python fedora-python-tox
182+
```
183+
176184
# License
177185

178186
MIT

run_tests.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ if [ ! -z "$DNF_INSTALL" ]; then
1313
dnf -y --setopt=tsflags=nodocs --setopt=deltarpm=false install $DNF_INSTALL
1414
fi
1515

16+
if [ ! -z $WORKDIR ]; then
17+
echo "Changing directory to $WORKDIR"
18+
cd $WORKDIR
19+
fi
20+
1621
# Mark the current directory as safe for Git:
1722
git --git-dir=~ config --system --add safe.directory $PWD
1823

0 commit comments

Comments
 (0)