Update for v2.3.0 #11
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 and Release | |
| on: | |
| push: | |
| branches: | |
| - main | |
| tags: | |
| - 'v*.*.*' | |
| permissions: | |
| contents: write | |
| jobs: | |
| build: | |
| name: ${{ matrix.name }} | |
| runs-on: ${{ matrix.runner }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - name: Windows x86_64 | |
| id: windows-x86_64 | |
| runner: windows-2022 | |
| generator: Visual Studio 17 2022 | |
| platform: x64 | |
| osx_architectures: "" | |
| - name: Ubuntu 22.04 x86_64 | |
| id: ubuntu-22.04-x86_64 | |
| runner: ubuntu-22.04 | |
| generator: Ninja | |
| platform: "" | |
| osx_architectures: "" | |
| - name: Ubuntu 22.04 arm64 | |
| id: ubuntu-22.04-arm64 | |
| runner: ubuntu-22.04-arm | |
| generator: Ninja | |
| platform: "" | |
| osx_architectures: "" | |
| # - name: macOS x86_64 | |
| # id: macos-x86_64 | |
| # runner: macos-13 | |
| # generator: Ninja | |
| # platform: "" | |
| # osx_architectures: "" | |
| # - name: macOS arm64 | |
| # id: macos-arm64 | |
| # runner: macos-14 | |
| # generator: Ninja | |
| # platform: "" | |
| # osx_architectures: "" | |
| - name: macOS universal | |
| id: macos-universal | |
| runner: macos-14 | |
| generator: Ninja | |
| platform: "" | |
| osx_architectures: x86_64;arm64 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Set up R | |
| uses: r-lib/actions/setup-r@v2 | |
| - name: Install Linux dependencies | |
| if: runner.os == 'Linux' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y \ | |
| libreadline-dev \ | |
| libncurses-dev | |
| - name: Install macOS dependencies | |
| if: runner.os == 'macOS' | |
| env: | |
| HOMEBREW_NO_AUTO_UPDATE: 1 | |
| run: | | |
| brew install readline ncurses | |
| - name: Configure Unix | |
| if: runner.os != 'Windows' | |
| shell: bash | |
| run: | | |
| cmake -S . -B build \ | |
| -DCMAKE_BUILD_TYPE=Release \ | |
| -DCMAKE_INSTALL_PREFIX="$RUNNER_TEMP/install" \ | |
| -DR_HOME="$(R RHOME)" | |
| - name: Configure Windows | |
| if: runner.os == 'Windows' | |
| shell: pwsh | |
| run: | | |
| $rhome = (R.exe RHOME) | Out-String | |
| $rhome = $rHome.Trim() | |
| $env:R_HOME = $rhome | |
| cmake -S . -B build ` | |
| -G "Visual Studio 17 2022" ` | |
| -DCMAKE_INSTALL_PREFIX="$env:RUNNER_TEMP/install" ` | |
| -DR_HOME="$rhome" | |
| - name: Build and package | |
| shell: bash | |
| run: cmake --build build --config Release --target package | |
| - name: Upload package artifact | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: package-${{ matrix.id }} | |
| path: build/*.zip | |
| if-no-files-found: error | |
| release: | |
| name: Create release | |
| if: startsWith(github.ref, 'refs/tags/') | |
| runs-on: ubuntu-22.04 | |
| needs: build | |
| steps: | |
| - name: Download packages | |
| uses: actions/download-artifact@v4 | |
| with: | |
| pattern: package-* | |
| path: dist | |
| merge-multiple: true | |
| - name: Create or update GitHub release | |
| shell: bash | |
| env: | |
| GH_REPO: ${{ github.repository }} | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| set -euo pipefail | |
| tag_name="ci-${GITHUB_SHA}" | |
| release_title="CI build ${GITHUB_SHA:0:12}" | |
| release_flags=(--prerelease) | |
| if [ "${GITHUB_REF_TYPE}" = "tag" ]; then | |
| tag_name="${GITHUB_REF_NAME}" | |
| release_title="${GITHUB_REF_NAME}" | |
| release_flags=() | |
| fi | |
| notes="Automated packages for ${GITHUB_SHA}." | |
| if gh release view "${tag_name}" >/dev/null 2>&1; then | |
| gh release upload "${tag_name}" dist/*.zip --clobber | |
| else | |
| gh release create "${tag_name}" dist/*.zip \ | |
| --target "${GITHUB_SHA}" \ | |
| --title "${release_title}" \ | |
| --notes "${notes}" \ | |
| "${release_flags[@]}" | |
| fi |