Skip to content

Commit bff871b

Browse files
committed
try to save source tree as artifact
1 parent 83c739a commit bff871b

File tree

3 files changed

+21
-0
lines changed

3 files changed

+21
-0
lines changed

.github/workflows/tests.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,20 @@ jobs:
9090
run: |
9191
make ${{ matrix.test_chapter }}
9292
93+
- name: Save tempdir path to an env var
94+
if: always()
95+
shell: bash
96+
run: |
97+
TMPDIR_PATH=$(cat .tmpdir.${{ matrix.test_chapter }})
98+
echo "TMPDIR_PATH=$TMPDIR_PATH" >> $GITHUB_ENV
99+
100+
- name: Archive the temp dir
101+
uses: actions/upload-artifact@v4
102+
if: always()
103+
with:
104+
name: test-source-${{ matrix.test_chapter }}
105+
path: ${{ env.TMPDIR_PATH }}
106+
93107
- name: Archive the built html files
94108
uses: actions/upload-artifact@v4
95109
if: always()
@@ -98,3 +112,5 @@ jobs:
98112
path: |
99113
*.html
100114
*.css
115+
116+

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,4 @@
4242
/tech review/
4343
.vagrant.d
4444
*.egg-info
45+
.tmpdir.*

tests/book_tester.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,7 @@ def fix_interactive_managepy_stuff(actual_text):
221221

222222

223223
class ChapterTest(unittest.TestCase):
224+
chapter_name = "override me"
224225
maxDiff = None
225226

226227
def setUp(self):
@@ -234,6 +235,9 @@ def setUp(self):
234235

235236
def tearDown(self):
236237
print(f"finished running test in {self.sourcetree.tempdir}")
238+
print("writing tmpdir out to", f".tmpdir.test_{self.chapter_name}")
239+
with open(f".tmpdir.test_{self.chapter_name}", "w") as f:
240+
f.write(str(self.sourcetree.tempdir))
237241
self.sourcetree.cleanup()
238242

239243
def parse_listings(self):

0 commit comments

Comments
 (0)