From af5271060ac857e8ee60a09e11ca5b27162ae7c8 Mon Sep 17 00:00:00 2001 From: Michiel Borkent Date: Wed, 19 Mar 2025 16:12:45 +0100 Subject: [PATCH] Add windows build --- .github/workflows/build-windows.yml | 96 ++++++++++++++++++++++++++++ resources/META-INF/babashka/deps.edn | 2 +- 2 files changed, 97 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/build-windows.yml diff --git a/.github/workflows/build-windows.yml b/.github/workflows/build-windows.yml new file mode 100644 index 00000000..bf7c62e6 --- /dev/null +++ b/.github/workflows/build-windows.yml @@ -0,0 +1,96 @@ +name: build + +on: + push: + paths-ignore: + - "**.md" + - "logo/**" + pull_request: + paths-ignore: + - "**.md" + - "logo/**" + +# TODO: Add deploy if needed +jobs: + native: + if: "!contains(github.event.head_commit.message, 'skip ci')" + strategy: + matrix: + include: + - os: windows-latest + name: windows + static: false + runs-on: ${{ matrix.os }} + env: + LEIN_ROOT: "true" + GRAALVM_VERSION: "24" + BABASHKA_PLATFORM: ${{ matrix.name }} # used in release script + BABASHKA_TEST_ENV: native + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + BABASHKA_SHA: ${{ github.sha }} + steps: + - name: Git checkout + uses: actions/checkout@v2 + with: + fetch-depth: 1 + submodules: 'true' + + - name: Cache deps + uses: actions/cache@v4 + id: cache-deps + with: + path: ~/.m2/repository + key: ${{ runner.os }}-maven-${{ hashFiles('project.clj') }} + restore-keys: ${{ runner.os }}-maven- + + - name: Setup GraalVM + if: "matrix.static == false" + uses: graalvm/setup-graalvm@v1.3.3 + with: + java-version: '24' + distribution: 'graalvm' + components: 'native-image' + github-token: ${{ secrets.GITHUB_TOKEN }} + + - name: Install clojure tools + uses: DeLaGuardo/setup-clojure@5.0 + with: + cli: latest + lein: 2.9.8 + + - name: Babashka version + id: babashka-version + shell: bash + run: | + BABASHKA_VERSION=$(cat resources/BABASHKA_VERSION) + echo "##[set-output name=version;]${BABASHKA_VERSION}" + + - name: Build + shell: cmd + run: | + call script/uberjar.bat + + call script/compile.bat + + echo Creating zip archive + + set zip=babashka-%BABASHKA_VERSION%-windows-amd64.zip + + jar -cMf %zip% bb.exe + + bb --config .build/bb.edn --deps-root . release-artifact %zip% + + + - name: Test binary and libs + shell: cmd + run: | + set BABASHKA_CLASSPATH= + set BABASHKA_TEST_ENV=native + call script/test.bat :windows + call script/run_lib_tests.bat + + - name: Upload artifact + uses: actions/upload-artifact@v4 + with: + path: bb + name: babashka-${{ steps.babashka-version.outputs.version }}-${{ matrix.name }}-amd64 diff --git a/resources/META-INF/babashka/deps.edn b/resources/META-INF/babashka/deps.edn index 5cac0a0b..7f036267 100644 --- a/resources/META-INF/babashka/deps.edn +++ b/resources/META-INF/babashka/deps.edn @@ -174,7 +174,7 @@ prismatic/plumbing {:git/url "https://github.com/plumatic/plumbing", :git/sha "424bc704f2db422de34269c139a5494314b3a43b"} org.clj-commons/hickory {:git/url "https://github.com/clj-commons/hickory" - :git/sha "749ba998aa64f19092876cda967e6c562c56b81d"}} + :git/sha "9385b6708ef35f161732d8464b3a3aa57dd79f30"}} :classpath-overrides {org.clojure/clojure nil org.clojure/spec.alpha nil}} :clj-nvd