Skip to content

Commit

Permalink
fix: workaround annoying race condition in upstream
Browse files Browse the repository at this point in the history
  • Loading branch information
Enter-tainer committed Jul 14, 2024
1 parent 7078e15 commit cf52e92
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 5 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@ jobs:
run: |
cargo fmt --all -- --check
cargo clippy --all-targets --all-features -- -D warnings
- name: Install typst
uses: typst-community/setup-typst@v3
- name: Warmup typst package cache
run: |
python ./scripts/generate-imports.py
typst compile output.typ
- name: Run Unit tests
run: cargo nextest run -E 'not test(~e2e)' --no-fail-fast
- name: Run E2E tests
Expand Down
23 changes: 23 additions & 0 deletions scripts/generate-imports.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/usr/bin/env python
import os


def process_files(directory):
import_list = []
for root, dirs, files in os.walk(directory):
for file in files:
if file.endswith(".typ"):
file_path = os.path.join(root, file)
with open(file_path, "r", encoding="utf-8") as f:
for line in f:
line = line.strip()
if line.startswith('#import "@preview'):
import_list.append(line)
with open("output.typ", "w", encoding="utf-8") as f:
for line in import_list:
f.write(line + "\n")


if __name__ == "__main__":
directory = "./" # replace with your directory
process_files(directory)
2 changes: 1 addition & 1 deletion tests/assets/book.typ
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

#import "@preview/book:0.2.2": *
// #import "@preview/book:0.2.2": *

#show: book

Expand Down
2 changes: 1 addition & 1 deletion tests/snapshots/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ source: tests/assets.rs
expression: doc_string
input_file: tests/assets/book.typ
---
#import "@preview/book:0.2.2": *
// #import "@preview/book:0.2.2": *

#show: book

Expand Down
2 changes: 1 addition & 1 deletion tests/snapshots/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ source: tests/assets.rs
expression: doc_string
input_file: tests/assets/book.typ
---
#import "@preview/book:0.2.2": *
// #import "@preview/book:0.2.2": *

#show: book

Expand Down
2 changes: 1 addition & 1 deletion tests/snapshots/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ source: tests/assets.rs
expression: doc_string
input_file: tests/assets/book.typ
---
#import "@preview/book:0.2.2": *
// #import "@preview/book:0.2.2": *

#show: book

Expand Down
2 changes: 1 addition & 1 deletion tests/snapshots/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ source: tests/assets.rs
expression: doc_string
input_file: tests/assets/book.typ
---
#import "@preview/book:0.2.2": *
// #import "@preview/book:0.2.2": *

#show: book

Expand Down

0 comments on commit cf52e92

Please sign in to comment.