From 44f7dedc6ab60a39ffe7ba0b1838a6251654b16e Mon Sep 17 00:00:00 2001 From: Brad Lewis <22850972+BradLewis@users.noreply.github.com> Date: Sat, 11 Oct 2025 05:07:41 -0400 Subject: Update nightly release action to allow creating releases tied to odin versions --- .github/workflows/nightly.yml | 228 -------------------------------------- .github/workflows/release.yml | 249 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 249 insertions(+), 228 deletions(-) delete mode 100644 .github/workflows/nightly.yml create mode 100644 .github/workflows/release.yml (limited to '.github') diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml deleted file mode 100644 index 3efe602..0000000 --- a/.github/workflows/nightly.yml +++ /dev/null @@ -1,228 +0,0 @@ -name: nightly -env: - ODIN_BRANCH: dev-2025-09 - -on: - workflow_dispatch: - schedule: - - cron: 0 2 * * 0 - -jobs: - dist-arm64-darwin: - runs-on: macos-latest - timeout-minutes: 15 - steps: - - uses: actions/checkout@v1 - - 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-13 - timeout-minutes: 15 - steps: - - uses: actions/checkout@v1 - - 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: 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: 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: 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: "nightly" - token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..9425057 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,249 @@ +name: release +env: + ODIN_BRANCH: dev-2025-09 + +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 + - 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-13 + 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 + - 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 + - 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 + - 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 + - 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 }} -- cgit v1.2.3 From 617bd092c14e4cf997d99eea9d9ad2c5ce12e8af Mon Sep 17 00:00:00 2001 From: Brad Lewis <22850972+BradLewis@users.noreply.github.com> Date: Sat, 11 Oct 2025 17:08:00 -0400 Subject: Set version in binary when creating releases --- .github/workflows/release.yml | 19 ++++++++++++++----- ci.bat | 13 +++++++------ ci.sh | 6 ++++-- 3 files changed, 25 insertions(+), 13 deletions(-) (limited to '.github') diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9425057..5f8a312 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -18,7 +18,9 @@ jobs: - 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 + 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 @@ -39,7 +41,7 @@ jobs: - name: Upload artifacts uses: actions/upload-artifact@v4 with: - name: dist-arm64-darwin + name: dist-arm64-darwin path: ./dist dist-x86_64-darwin: @@ -49,7 +51,9 @@ jobs: - 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 + 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 @@ -82,7 +86,9 @@ jobs: - 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 + 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 @@ -115,7 +121,9 @@ jobs: - 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 + 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 @@ -154,6 +162,7 @@ jobs: 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: | diff --git a/ci.bat b/ci.bat index 90dea49..9466d7c 100644 --- a/ci.bat +++ b/ci.bat @@ -2,20 +2,21 @@ setlocal enabledelayedexpansion -for /f %%a in ('git rev-parse --short HEAD 2^>NUL') do set commit_hash=%%a -for /f %%d in ('powershell -command "[DateTime]::UtcNow.ToString('yyyy-MM-dd')"') do set today=%%d -set version=nightly-%today%-%commit_hash% - +if not defined OLS_VERSION ( + for /f %%a in ('git rev-parse --short HEAD 2^>NUL') do set commit_hash=%%a + for /f %%d in ('powershell -command "[DateTime]::UtcNow.ToString('yyyy-MM-dd')"') do set today=%%d + set "OLS_VERSION=nightly-!today!-!commit_hash!" +) if "%1" == "CI" ( set "PATH=%cd%\Odin;!PATH!" odin test tests -collection:src=src -define:ODIN_TEST_THREADS=1 if %errorlevel% neq 0 exit /b 1 - odin build src\ -collection:src=src -out:ols.exe -o:speed -no-bounds-check -extra-linker-flags:"/STACK:4000000,2000000" -define:VERSION=%version% + odin build src\ -collection:src=src -out:ols.exe -o:speed -no-bounds-check -extra-linker-flags:"/STACK:4000000,2000000" -define:VERSION=%OLS_VERSION% call "tools/odinfmt/tests.bat" if %errorlevel% neq 0 exit /b 1 ) else ( - odin build src\ -collection:src=src -out:ols.exe -o:speed -no-bounds-check -extra-linker-flags:"/STACK:4000000,2000000" -define:VERSION=%version% + odin build src\ -collection:src=src -out:ols.exe -o:speed -no-bounds-check -extra-linker-flags:"/STACK:4000000,2000000" -define:VERSION=%OLS_VERSION% ) diff --git a/ci.sh b/ci.sh index 048ece0..35631c3 100755 --- a/ci.sh +++ b/ci.sh @@ -1,6 +1,8 @@ #!/usr/bin/env bash -VERSION="nightly-$(date -u '+%Y-%m-%d')-$(git rev-parse --short HEAD)" +if [[ -z "$OLS_VERSION" ]]; then + OLS_VERSION="nightly-$(date -u '+%Y-%m-%d')-$(git rev-parse --short HEAD)" +fi if [[ $1 == "CI" ]] then @@ -37,4 +39,4 @@ then fi -odin build src/ -show-timings -collection:src=src -out:ols -no-bounds-check -o:speed -define:VERSION=$VERSION $@ +odin build src/ -show-timings -collection:src=src -out:ols -no-bounds-check -o:speed -define:VERSION=$OLS_VERSION $@ -- cgit v1.2.3