aboutsummaryrefslogtreecommitdiff
path: root/.github/workflows/nightly.yml
blob: 7175843f5ce4f728e61fd2c38df9f4dfcaad2121 (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
name:  Nightly

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

jobs:
  build_windows:
    runs-on: windows-2019
    steps:
      - uses: actions/checkout@v1
      - name: build Odin
        shell: cmd
        run: |
          call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat
          ./build.bat 1 1
      - name: Odin run
        shell: cmd
        run: |
          call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat
          odin run examples/demo/demo.odin
      - name: Copy artifacts
        run: |
          rm bin/llvm/windows/LLVM-C.lib
          mkdir dist
          cp odin.exe dist
          cp LLVM-C.dll dist
          cp -r shared dist
          cp -r core dist
          cp -r vendor dist
          cp -r bin dist
          cp -r examples dist
      - name: Upload artifact
        uses: actions/upload-artifact@v1
        with:
          name: windows_artifacts
          path: dist
  build_ubuntu:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v1
      - name: (Linux) Download LLVM
        run: sudo apt-get install llvm-11 clang-11 llvm
      - name: build odin
        run: make nightly
      - name: Odin run
        run: ./odin run examples/demo/demo.odin
      - name: Copy artifacts
        run: |
          mkdir dist
          cp odin dist
          cp -r shared dist
          cp -r core dist
          cp -r vendor dist
          cp -r examples dist
      - name: Upload artifact
        uses: actions/upload-artifact@v1
        with:
          name: ubuntu_artifacts
          path: dist
  build_macos:
    runs-on: macOS-latest
    steps:
      - uses: actions/checkout@v1
      - name: Download LLVM and setup PATH
        run: |
          brew install llvm@11
          echo "/usr/local/opt/llvm@11/bin" >> $GITHUB_PATH
          TMP_PATH=$(xcrun --show-sdk-path)/user/include
          echo "CPATH=$TMP_PATH" >> $GITHUB_ENV
      - name: build odin
        run: make nightly
      - name: Odin run
        run: ./odin run examples/demo/demo.odin
      - name: Copy artifacts
        run: |
          mkdir dist
          cp odin dist
          cp -r shared dist
          cp -r core dist
          cp -r vendor dist
          cp -r examples dist
      - name: Upload artifact
        uses: actions/upload-artifact@v1
        with:
          name: macos_artifacts
          path: dist
  upload_b2:
    runs-on: [ubuntu-latest]
    needs: [build_windows, build_macos, build_ubuntu]
    steps:
      - uses: actions/checkout@v1
      - uses: actions/setup-python@v2
        with:
          python-version: '3.8.x'

      - name: Install B2 CLI
        shell: bash
        run: |
          python -m pip install --upgrade pip
          pip install --upgrade b2

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

      - name: Download Windows artifacts
        uses: actions/download-artifact@v1
        with:
          name: windows_artifacts

      - name: Download Ubuntu artifacts
        uses: actions/download-artifact@v1
        with:
          name: ubuntu_artifacts

      - name: Download macOS artifacts
        uses: actions/download-artifact@v1
        with:
          name: macos_artifacts

      - 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: |
          echo Authorizing B2 account
          b2 authorize-account "$APPID" "$APPKEY"
          
          echo Uploading artifcates to B2
          chmod +x ./ci/upload_create_nightly.sh
          ./ci/upload_create_nightly.sh "$BUCKET" windows-amd64 windows_artifacts/
          ./ci/upload_create_nightly.sh "$BUCKET" ubuntu-amd64 ubuntu_artifacts/
          ./ci/upload_create_nightly.sh "$BUCKET" macos-amd64 macos_artifacts/

          echo Deleting old artifacts in B2
          python3 ci/delete_old_binaries.py "$BUCKET" "$DAYS_TO_KEEP"

          echo Creating nightly.json
          python3 ci/create_nightly_json.py "$BUCKET" > nightly.json
          
          echo Uploading nightly.json
          b2 upload-file "$BUCKET" nightly.json nightly.json

          echo Clear B2 account info
          b2 clear-account