Add MSYS2 pacman packaging for MS-Windows #657
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build compiler+runtime (MS-Windows) | |
| on: | |
| pull_request: | |
| paths: | |
| - 'compiler\+runtime/**' | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - 'compiler\+runtime/**' | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| # Only allow one build per branch at a time. New builds will cancel existing builds. | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| # Rather than having every job in the matrix try to build its own Clang, we built it once | |
| # before running the matrix. Then we can just restore it from the cache in each job. | |
| windows-build-clang: | |
| name: Windows MSYS2 - clang | |
| runs-on: windows-2022 | |
| timeout-minutes: 200 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: true | |
| - name: Cache Clang/LLVM | |
| id: clang-cache | |
| uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 | |
| with: | |
| path: | | |
| ${{ github.workspace }}/compiler+runtime/build/llvm-install | |
| key: clang-${{ runner.os }}-${{ hashFiles('compiler+runtime/bin/build-clang-msys2') }} | |
| - uses: msys2/setup-msys2@v2 | |
| if: steps.clang-cache.outputs.cache-hit != 'true' | |
| with: | |
| msystem: CLANG64 | |
| install: base-devel git | |
| update: true | |
| - name: Build Clang/LLVM | |
| if: steps.clang-cache.outputs.cache-hit != 'true' | |
| shell: msys2 {0} | |
| env: | |
| MSYSTEM: CLANG64 | |
| run: | | |
| pushd compiler+runtime | |
| ./bin/build-clang-msys2 | |
| popd | |
| ls -al compiler+runtime/build/llvm-install | |
| build-jank: | |
| needs: | |
| - windows-build-clang | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| ## Release | |
| - name: Windows - release | |
| os: windows-2022 | |
| build_type: Release | |
| sanitize: none | |
| package: on | |
| # - name: Windows - Debug | |
| # os: windows-2022 | |
| # build_type: Debug | |
| # sanitize: none | |
| runs-on: ${{ matrix.os }} | |
| name: ${{ matrix.name }} | |
| env: | |
| JANK_MATRIX_ID: ${{ matrix.os }}-${{ matrix.build_type }}-${{ matrix.sanitize }} | |
| JANK_BUILD_TYPE: ${{ matrix.build_type }} | |
| JANK_LINT: ${{ matrix.lint }} | |
| JANK_COVERAGE: ${{ matrix.coverage }} | |
| JANK_ANALYZE: ${{ matrix.analyze }} | |
| JANK_SANITIZE: ${{ matrix.sanitize }} | |
| JANK_PACKAGE: ${{ matrix.package }} | |
| ASAN_OPTIONS: detect_leaks=0 | |
| TERM: xterm | |
| CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
| HOMEBREW_NO_AUTO_UPDATE: 1 | |
| timeout-minutes: 60 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: true | |
| - name: Install Homebrew packages | |
| if: runner.os == 'macOS' | |
| run: | | |
| brew install cmake ninja double-conversion pkg-config llvm ccache boost openssl zlib doctest boost clojure/tools/clojure | |
| - uses: msys2/setup-msys2@v2 | |
| if: runner.os == 'Windows' | |
| with: | |
| MSYSTEM: CLANG64 | |
| install: unzip mingw-w64-clang-x86_64-ccache base-devel curl zip mingw-w64-clang-x86_64-git-lfs mingw-w64-clang-x86_64-cmake mingw-w64-clang-x86_64-libffi mingw-w64-clang-x86_64-doctest mingw-w64-clang-x86_64-libzip mingw-w64-clang-x86_64-gc mingw-w64-clang-x86_64-boost | |
| update: true | |
| - name: Prepare java | |
| if: runner.os == 'Windows' | |
| uses: actions/setup-java@v5 | |
| with: | |
| distribution: 'zulu' | |
| java-version: '25' | |
| - name: Locate java (MS-Windows) | |
| if: runner.os == 'Windows' | |
| id: find | |
| shell: pwsh | |
| run: | | |
| $java = (Get-Command java).Path | |
| $dir = Split-Path $java | |
| "java_dir=$dir" >> $env:GITHUB_OUTPUT | |
| - name: Cache Clang/LLVM | |
| uses: actions/cache/restore@5a3ec84eff668545956fd18022155c47e93e2684 | |
| with: | |
| path: | | |
| ${{ github.workspace }}/compiler+runtime/build/llvm-install | |
| key: clang-${{ runner.os }}-${{ hashFiles('compiler+runtime/bin/build-clang-msys2') }} | |
| - name: Cache ccache object files | |
| if: matrix.analyze == 'off' | |
| uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 | |
| with: | |
| path: | | |
| ${{ github.workspace }}/compiler+runtime/.ctcache | |
| key: ccache-${{ env.JANK_MATRIX_ID }}-${{ github.ref_name }} | |
| - name: Cache ctcache object files | |
| if: matrix.analyze == 'on' | |
| uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 | |
| with: | |
| path: | | |
| ${{ github.workspace }}/compiler+runtime/.ctcache | |
| key: ctcache-${{ env.JANK_MATRIX_ID }}-${{ github.ref_name }} | |
| - name: Build and test jank (MS-Windows) | |
| if: runner.os == 'Windows' | |
| shell: msys2 {0} | |
| env: | |
| msystem: CLANG64 | |
| id: jank-build-step-win | |
| run: | | |
| curl -sL -o install-bb https://raw.githubusercontent.com/babashka/babashka/master/install | |
| ./install-bb | |
| curl -sL https://raw.githubusercontent.com/borkdude/deps.clj/master/install > install_clojure | |
| ./install_clojure --as-clj | |
| JAVA_DIR=$(cygpath -u "${{ steps.find.outputs.java_dir }}") | |
| pushd compiler+runtime | |
| ./bin/build-clang-msys2 -i | |
| clang++ --version | |
| popd | |
| if [[ "${JANK_SANITIZE}" != "none" || "${JANK_COVERAGE}" == "on" ]]; | |
| then | |
| export JANK_SKIP_AOT_CHECK=1 | |
| fi | |
| PATH="$PATH:$JAVA_DIR" JANK_INSTALL_DEPS=true ./bin/jank/check_everything.clj | |
| - name: Upload llvm and msys2 packages for publishing | |
| if: steps.jank-build-step-win.outputs.msys2-pkg | |
| # if: github.ref == 'refs/heads/main' && steps.jank-build-step-win.outputs.msys2-pkg | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: jank-msys2-pkg | |
| path: | | |
| ${{ steps.jank-build-step-win.outputs.msys2-pkg }} | |
| ${{ github.workspace }}/compiler+runtime/build/llvm-install/*.tar.zst | |
| publish-msys2-pkg: | |
| # if: github.ref == 'refs/heads/main' | |
| needs: build-jank | |
| name: Publish MSYS2 packages | |
| runs-on: windows-2022 | |
| timeout-minutes: 5 | |
| steps: | |
| - uses: msys2/setup-msys2@v2 | |
| with: | |
| msystem: CLANG64 | |
| install: pacman-contrib openssh rsync | |
| update: false | |
| - uses: actions/download-artifact@v5 | |
| with: | |
| name: jank-msys2-pkg | |
| path: ${{ github.workspace }}/msys2-repo | |
| - name: Import SSH key | |
| shell: msys2 {0} | |
| run: | | |
| mkdir -p ~/.ssh | |
| echo "${{ secrets.PPA_SSH_KEY }}" > ~/.ssh/jank_id_ed25519 | |
| chmod 400 ~/.ssh/jank_id_ed25519 | |
| - name: Generate repo database and publish | |
| shell: msys2 {0} | |
| run: | | |
| cd "$(cygpath -u "$GITHUB_WORKSPACE")/msys2-repo" | |
| # move jank and LLVM packages into the staging repo, create | |
| # package database and push to server | |
| mkdir -p staging | |
| find . -name "*.tar.zst" -exec mv {} staging/ \; | |
| cd staging | |
| repo-add jank.db.tar.gz *.tar.zst | |
| ls -al . | |
| # TODO: add --delete to remove old package versions from server | |
| rsync -avz -e "ssh -i $HOME/.ssh/jank_id_ed25519 -o StrictHostKeyChecking=no" ./ root@cache.jank-lang.org:/var/www/cache.jank-lang.org/html/msys2 |