summaryrefslogtreecommitdiff
path: root/.github/workflows/release.yml
blob: 32ef7bfc27105c7ceaadab084ce62a44540403b9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
name: release
env:
  ODIN_BRANCH: dev-2025-10

on:
  workflow_dispatch:
  schedule:
    - cron: 0 2 * * 0 # weekly 'nightly' release
  push:
    tags:
      - dev-**

jobs:
  dist-arm64-darwin:
    runs-on: macos-latest
    timeout-minutes: 15
    steps:
    - uses: actions/checkout@v1
    - name: Set ODIN_BRANCH from tag if available
      if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
      run: |
        echo "ODIN_BRANCH=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
        echo "OLS_VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
    - name: Download LLVM and setup PATH
      run: |
        brew install llvm@17
        echo "/opt/homebrew/opt/llvm@17/bin" >> $GITHUB_PATH
    - name: Download Odin
      run: |
        git clone --depth 1 --branch $ODIN_BRANCH https://github.com/odin-lang/Odin
    - name: Build Odin
      run: |
        cd Odin
        ./build_odin.sh release
    - name: Build ols
      run: ./ci.sh CI_NO_TESTS -target:darwin_arm64 -extra-linker-flags:"--target=arm64-apple-macos"
    - name: Move to Dist
      run: |
        mkdir dist
        mv ols dist/ols-arm64-darwin
    - name: Upload artifacts
      uses: actions/upload-artifact@v4
      with:
        name: dist-arm64-darwin
        path: ./dist

  dist-x86_64-darwin:
    runs-on: macos-15-intel
    timeout-minutes: 15
    steps:
    - uses: actions/checkout@v1
    - name: Set ODIN_BRANCH from tag if available
      if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
      run: |
        echo "ODIN_BRANCH=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
        echo "OLS_VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
    - name: Download LLVM and setup PATH
      run: |
        brew install llvm@17
        echo "/usr/local/opt/llvm@17/bin" >> $GITHUB_PATH
        TMP_PATH=$(xcrun --show-sdk-path)/user/include
        echo "CPATH=$TMP_PATH" >> $GITHUB_ENV
    - name: Download Odin
      run: |
        git clone --depth 1 --branch $ODIN_BRANCH https://github.com/odin-lang/Odin
    - name: Build Odin
      run: |
        cd Odin
        make release
    - name: Build ols
      run: ./ci.sh CI
    - name: Move to Dist
      run: |
        mkdir dist
        mv ols dist/ols-x86_64-darwin
    - name: Upload artifacts
      uses: actions/upload-artifact@v4
      with:
        name: dist-x86_64-darwin 
        path: ./dist

  dist-x86_64-unknown-linux-gnu:
    timeout-minutes: 30
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v1
    - name: Set ODIN_BRANCH from tag if available
      if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
      run: |
        echo "ODIN_BRANCH=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
        echo "OLS_VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
    - name: Download LLVM
      run:  |
        wget https://apt.llvm.org/llvm.sh
        chmod +x llvm.sh
        sudo ./llvm.sh 17
        echo "/usr/lib/llvm-17/bin" >> $GITHUB_PATH
    - name: Download Odin
      run: |
        git clone --depth 1 --branch $ODIN_BRANCH https://github.com/odin-lang/Odin
    - name: Build Odin
      run: |
        cd Odin
        ./build_odin.sh release
    - name: Build ols
      run: ./ci.sh CI
    - name: Move to Dist
      run: |
        mkdir dist
        mv ols dist/ols-x86_64-unknown-linux-gnu
    - name: Upload artifacts
      uses: actions/upload-artifact@v4
      with:
        name: dist-x86_64-unknown-linux-gnu
        path: ./dist

  dist-arm64-unknown-linux-gnu:
    timeout-minutes: 30
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v1
    - name: Set ODIN_BRANCH from tag if available
      if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
      run: |
        echo "ODIN_BRANCH=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
        echo "OLS_VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
    - name: Download LLVM
      run:  |
        wget https://apt.llvm.org/llvm.sh
        chmod +x llvm.sh
        sudo ./llvm.sh 17
        echo "/usr/lib/llvm-17/bin" >> $GITHUB_PATH
    - name: Download Odin
      run: |
        git clone --depth 1 --branch $ODIN_BRANCH https://github.com/odin-lang/Odin
    - name: Build Odin
      run: |
        cd Odin
        ./build_odin.sh release
    - name: Install ARM64 cross-compilation toolchain (for linker)
      run: sudo apt install gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
    - name: Build ols
      run: ./ci.sh CI_NO_TESTS -target:linux_arm64 -linker:lld -microarch:generic -extra-linker-flags:'--target=aarch64-linux-gnu'
    - name: Move to Dist
      run: |
        mkdir dist
        mv ols dist/ols-arm64-unknown-linux-gnu
    - name: Upload artifacts
      uses: actions/upload-artifact@v4
      with:
        name: dist-arm64-unknown-linux-gnu
        path: ./dist

  dist-x86_64-pc-windows-msvc:
    timeout-minutes: 30
    runs-on: windows-latest
    steps:
    - uses: actions/checkout@v1
    - name: Set ODIN_BRANCH from tag if available
      if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
      shell: pwsh
      run: |
        $tagName = $env:GITHUB_REF.Replace('refs/tags/', '')
        echo "ODIN_BRANCH=$tagName" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
        echo "OLS_VERSION=$tagName" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
    - name: Download Odin
      shell: cmd
      run: |
        git clone --depth 1 --branch %ODIN_BRANCH% https://github.com/odin-lang/Odin
    - name: Build Odin
      shell: cmd
      run: |
        call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat
        cd Odin
        ./build.bat 1
    - name: Build ols
      shell: cmd
      run: ./ci.bat CI
    - name: Move to Dist
      shell: cmd
      run: |
        mkdir dist
        move ols.exe dist/
        move builtin dist/
        cd dist
        ren ols.exe ols-x86_64-pc-windows-msvc.exe
    - name: Upload artifacts
      uses: actions/upload-artifact@v4
      with:
        name: dist-x86_64-pc-windows-msvc
        path: ./dist
  publish:
    name: publish
    runs-on: ubuntu-latest
    timeout-minutes: 30
    needs: ['dist-x86_64-pc-windows-msvc', 'dist-x86_64-unknown-linux-gnu', 'dist-arm64-unknown-linux-gnu', 'dist-x86_64-darwin', 'dist-arm64-darwin']
    steps:
    - name: Install Nodejs
      uses: actions/setup-node@v1
      with:
        node-version: 16.x
    - name: Checkout repository
      uses: actions/checkout@v2
      with:
        fetch-depth: ${{ env.FETCH_DEPTH }}

    - run: echo "HEAD_SHA=$(git rev-parse HEAD)" >> $GITHUB_ENV
    - run: 'echo "HEAD_SHA: $HEAD_SHA"'

    - uses: actions/download-artifact@v4.1.7
      with:
        name: dist-x86_64-unknown-linux-gnu
        path: dist
    - uses: actions/download-artifact@v4.1.7
      with:
        name: dist-arm64-unknown-linux-gnu
        path: dist
    - uses: actions/download-artifact@v4.1.7
      with:
        name: dist-x86_64-pc-windows-msvc
        path: dist
    - uses: actions/download-artifact@v4.1.7
      with:
        name: dist-x86_64-darwin
        path: dist
    - uses: actions/download-artifact@v4.1.7
      with:
        name: dist-arm64-darwin
        path: dist
    - run: |
        ls -al ./dist
        cd dist
        zip -r ols-x86_64-pc-windows-msvc.zip ols-x86_64-pc-windows-msvc.exe builtin
        rm ols-x86_64-pc-windows-msvc.exe

        chmod +x ols-x86_64-unknown-linux-gnu
        zip -r ols-x86_64-unknown-linux-gnu.zip ols-x86_64-unknown-linux-gnu builtin
        rm ols-x86_64-unknown-linux-gnu

        chmod +x ols-arm64-unknown-linux-gnu
        zip -r ols-arm64-unknown-linux-gnu.zip ols-arm64-unknown-linux-gnu builtin
        rm ols-arm64-unknown-linux-gnu

        chmod +x ols-x86_64-darwin
        zip -r ols-x86_64-darwin.zip ols-x86_64-darwin builtin
        rm ols-x86_64-darwin

        chmod +x ols-arm64-darwin
        zip -r ols-arm64-darwin.zip ols-arm64-darwin builtin
        rm ols-arm64-darwin

        rm -rf builtin
    - name: Publish Release
      uses: ./.github/actions/github-release
      with:
        files: "dist/*"
        name: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') && github.ref_name || 'nightly' }}
        token: ${{ secrets.GITHUB_TOKEN }}