Skip to content

Commit f83fd11

Browse files
authored
Disable universal newlines and support windows (#42)
1 parent 93b1e86 commit f83fd11

File tree

3 files changed

+33
-0
lines changed

3 files changed

+33
-0
lines changed

.github/workflows/self-test.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,32 @@ on:
33
pull_request:
44

55
jobs:
6+
os-test:
7+
runs-on: ${{ matrix.os }}
8+
strategy:
9+
fail-fast: false
10+
matrix:
11+
os:
12+
- ubuntu-latest
13+
- macos-latest
14+
- windows-latest
15+
steps:
16+
- uses: actions/checkout@v4
17+
- name: kamidana
18+
id: kamidana
19+
uses: ./
20+
with:
21+
template: testdata/default-example.j2
22+
output_file: test.txt
23+
tee: true
24+
- name: Test
25+
shell: bash
26+
run: |
27+
cat << 'EOS' | tee output.txt
28+
${{ steps.kamidana.outputs.text }}
29+
EOS
30+
diff output.txt test.txt
31+
632
dump-context:
733
runs-on: ubuntu-latest
834
steps:

action.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ runs:
9696
JOB_CONTEXT: ${{ toJson(job) }}
9797
RUNNER_CONTEXT: ${{ toJson(runner) }}
9898
INPUTS_GITHUB_TOKEN: ${{ inputs.github_token }}
99+
PYTHONUTF8: 1
99100
run: "${GITHUB_ACTION_PATH}/entorypoint.sh"
100101
working-directory: ${{ inputs.working-directory }}
101102

additionals/io.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,13 @@
22
as_filter,
33
)
44
from jinja2 import pass_context
5+
import io
56
import os
7+
import sys
8+
9+
10+
# no univeral newlines
11+
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, newline='')
612

713

814
@as_filter

0 commit comments

Comments
 (0)