@@ -14,7 +14,7 @@ inputs:
14
14
required : true
15
15
default : " ."
16
16
architecture :
17
- description : " The architecture that's going to be used. Valid options are \" arm64\" and \" amd64 \" ."
17
+ description : " The architecture that's going to be used. Valid options are \" arm64\" , \" amd64 \" , and \" i386 \" (Windows/Linux only) ."
18
18
required : false
19
19
default : " amd64"
20
20
add-to-path :
@@ -28,18 +28,13 @@ inputs:
28
28
runs :
29
29
using : " composite"
30
30
steps :
31
- - name : Check operating system
32
- shell : bash
33
- run : |
34
- if [[ "$RUNNER_OS" == "Windows" ]]; then
35
- echo "The action doesn't support building on Windows. Exiting script."
36
- exit 1
37
- fi
38
31
- name : Install Homebrew if Needed
39
32
shell : bash
40
33
run : |
41
34
if [[ ${{ inputs.version }} == "latest" ]] || [[ ${{ inputs.version }} == "current" ]]; then
42
- /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
35
+ if [[ "$OSTYPE" == "darwin"* ]] || [[ "$OSTYPE" == "linux-gnu"* ]]; then
36
+ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
37
+ fi
43
38
if [[ "$OSTYPE" == "darwin"* ]]; then
44
39
echo 'export PATH="/usr/local/bin:$PATH"' >> $GITHUB_PATH
45
40
elif [[ "$OSTYPE" == "linux-gnu"* ]]; then
49
44
- name : Install dependencies
50
45
shell : bash
51
46
run : |
52
- if [[ ${{ inputs.version }} == "latest" ]] || [[ ${{ inputs.version }} == "current" ]]; then
47
+ if [[ ${{ inputs.version }} == "latest" ]] || [[ ${{ inputs.version }} == "current" ]] && [[ "$OSTYPE" != "Windows_NT" ]];
53
48
brew update
54
49
brew install jq
55
50
fi
@@ -61,39 +56,74 @@ runs:
61
56
directory="${directory%?}"
62
57
${{ inputs.directory }}=directory
63
58
fi
59
+
60
+ if [[ "$OS" == "Windows_NT" ]]; then
61
+ directory="${directory//\\//}"
62
+ ${{ inputs.directory }}=directory
63
+ fi
64
64
- name : Clone JuleC
65
65
shell : bash
66
66
run : |
67
67
if [[ ${{ inputs.version }} == "latest" ]] || [[ ${{ inputs.version }} == "current" ]]; then
68
68
RELEASES=$(curl -s https://api.github.com/repos/julelang/jule/releases)
69
69
LATEST_RELEASE=$(echo "$RELEASES" | jq -r '.[] | select(.draft == false) | .tarball_url' | head -n 1)
70
70
71
- curl -o julec.tar.gz $LATEST_RELEASE
72
- mkdir -p ${{ inputs.directory }}/julec-latest
73
- tar -xzf julec.tar.gz -C ${{ inputs.directory }}/julec-latest
71
+ if [[ "$OS" == "Windows_NT" ]]; then
72
+ curl -o julec.tar.gz $LATEST_RELEASE
73
+ mkdir -p ${{ inputs.directory }}\\julec-latest
74
+ tar -xzf julec.tar.gz -C ${{ inputs.directory }}\\julec-latest
75
+ else
76
+ curl -o julec.tar.gz $LATEST_RELEASE
77
+ mkdir -p ${{ inputs.directory }}/julec-latest
78
+ tar -xzf julec.tar.gz -C ${{ inputs.directory }}/julec-latest
79
+ fi
74
80
elif [[ ${{ inputs.version }} == "dev" ]]; then
75
81
git clone https://github.com/julelang/jule.git ${{ inputs.directory }}/julec-${{ inputs.version }}
76
82
else
77
- curl -o julec.tar.gz https://github.com/julelang/jule/archive/refs/tags/jule-${{ inputs.version }}.tar.gz -O julec.tar.gz
78
- mkdir -p ${{ inputs.directory }}/julec-${{ inputs.version }}
79
- tar -xzf julec.tar.gz -C ${{ inputs.directory }}/julec-${{ inputs.version }}
83
+ if [[ "$OS" == "Windows_NT" ]]; then
84
+ curl -o julec.tar.gz https://github.com/julelang/jule/archive/refs/tags/jule-${{ inputs.version }}.tar.gz -O julec.tar.gz
85
+ mkdir -p ${{ inputs.directory }}\\julec-${{ inputs.version }}
86
+ tar -xzf julec.tar.gz -C ${{ inputs.directory }}\\julec-${{ inputs.version }}
87
+ else
88
+ curl -o julec.tar.gz https://github.com/julelang/jule/archive/refs/tags/jule-${{ inputs.version }}.tar.gz -O julec.tar.gz
89
+ mkdir -p ${{ inputs.directory }}/julec-${{ inputs.version }}
90
+ tar -xzf julec.tar.gz -C ${{ inputs.directory }}/julec-${{ inputs.version }}
91
+ fi
80
92
fi
81
93
- name : Get JuleC IR
82
94
shell : bash
83
95
run : |
84
- cd ${{ inputs.directory }}/julec-${{ inputs.version }}
85
- curl -o ir.cpp https://raw.githubusercontent.com/julelang/julec-ir/main/src/$( [[ "$OSTYPE" == "darwin"* ]] && echo darwin || echo linux)-${{ inputs.architecture }}.cpp
96
+ if [[ "$OS" != "Windows_NT" ]]; then
97
+ cd ${{ inputs.directory }}/julec-${{ inputs.version }}
98
+ else
99
+ cd ${{ inputs.directory }}\\julec-${{ inputs.version }}
100
+ fi
101
+
102
+ architecture=${{ inputs.architecture }}
103
+ if [[ "$OSTYPE" == "darwin"* ]] && [[ "$architecture" == "i386" ]]; then
104
+ architecture="amd64"
105
+ fi
106
+
107
+ curl -o ir.cpp https://raw.githubusercontent.com/julelang/julec-ir/main/src/$( [[ "$OS" == "Windows_NT" ]] && echo windows || ([[ "$OSTYPE" == "darwin"* ]] && echo darwin || echo linux))-$architecture.cpp
86
108
- name : Compile JuleC
87
109
shell : bash
88
110
run : |
89
- cd ${{ inputs.directory }}/julec-${{ inputs.version }}
111
+ if [[ "$OS" != "Windows_NT" ]]; then
112
+ cd ${{ inputs.directory }}/julec-${{ inputs.version }}
113
+ else
114
+ cd ${{ inputs.directory }}\\julec-${{ inputs.version }}
115
+ fi
90
116
mkdir bin
91
117
clang++ -O0 --std=c++17 -Wno-everything -o bin/julec ir.cpp
92
118
- name : Add JuleC to the PATH
93
119
shell : bash
94
120
run : |
95
121
if [[ ${{ inputs.add-to-path }} == true ]]; then
96
- echo "export PATH=\$PATH:${{ inputs.directory }}/julec-${{ inputs.version }}/bin/" >> $GITHUB_PATH
122
+ if [[ "$OS" == "Windows_NT" ]]; then
123
+ echo "${{ inputs.directory }}\\julec-${{ inputs.version }}\\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
124
+ else
125
+ echo "export PATH=\$PATH:${{ inputs.directory }}/julec-${{ inputs.version }}/bin/" >> $GITHUB_PATH
126
+ fi
97
127
fi
98
128
- name : Run extra commands
99
129
shell : bash
@@ -102,6 +132,9 @@ runs:
102
132
if [[ ${{ inputs.add-to-path }} == true ]]; then
103
133
julec ${{ inputs.extra-command }}
104
134
else
105
- ${{ inputs.directory }}/julec-${{ inputs.version }}/bin/julec ${{ inputs.extra-command }}
135
+ if [[ "$OS" != "Windows_NT" ]]; then
136
+ ${{ inputs.directory }}/julec-${{ inputs.version }}/bin/julec ${{ inputs.extra-command }}
137
+ else
138
+ ${{ inputs.directory }}\\julec-${{ inputs.version }}\\bin\\julec ${{ inputs.extra-command }}
106
139
fi
107
140
fi
0 commit comments