Skip to content

Commit f5f24db

Browse files
committed
Add full Windows support
1 parent fa857f9 commit f5f24db

File tree

3 files changed

+81
-31
lines changed

3 files changed

+81
-31
lines changed

.github/workflows/test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ jobs:
55
runs-on: ${{ matrix.os }}
66
strategy:
77
matrix:
8-
os: [ubuntu-latest, macOS-latest]
8+
os: [ubuntu-latest, macOS-latest, windows-latest]
99
steps:
1010
- uses: actions/checkout@v3
1111
- name: Setup Jule
12-
uses: Panquesito7/setup-jule@main
12+
uses: Panquesito7/setup-jule@windows_support
1313
with:
1414
version: dev
1515
directory: .

README.md

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ jobs:
1818
runs-on: ubuntu-latest
1919
steps:
2020
- uses: actions/checkout@v3
21-
- uses: Panquesito7/setup-jule@v1.1.2
21+
- uses: Panquesito7/setup-jule@v1.2.0
2222
with:
2323
version: latest # https://github.com/julelang/jule/releases for all JuleC versions.
2424
directory: . # The directory where JuleC will be installed.
25-
architecture: amd64 # Architecture that will be used. Valid options are `amd64` and `arm64` (optional).
25+
architecture: amd64 # Architecture that will be used. Valid options are `amd64`, `arm64`, and `i386` (Windows/Linux only; optional).
2626
add-to-path: false # Whether to add JuleC to the PATH or not (optional).
2727
extra-command: version # Extra command that will be run after compiling JuleC (optional; see below for more information).
2828
```
@@ -38,7 +38,7 @@ Release syntax is taken from the official [JuleC releases](https://github.com/ju
3838
### Architecture
3939

4040
The architecture that will be used to install JuleC.\
41-
`arm64` and `amd64` can be used. `amd64` is the recommended architecture.
41+
`arm64`, `amd64`, and `i386` (Windows/Linux only) can be used. `amd64` is the recommended architecture.
4242

4343
### Extra command
4444

@@ -52,9 +52,9 @@ You can see the full list of commands in the [official manual](https://manual.ju
5252

5353
```yml
5454
- uses: actions/checkout@v3
55-
- uses: Panquesito7/setup-jule@v1.1.2
55+
- uses: Panquesito7/setup-jule@v1.2.0
5656
with:
57-
version: beta-0.0.2
57+
version: beta-0.0.3
5858
directory: ./libs
5959
architecture: amd64
6060
add-to-path: true
@@ -63,10 +63,27 @@ You can see the full list of commands in the [official manual](https://manual.ju
6363

6464
## Supported operating systems
6565

66-
Currently, macOS and Linux are supported, just like JuleC itself.\
67-
Windows support will be added once JuleC supports Windows.
66+
All the major operating systems are supported, being **Windows**, **Linux**, and **macOS**.\
67+
You can easily compile Jule code in all OSes or specific ones by changing the operating system.
6868

69-
For more information: <https://github.com/julelang/jule/issues/34>
69+
In this example, the action will run in the three operating systems.
70+
71+
```yml
72+
...
73+
runs-on: ${{ matrix.os }}
74+
strategy:
75+
matrix:
76+
os: [ubuntu-latest, macOS-latest, windows-latest]
77+
steps:
78+
- uses: actions/checkout@v3
79+
- name: Setup Jule
80+
uses: Panquesito7/[email protected]
81+
with:
82+
version: dev
83+
directory: .
84+
add-to-path: true
85+
...
86+
```
7087

7188
## License
7289

action.yml

Lines changed: 54 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ inputs:
1414
required: true
1515
default: "."
1616
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)."
1818
required: false
1919
default: "amd64"
2020
add-to-path:
@@ -28,18 +28,13 @@ inputs:
2828
runs:
2929
using: "composite"
3030
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
3831
- name: Install Homebrew if Needed
3932
shell: bash
4033
run: |
4134
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
4338
if [[ "$OSTYPE" == "darwin"* ]]; then
4439
echo 'export PATH="/usr/local/bin:$PATH"' >> $GITHUB_PATH
4540
elif [[ "$OSTYPE" == "linux-gnu"* ]]; then
@@ -49,7 +44,7 @@ runs:
4944
- name: Install dependencies
5045
shell: bash
5146
run: |
52-
if [[ ${{ inputs.version }} == "latest" ]] || [[ ${{ inputs.version }} == "current" ]]; then
47+
if [[ ${{ inputs.version }} == "latest" ]] || [[ ${{ inputs.version }} == "current" ]] && [[ "$OSTYPE" != "Windows_NT" ]];
5348
brew update
5449
brew install jq
5550
fi
@@ -61,39 +56,74 @@ runs:
6156
directory="${directory%?}"
6257
${{ inputs.directory }}=directory
6358
fi
59+
60+
if [[ "$OS" == "Windows_NT" ]]; then
61+
directory="${directory//\\//}"
62+
${{ inputs.directory }}=directory
63+
fi
6464
- name: Clone JuleC
6565
shell: bash
6666
run: |
6767
if [[ ${{ inputs.version }} == "latest" ]] || [[ ${{ inputs.version }} == "current" ]]; then
6868
RELEASES=$(curl -s https://api.github.com/repos/julelang/jule/releases)
6969
LATEST_RELEASE=$(echo "$RELEASES" | jq -r '.[] | select(.draft == false) | .tarball_url' | head -n 1)
7070
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
7480
elif [[ ${{ inputs.version }} == "dev" ]]; then
7581
git clone https://github.com/julelang/jule.git ${{ inputs.directory }}/julec-${{ inputs.version }}
7682
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
8092
fi
8193
- name: Get JuleC IR
8294
shell: bash
8395
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
86108
- name: Compile JuleC
87109
shell: bash
88110
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
90116
mkdir bin
91117
clang++ -O0 --std=c++17 -Wno-everything -o bin/julec ir.cpp
92118
- name: Add JuleC to the PATH
93119
shell: bash
94120
run: |
95121
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
97127
fi
98128
- name: Run extra commands
99129
shell: bash
@@ -102,6 +132,9 @@ runs:
102132
if [[ ${{ inputs.add-to-path }} == true ]]; then
103133
julec ${{ inputs.extra-command }}
104134
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 }}
106139
fi
107140
fi

0 commit comments

Comments
 (0)