mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 15:48:51 +00:00
Merge pull request #606 from ThisDrunkDane/nightly-build
CI for nightly builds
This commit is contained in:
@@ -42,7 +42,7 @@ jobs:
|
|||||||
shell: cmd
|
shell: cmd
|
||||||
run: |
|
run: |
|
||||||
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat
|
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat
|
||||||
./build_ci.bat
|
./ci/build_ci.bat
|
||||||
- name: Odin run
|
- name: Odin run
|
||||||
shell: cmd
|
shell: cmd
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
@@ -0,0 +1,126 @@
|
|||||||
|
name: Nightly
|
||||||
|
on:
|
||||||
|
schedule:
|
||||||
|
- cron: 0 20 * * *
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build_windows:
|
||||||
|
runs-on: windows-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v1
|
||||||
|
- name: Install cURL
|
||||||
|
run: choco install curl
|
||||||
|
- name: Download and unpack LLVM bins
|
||||||
|
shell: cmd
|
||||||
|
run: |
|
||||||
|
cd bin
|
||||||
|
curl -sL https://github.com/odin-lang/Odin/releases/download/llvm-windows/llvm-binaries.zip --output llvm-binaries.zip
|
||||||
|
7z x llvm-binaries.zip > nul
|
||||||
|
- name: build Odin
|
||||||
|
shell: cmd
|
||||||
|
run: |
|
||||||
|
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat
|
||||||
|
./ci/build_ci.bat
|
||||||
|
- 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: |
|
||||||
|
mkdir dist
|
||||||
|
cp odin.exe dist
|
||||||
|
cp -r shared dist
|
||||||
|
cp -r core 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
|
||||||
|
- name: build odin
|
||||||
|
run: make release
|
||||||
|
- 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 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
|
||||||
|
echo ::add-path::/usr/local/opt/llvm/bin
|
||||||
|
echo ::set-env name=CPATH::`xcrun --show-sdk-path`/usr/include
|
||||||
|
- name: build odin
|
||||||
|
run: make release
|
||||||
|
- 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 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
|
||||||
|
- name: Install B2 CLI
|
||||||
|
shell: bash
|
||||||
|
run: sudo pip install --upgrade b2
|
||||||
|
- 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 archieves
|
||||||
|
run: |
|
||||||
|
now=$(date +'%Y-%m-%d')
|
||||||
|
7z a output/odin-windows-amd64-nightly+$now.zip -r windows_artifacts/
|
||||||
|
7z a output/odin-ubuntu-amd64-nightly+$now.zip -r ubuntu_artifacts/
|
||||||
|
7z a output/odin-macos-amd64-nightly+$now.zip -r macos_artifact/
|
||||||
|
- name: Upload artifacts to b2
|
||||||
|
shell: bash
|
||||||
|
env:
|
||||||
|
APPID: ${{ secrets.B2_APPID }}
|
||||||
|
APPKEY: ${{ secrets.B2_APPKEY }}
|
||||||
|
run: |
|
||||||
|
b2 authorize-account "$APPID" "$APPKEY"
|
||||||
|
b2 sync --keepDays 7 output b2://odin-binaries/nightly
|
||||||
|
python3 ci/create_nightly_json.py > nightly.json
|
||||||
|
b2 upload-file odin-binaries nightly.json nightly.json
|
||||||
|
b2 clear-account
|
||||||
|
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
import subprocess
|
||||||
|
import sys
|
||||||
|
import json
|
||||||
|
import datetime
|
||||||
|
import urllib.parse
|
||||||
|
|
||||||
|
def main():
|
||||||
|
files_by_date = {}
|
||||||
|
|
||||||
|
files_lines = execute_cli("b2 ls --long odin-binaries nightly").split("\n")
|
||||||
|
for x in files_lines:
|
||||||
|
parts = x.split(" ", 1)
|
||||||
|
if parts[0]:
|
||||||
|
json_str = execute_cli(f"b2 get-file-info {parts[0]}")
|
||||||
|
data = json.loads(json_str)
|
||||||
|
name = remove_prefix(data['fileName'], "nightly/")
|
||||||
|
url = f"https://f001.backblazeb2.com/file/odin-binaries/nightly/{urllib.parse.quote_plus(name)}"
|
||||||
|
sha1 = data['contentSha1']
|
||||||
|
ts = int(data['fileInfo']['src_last_modified_millis'])
|
||||||
|
date = datetime.datetime.fromtimestamp(ts/1000).strftime('%Y-%m-%d')
|
||||||
|
|
||||||
|
if date not in files_by_date.keys():
|
||||||
|
files_by_date[date] = []
|
||||||
|
|
||||||
|
files_by_date[date].append({
|
||||||
|
'name': name,
|
||||||
|
'url': url,
|
||||||
|
'sha1': sha1,
|
||||||
|
})
|
||||||
|
|
||||||
|
now = datetime.datetime.utcnow().isoformat()
|
||||||
|
|
||||||
|
print(json.dumps({
|
||||||
|
'last_updated' : now,
|
||||||
|
'files': files_by_date
|
||||||
|
}, sort_keys=True, indent=4))
|
||||||
|
|
||||||
|
def remove_prefix(text, prefix):
|
||||||
|
return text[text.startswith(prefix) and len(prefix):]
|
||||||
|
|
||||||
|
def execute_cli(command):
|
||||||
|
sb = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE)
|
||||||
|
return sb.stdout.read().decode("utf-8");
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
sys.exit(main())
|
||||||
|
|
||||||
Reference in New Issue
Block a user