aboutsummaryrefslogtreecommitdiff
path: root/.github/workflows/nightly.yml
blob: 2c9dc30aed503f8acaff23d9b8624a00a209bf45 (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
259
260
261
262
263
264
265
266
267
268
269
270
name:  Nightly

on:
  workflow_dispatch:
  schedule:
    - cron: 0 20 * * *

jobs:
  build_windows:
    name: Windows Build
    if: github.repository == 'odin-lang/Odin'
    runs-on: windows-2022
    steps:
      - uses: actions/checkout@v4
      - name: build Odin
        shell: cmd
        run: |
          call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat
          ./build.bat 1 1
      - name: Odin run
        shell: cmd
        run: |
          call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat
          odin run examples/demo
      - name: Copy artifacts
        run: |
          rm bin/llvm/windows/LLVM-C.lib
          mkdir dist
          cp odin.exe dist
          cp LICENSE dist
          cp LLVM-C.dll dist
          cp -r shared dist
          cp -r base dist
          cp -r core dist
          cp -r vendor dist
          cp -r bin dist
          cp -r examples dist
      - name: Upload artifact
        uses: actions/upload-artifact@v4
        with:
          include-hidden-files: true
          name: windows_artifacts
          path: dist
  build_linux:
    name: Linux Build
    if: github.repository == 'odin-lang/Odin'
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: (Linux) Download LLVM and Build Odin
        run: |
          docker run --rm -v "$PWD:/src" -w /src alpine sh -c '
            apk add --no-cache \
              musl-dev llvm20-dev clang20 git mold lz4 \
              libxml2-static llvm20-static zlib-static zstd-static \
              make &&
            ./ci/build_linux_static.sh
          '
      - name: Odin run
        run: ./odin run examples/demo
      - name: Copy artifacts
        run: |
          FILE="odin-linux-amd64-nightly+$(date -I)"
          mkdir $FILE
          cp odin $FILE
          cp LICENSE $FILE
          cp -r shared $FILE
          cp -r base $FILE
          cp -r core $FILE
          cp -r vendor $FILE
          cp -r examples $FILE
          ./ci/remove_windows_binaries.sh $FILE
          # Creating a tarball so executable permissions are retained, see https://github.com/actions/upload-artifact/issues/38
          tar -czvf dist.tar.gz $FILE
      - name: Odin run
        run: |
          FILE="odin-linux-amd64-nightly+$(date -I)"
          $FILE/odin run examples/demo
      - name: Upload artifact
        uses: actions/upload-artifact@v4
        with:
          name: linux_artifacts
          path: dist.tar.gz
  build_linux_arm:
    name: Linux ARM Build
    if: github.repository == 'odin-lang/Odin'
    runs-on: ubuntu-24.04-arm
    steps:
      - uses: actions/checkout@v4
      - name: (Linux ARM) Download LLVM and Build Odin
        run: |
          docker run --rm -v "$PWD:/src" -w /src arm64v8/alpine sh -c '
            apk add --no-cache \
              musl-dev llvm20-dev clang20 git mold lz4 \
              libxml2-static llvm20-static zlib-static zstd-static \
              make &&
            ./ci/build_linux_static.sh
          '
      - name: Odin run
        run: ./odin run examples/demo
      - name: Copy artifacts
        run: |
          FILE="odin-linux-arm64-nightly+$(date -I)"
          mkdir $FILE
          cp odin $FILE
          cp LICENSE $FILE
          cp -r shared $FILE
          cp -r base $FILE
          cp -r core $FILE
          cp -r vendor $FILE
          cp -r examples $FILE
          ./ci/remove_windows_binaries.sh $FILE
          # Creating a tarball so executable permissions are retained, see https://github.com/actions/upload-artifact/issues/38
          tar -czvf dist.tar.gz $FILE
      - name: Odin run
        run: |
          FILE="odin-linux-arm64-nightly+$(date -I)"
          $FILE/odin run examples/demo
      - name: Upload artifact
        uses: actions/upload-artifact@v4
        with:
          name: linux_arm_artifacts
          path: dist.tar.gz
  build_macos:
    name: MacOS Build
    if: github.repository == 'odin-lang/Odin'
    runs-on: macos-13
    steps:
      - uses: actions/checkout@v4
      - name: Download LLVM and setup PATH
        run: |
          brew update
          brew install llvm@20 dylibbundler lld

      - name: build odin
        # These -L makes the linker prioritize system libraries over LLVM libraries, this is mainly to
        # not link with libunwind bundled with LLVM but link with libunwind on the system.
        run: CXXFLAGS="-L/usr/lib/system -L/usr/lib" make nightly
      - name: Bundle
        run: |
          FILE="odin-macos-amd64-nightly+$(date -I)"
          mkdir $FILE
          cp odin $FILE
          cp LICENSE $FILE
          cp -r shared $FILE
          cp -r base $FILE
          cp -r core $FILE
          cp -r vendor $FILE
          cp -r examples $FILE
          ./ci/remove_windows_binaries.sh $FILE
          dylibbundler -b -x $FILE/odin -d $FILE/libs -od -p @executable_path/libs
          # Creating a tarball so executable permissions are retained, see https://github.com/actions/upload-artifact/issues/38
          tar -czvf dist.tar.gz $FILE
      - name: Odin run
        run: |
          FILE="odin-macos-amd64-nightly+$(date -I)"
          $FILE/odin run examples/demo
      - name: Upload artifact
        uses: actions/upload-artifact@v4
        with:
          name: macos_artifacts
          path: dist.tar.gz
  build_macos_arm:
    name: MacOS ARM Build
    if: github.repository == 'odin-lang/Odin'
    runs-on: macos-14 # ARM machine
    steps:
      - uses: actions/checkout@v4
      - name: Download LLVM and setup PATH
        run: |
          brew update
          brew install llvm@20 dylibbundler lld

      - name: build odin
        # These -L makes the linker prioritize system libraries over LLVM libraries, this is mainly to
        # not link with libunwind bundled with LLVM but link with libunwind on the system.
        run: CXXFLAGS="-L/usr/lib/system -L/usr/lib" make nightly
      - name: Bundle
        run: |
          FILE="odin-macos-arm64-nightly+$(date -I)"
          mkdir $FILE
          cp odin $FILE
          cp LICENSE $FILE
          cp -r shared $FILE
          cp -r base $FILE
          cp -r core $FILE
          cp -r vendor $FILE
          cp -r examples $FILE
          ./ci/remove_windows_binaries.sh $FILE
          dylibbundler -b -x $FILE/odin -d $FILE/libs -od -p @executable_path/libs
          # Creating a tarball so executable permissions are retained, see https://github.com/actions/upload-artifact/issues/38
          tar -czvf dist.tar.gz $FILE
      - name: Odin run
        run: |
          FILE="odin-macos-arm64-nightly+$(date -I)"
          $FILE/odin run examples/demo
      - name: Upload artifact
        uses: actions/upload-artifact@v4
        with:
          name: macos_arm_artifacts
          path: dist.tar.gz
  upload_b2:
    runs-on: [ubuntu-latest]
    needs: [build_windows, build_macos, build_macos_arm, build_linux, build_linux_arm]
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-python@v5
        with:
          python-version: '3.8.x'

      - name: Install B2 SDK
        shell: bash
        run: |
          python -m pip install --upgrade pip
          pip install --upgrade b2sdk

      - name: Display Python version
        run: python -c "import sys; print(sys.version)"

      - name: Download Windows artifacts

        uses: actions/download-artifact@v4.1.7
        with:
          name: windows_artifacts
          path: windows_artifacts

      - name: Download Ubuntu artifacts
        uses: actions/download-artifact@v4.1.7
        with:
          name: linux_artifacts
          path: linux_artifacts

      - name: Download Ubuntu ARM artifacts
        uses: actions/download-artifact@v4.1.7
        with:
          name: linux_arm_artifacts
          path: linux_arm_artifacts

      - name: Download macOS artifacts
        uses: actions/download-artifact@v4.1.7
        with:
          name: macos_artifacts
          path: macos_artifacts

      - name: Download macOS arm artifacts
        uses: actions/download-artifact@v4.1.7
        with:
          name: macos_arm_artifacts
          path: macos_arm_artifacts

      - name: Debug
        run: |
          tree -L 2

      - name: Create archives and upload
        shell: bash
        env:
          APPID: ${{ secrets.B2_APPID }}
          APPKEY: ${{ secrets.B2_APPKEY }}
          BUCKET: ${{ secrets.B2_BUCKET }}
          DAYS_TO_KEEP: ${{ secrets.B2_DAYS_TO_KEEP }}
        run: |
          file linux_artifacts/dist.tar.gz
          python3 ci/nightly.py artifact windows-amd64 windows_artifacts/
          python3 ci/nightly.py artifact linux-amd64 linux_artifacts/dist.tar.gz
          python3 ci/nightly.py artifact linux-arm64 linux_arm_artifacts/dist.tar.gz
          python3 ci/nightly.py artifact macos-amd64 macos_artifacts/dist.tar.gz
          python3 ci/nightly.py artifact macos-arm64 macos_arm_artifacts/dist.tar.gz
          python3 ci/nightly.py prune
          python3 ci/nightly.py json