ci: add GitHub Actions build workflow using eic-shell #41
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 against eic-shell | |
| on: | |
| schedule: # run regularly on main branch | |
| - cron: '13 0 * * *' | |
| push: | |
| branches: | |
| - main | |
| tags: | |
| - '*' | |
| pull_request: | |
| merge_group: | |
| workflow_dispatch: | |
| inputs: | |
| organization: | |
| description: 'eic-shell organization' | |
| default: 'eicweb' | |
| required: false | |
| type: string | |
| platform: | |
| description: 'eic-shell platform' | |
| default: 'eic_xl' | |
| required: false | |
| type: string | |
| release: | |
| description: 'eic-shell release' | |
| default: 'nightly' | |
| required: false | |
| type: string | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }} | |
| cancel-in-progress: true | |
| permissions: | |
| contents: read | |
| env: | |
| organization: ${{ inputs.organization || vars.organization || 'eicweb' }} | |
| platform: ${{ inputs.platform || 'eic_xl' }} | |
| release: ${{ inputs.release || 'nightly' }} | |
| jobs: | |
| build: | |
| runs-on: ubuntu-24.04 | |
| strategy: | |
| matrix: | |
| CXX: [g++, clang++] | |
| CMAKE_BUILD_TYPE: [Release, Debug] | |
| exclude: | |
| # exclude g++ Debug as clang++ Debug is sufficient | |
| - CXX: g++ | |
| CMAKE_BUILD_TYPE: Debug | |
| include: | |
| - CXX: g++ | |
| CXXFLAGS: -Werror -Wall -Wextra -Wno-error=maybe-uninitialized | |
| - CXX: clang++ | |
| CXXFLAGS: -Werror -Wall -Wextra | |
| fail-fast: false | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Prepare ccache timestamp | |
| id: ccache_cache_timestamp | |
| run: | | |
| echo "timestamp=$(date --iso-8601=minutes)" >> $GITHUB_OUTPUT | |
| - name: Retrieve ccache cache files | |
| uses: actions/cache@v4 | |
| with: | |
| path: .ccache | |
| key: ccache-${{ matrix.CXX }}-${{ env.release }}-${{ matrix.CMAKE_BUILD_TYPE }}-${{ github.head_ref || github.ref_name }}-${{ steps.ccache_cache_timestamp.outputs.timestamp }} | |
| restore-keys: | | |
| ccache-${{ matrix.CXX }}-${{ env.release }}-${{ matrix.CMAKE_BUILD_TYPE }}-${{ github.head_ref }}- | |
| ccache-${{ matrix.CXX }}-${{ env.release }}-${{ matrix.CMAKE_BUILD_TYPE }}-${{ github.ref_name }}- | |
| ccache-${{ matrix.CXX }}-${{ env.release }}-${{ matrix.CMAKE_BUILD_TYPE }}-${{ github.base_ref }}- | |
| ccache-${{ matrix.CXX }}-${{ env.release }}-${{ matrix.CMAKE_BUILD_TYPE }}- | |
| ccache-${{ matrix.CXX }}-${{ env.release }}- | |
| ccache-${{ matrix.CXX }}- | |
| ccache- | |
| - name: Configure ccache | |
| run: | | |
| mkdir -p ~/.ccache/ | |
| echo "cache_dir=${{ github.workspace }}/.ccache" > ~/.ccache/ccache.conf | |
| echo "max_size=500MB" >> ~/.ccache/ccache.conf | |
| echo "compression=true" >> ~/.ccache/ccache.conf | |
| - uses: cvmfs-contrib/github-action-cvmfs@v4 | |
| - name: Build and install | |
| uses: eic/run-cvmfs-osg-eic-shell@main | |
| with: | |
| organization: "${{ env.organization }}" | |
| platform-release: "${{ env.platform }}:${{ env.release }}" | |
| run: | | |
| CXX="${{ matrix.CXX }}" CXXFLAGS="${{ matrix.CXXFLAGS }}" cmake -B build -S . \ | |
| -DCMAKE_INSTALL_PREFIX=install \ | |
| -DCMAKE_C_COMPILER_LAUNCHER=ccache \ | |
| -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ | |
| -DCMAKE_BUILD_TYPE=${{ matrix.CMAKE_BUILD_TYPE }} | |
| cmake --build build -j $(getconf _NPROCESSORS_ONLN) --target install | |
| ccache --show-stats --verbose | |
| ccache --evict-older-than 7d |