diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8f92f36..f70a164 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -29,6 +29,10 @@ on: description: 'override default forks and refs, env.git_upstream JSON object elements (you do not have to specify all of them, just the ones you want to override)' required: false type: string + gemc_version: + description: 'gemc version to use; use "build" to rebuild from clas12Tags, "match_gcard" to use the version matching the gcard, "default" to use the GEMC image default; anything else will use "module switch gemc/gemc_version"' + required: false + type: string pull_request: push: branches: [ main ] @@ -67,6 +71,8 @@ env: "clas12-config": { "fork": "JeffersonLab/clas12-config", "ref": "main" }, "clas12-validation": { "fork": "JeffersonLab/clas12-validation", "ref": "main" } } + # GEMC version to use in the GEMC container + gemc_version: 'match_gcard' # default versions of config files config_file_versions: >- { @@ -125,9 +131,7 @@ jobs: ref_clas12config: ${{ steps.info.outputs.ref_clas12config }} fork_clas12validation: ${{ steps.info.outputs.fork_clas12validation }} ref_clas12validation: ${{ steps.info.outputs.ref_clas12validation }} - gemc_module_tag: ${{ steps.gemc_module_tag.outputs.gemc_module_tag }} - gemc_executable: ${{ steps.gemc_executable.outputs.gemc_executable }} - caller_repo: ${{ steps.gemc_executable.outputs.caller_repo }} + caller_repo: ${{ steps.info.outputs.caller_repo }} steps: - name: checkout clas12-validation uses: actions/checkout@v4 @@ -164,23 +168,8 @@ jobs: echo ref_clas12tags=$ref_clas12tags >> $GITHUB_OUTPUT echo ref_clas12config=$ref_clas12config >> $GITHUB_OUTPUT echo ref_clas12validation=$ref_clas12validation >> $GITHUB_OUTPUT - - name: set GEMC module tag - id: gemc_module_tag - run: | - ### if `ref_clas12tags` is a tag, use that; otherwise use the highest semver tag - ### FIXME probably won't work for triggers from backports to old `clas12Tags` tags - gemc_module_tag=${{ steps.info.outputs.ref_clas12tags }} - repo=gemc/clas12Tags - bin/is_a_tag.rb $gemc_module_tag $repo || gemc_module_tag=$(bin/get_highest_tag.rb $repo) - echo gemc_module_tag=$gemc_module_tag >> $GITHUB_OUTPUT - - name: set GEMC executable - id: gemc_executable - run: | - ### if the caller repo is `clas12Tags`, we want to locally build GEMC; if not, use the container version - caller_repo=$(echo "${{ github.repository }}" | sed 's;^.*/;;g') - [ "$caller_repo" = "clas12Tags" ] && gemc_executable=./clas12Tags/source/gemc || gemc_executable=gemc - echo gemc_executable=$gemc_executable >> $GITHUB_OUTPUT - echo caller_repo=$caller_repo >> $GITHUB_OUTPUT + ### get caller repository + echo caller_repo=$(echo "${{ github.repository }}" | sed 's;^.*/;;g') >> $GITHUB_OUTPUT - name: dispatch summary run: | msg=$(echo '${{ github.event.pull_request.title || github.event.head_commit.message }}' | head -n1) @@ -193,9 +182,7 @@ jobs: echo '| **`clas12-validation` Fork and Ref:** | `${{ steps.info.outputs.fork_clas12validation }}` | [`${{ steps.info.outputs.ref_clas12validation }}`](https://github.com/${{ steps.info.outputs.fork_clas12validation }}/tree/${{ steps.info.outputs.ref_clas12validation }}) |' >> $GITHUB_STEP_SUMMARY echo '| | | |' >> $GITHUB_STEP_SUMMARY echo '' >> $GITHUB_STEP_SUMMARY - echo '- Caller repository: `${{ steps.gemc_executable.outputs.caller_repo }}`' >> $GITHUB_STEP_SUMMARY - echo '- GEMC module: `gemc/${{ steps.gemc_module_tag.outputs.gemc_module_tag }}`, if available in container; if not, use the default version in the container (see "Run" jobs)' >> $GITHUB_STEP_SUMMARY - echo '- GEMC executable: `${{ steps.gemc_executable.outputs.gemc_executable }}`' >> $GITHUB_STEP_SUMMARY + echo '- Caller repository: `${{ steps.info.outputs.caller_repo }}`' >> $GITHUB_STEP_SUMMARY # build ############################################################################# @@ -236,6 +223,10 @@ jobs: retention-days: 3 path: ./*.tar.zst + ############################################################################################# + ###### TODO: stopped searchingn for /gemc/ strings here, for cleaning up unused GEMC vars + ############################################################################################# + build_gemc: name: Build GEMC if: ${{ needs.dependency_info.outputs.caller_repo == 'clas12Tags' }} # only build GEMC if triggered by GEMC/clas12Tags @@ -448,6 +439,7 @@ jobs: fail-fast: true matrix: ${{ fromJson(needs.config_files.outputs.matrix_full) }} steps: + ### setup - name: checkout clas12-validation uses: actions/checkout@v4 with: @@ -478,6 +470,7 @@ jobs: run: ls -lhR - name: untar build run: ls *.tar.zst | xargs -I{} tar xavf {} + ### handle config files - name: file names id: files run: | @@ -491,6 +484,33 @@ jobs: run: | ls ${{ steps.files.outputs.gemcConfigFile }} ls ${{ steps.files.outputs.coatjavaConfigFile }} + ### set GEMC version, and rebuild if necessary + - name: set GEMC module version + id: gemc_version + run: | + gemc_version=${{ inputs.gemc_version || env.gemc_version }} + [ "$gemc_version" = "match_gcard" ] && gemc_version=$(basename $(dirname ${{ steps.files.outputs.gemcConfigFile }})) + echo gemc_version=$gemc_version | tee -a $GITHUB_OUTPUT + ############################################################################################# + # TODO: make this gemc rebuild work + ############################################################################################# + - name: checkout clas12Tags + if: ${{ steps.gemc_version.outputs.gemc_version == 'build' }} + uses: actions/checkout@v4 + with: + repository: ${{ needs.dependency_info.outputs.fork_clas12tags }} + ref: ${{ needs.dependency_info.outputs.ref_clas12tags }} + path: clas12Tags + clean: false + fetch-tags: true + fetch-depth: 0 + - name: rebuild GEMC + if: ${{ steps.gemc_version.outputs.gemc_version == 'build' }} + uses: docker://jeffersonlab/gemc:dev-fedora36 + with: + entrypoint: bin/ci_gemc_build.sh + args: clas12Tags/source + ### run simulation - name: simulation uses: docker://jeffersonlab/gemc:dev-fedora36 with: @@ -498,12 +518,14 @@ jobs: args: ${{ needs.dependency_info.outputs.gemc_executable }} ${{ needs.dependency_info.outputs.gemc_module_tag }} ${{ steps.files.outputs.gemcConfigFile }} ${{ steps.files.outputs.evgenFile }} ${{ steps.files.outputs.simFile }} - name: check if output exists run: ls ${{ steps.files.outputs.simFile }} + ### run reconstruction - name: reconstruction run: | coatjava/coatjava/bin/recon-util \ -y ${{ steps.files.outputs.coatjavaConfigFile }} \ -i ${{ steps.files.outputs.simFile }} \ -o ${{ steps.files.outputs.recFile }} + ### handle outputs - name: check if output exists run: ls ${{ steps.files.outputs.recFile }} - name: analysis