[JeffersonLab/clas12-validation] ci: add first test job #93
Workflow file for this run
This file contains 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: Validation | |
on: | |
workflow_dispatch: | |
inputs: | |
source: | |
required: true | |
type: string | |
title: | |
required: true | |
type: string | |
source_url: | |
required: false | |
type: string | |
git_coatjava: | |
required: false | |
type: string | |
git_clas12tags: | |
required: false | |
type: string | |
git_clas12config: | |
required: false | |
type: string | |
pull_request: | |
push: | |
branches: [ master ] | |
run-name: "[${{ inputs.source || github.repository }}] ${{ inputs.title || github.event.pull_request.title || github.event.push.head_commit.message }}" | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
defaults: | |
run: | |
shell: bash | |
env: | |
# default dependency forks and branches | |
git_coatjava: '{ | |
"fork": "JeffersonLab/coatjava", | |
"branch": "development" | |
}' | |
git_clas12tags: '{ | |
"fork": "gemc/clas12Tags", | |
"branch": "main" | |
}' | |
git_clas12config: '{ | |
"fork": "JeffersonLab/clas12-config", | |
"branch": "main", | |
"tag_config_coatjava": "latest", | |
"tag_config_gemc": "latest" | |
}' | |
# default number of events | |
num_events: 10 | |
jobs: | |
# dependency and triggerer info | |
############################################################################# | |
dependency_info: | |
runs-on: ubuntu-latest | |
outputs: | |
fork_coatjava: ${{ steps.info.outputs.fork_coatjava }} | |
branch_coatjava: ${{ steps.info.outputs.branch_coatjava }} | |
fork_clas12tags: ${{ steps.info.outputs.fork_clas12tags }} | |
branch_clas12tags: ${{ steps.info.outputs.branch_clas12tags }} | |
fork_clas12config: ${{ steps.info.outputs.fork_clas12config }} | |
branch_clas12config: ${{ steps.info.outputs.branch_clas12config }} | |
tag_config_coatjava: ${{ steps.info.outputs.tag_config_coatjava }} | |
tag_config_gemc: ${{ steps.info.outputs.tag_config_gemc }} | |
steps: | |
- name: get dependency info | |
id: info | |
run: | | |
echo fork_coatjava=$( echo '${{ inputs.git_coatjava || env.git_coatjava }}' | jq -r '.fork' ) >> $GITHUB_OUTPUT | |
echo branch_coatjava=$( echo '${{ inputs.git_coatjava || env.git_coatjava }}' | jq -r '.branch' ) >> $GITHUB_OUTPUT | |
echo fork_clas12tags=$( echo '${{ inputs.git_clas12tags || env.git_clas12tags }}' | jq -r '.fork' ) >> $GITHUB_OUTPUT | |
echo branch_clas12tags=$( echo '${{ inputs.git_clas12tags || env.git_clas12tags }}' | jq -r '.branch' ) >> $GITHUB_OUTPUT | |
echo fork_clas12config=$( echo '${{ inputs.git_clas12config || env.git_clas12config }}' | jq -r '.fork' ) >> $GITHUB_OUTPUT | |
echo branch_clas12config=$( echo '${{ inputs.git_clas12config || env.git_clas12config }}' | jq -r '.branch' ) >> $GITHUB_OUTPUT | |
echo tag_config_coatjava=$( echo '${{ inputs.git_clas12config || env.git_clas12config }}' | jq -r '.tag_config_coatjava' ) >> $GITHUB_OUTPUT | |
echo tag_config_gemc=$( echo '${{ inputs.git_clas12config || env.git_clas12config }}' | jq -r '.tag_config_gemc' ) >> $GITHUB_OUTPUT | |
- name: dispatch summary | |
run: | | |
echo '| | | |' >> $GITHUB_STEP_SUMMARY | |
echo '| --- | --- | --- |' >> $GITHUB_STEP_SUMMARY | |
echo '| **Pull Request** | <${{ inputs.source_url || github.event.pull_request.html_url }}> | ${{ inputs.title || github.event.pull_request.title }} |' >> $GITHUB_STEP_SUMMARY | |
echo '| **`coatjava` Fork and Branch** | `${{ steps.info.outputs.fork_coatjava }}` | [`${{ steps.info.outputs.branch_coatjava }}`](https://github.com/${{ steps.info.outputs.fork_coatjava }}/tree/${{ steps.info.outputs.branch_coatjava }}) |' >> $GITHUB_STEP_SUMMARY | |
echo '| **`clas12Tags` Fork and Branch** | `${{ steps.info.outputs.fork_clas12tags }}` | [`${{ steps.info.outputs.branch_clas12tags }}`](https://github.com/${{ steps.info.outputs.fork_clas12tags }}/tree/${{ steps.info.outputs.branch_clas12tags }}) |' >> $GITHUB_STEP_SUMMARY | |
echo '| **`clas12-config` Fork and Branch** | `${{ steps.info.outputs.fork_clas12config }}` | [`${{ steps.info.outputs.branch_clas12config }}`](https://github.com/${{ steps.info.outputs.fork_clas12config }}/tree/${{ steps.info.outputs.branch_clas12config }}) |' >> $GITHUB_STEP_SUMMARY | |
echo '| | | |' >> $GITHUB_STEP_SUMMARY | |
# build | |
############################################################################# | |
build_coatjava: | |
needs: | |
- dependency_info | |
runs-on: ubuntu-latest | |
steps: | |
- name: setup java | |
uses: actions/setup-java@v3 | |
with: | |
java-version: 11 | |
distribution: zulu | |
- name: clone | |
run: git clone https://github.com/${{ needs.dependency_info.outputs.fork_coatjava }}.git --branch ${{ needs.dependency_info.outputs.branch_coatjava }} | |
- name: build | |
run: | | |
cd coatjava | |
./build-coatjava.sh | |
- name: tree | |
run: tree | |
- name: tar | |
run: tar czvf coatjava{.tar.gz,} | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: build | |
retention-days: 1 | |
path: ./*.tar.gz | |
build_gemc: | |
needs: | |
- dependency_info | |
runs-on: ubuntu-latest | |
container: jeffersonlab/gemc:4.4.2-5.1-5.2-5.3-fedora36-cvmfs ##### FIXME: need `latest` tag | |
steps: | |
- name: clone | |
run: git clone https://github.com/${{ needs.dependency_info.outputs.fork_clas12tags }}.git --branch ${{ needs.dependency_info.outputs.branch_clas12tags }} | |
- name: build | |
run: | | |
source /app/localSetup.sh | |
cd clas12Tags/source | |
scons -j2 OPT=1 | |
- name: tar | |
run: tar czvf clas12Tags{.tar.gz,} | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: build | |
retention-days: 1 | |
path: ./*.tar.gz | |
# clas12-config configuration | |
############################################################################# | |
config_files: | |
needs: | |
- dependency_info | |
runs-on: ubuntu-latest | |
outputs: | |
tag_config_coatjava: ${{ steps.version.outputs.tag_config_coatjava }} | |
tag_config_gemc: ${{ steps.version.outputs.tag_config_gemc }} | |
steps: | |
- name: clone | |
run: git clone https://github.com/${{ needs.dependency_info.outputs.fork_clas12config }}.git --branch ${{ needs.dependency_info.outputs.branch_clas12config }} | |
- name: get version info | |
id: version | |
run: | | |
cd clas12-config | |
tag_config_coatjava=${{ needs.dependency_info.outputs.tag_config_coatjava }} | |
tag_config_gemc=${{ needs.dependency_info.outputs.tag_config_gemc }} | |
# get the 'latest' version number, if we asked for 'latest' | |
[ "${{ needs.dependency_info.outputs.tag_config_coatjava }}" = "latest" ] && tag_config_coatjava=$(util/latest.rb coatjava) | |
[ "${{ needs.dependency_info.outputs.tag_config_gemc }}" = "latest" ] && tag_config_gemc=$(util/latest.rb gemc) | |
# job summary | |
echo "| Configuration Files | Version |" >> $GITHUB_STEP_SUMMARY | |
echo "| --- | --- |" >> $GITHUB_STEP_SUMMARY | |
echo "| \`coatjava\` | ${tag_config_coatjava} |" >> $GITHUB_STEP_SUMMARY | |
echo "| \`gemc\` | ${tag_config_gemc} |" >> $GITHUB_STEP_SUMMARY | |
# output vars | |
echo tag_config_coatjava=$tag_config_coatjava >> $GITHUB_OUTPUT | |
echo tag_config_gemc=$tag_config_gemc >> $GITHUB_OUTPUT | |
- name: tar | |
run: tar czvf clas12-config{.tar.gz,} | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: build | |
retention-days: 1 | |
path: ./*.tar.gz | |
# event generation | |
############################################################################# | |
event_generation: | |
needs: | |
- build_coatjava | |
runs-on: ubuntu-latest | |
steps: | |
- name: setup java | |
uses: actions/setup-java@v3 | |
with: | |
java-version: 11 | |
distribution: zulu | |
- name: setup groovy | |
uses: wtfjoke/setup-groovy@v1 | |
with: | |
groovy-version: 4.x | |
- uses: actions/download-artifact@v3 | |
with: | |
name: build | |
- name: untar build | |
run: ls *.tar.gz | xargs -I{} tar xzvf {} | |
- name: event generation | |
run: | | |
coatjava/validation/advanced-tests/src/eb/scripts/gen.sh | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: event_generation | |
retention-days: 1 | |
path: ./*.txt | |
# simulation | |
############################################################################# | |
simulation: | |
needs: | |
- event_generation | |
- build_gemc | |
- config_files | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
run_period: | |
- rga_spring2019 | |
container: jeffersonlab/gemc:4.4.2-5.1-5.2-5.3-fedora36-cvmfs ##### FIXME: need `latest` tag | |
steps: | |
- uses: actions/download-artifact@v3 | |
with: | |
name: event_generation | |
- uses: actions/download-artifact@v3 | |
with: | |
name: build | |
- name: tree | |
run: ls -lhR | |
- name: untar build | |
run: ls *.tar.gz | xargs -I{} tar xzvf {} | |
- name: simulation | |
run: | | |
source /app/localSetup.sh | |
gemc_config=$(pwd -P)/clas12-config/gemc/${{ needs.config_files.outputs.tag_config_gemc }} | |
cd clas12Tags/source | |
./gemc \ | |
$gemc_config/${{ matrix.run_period }}.gcard \ | |
-N=${{ env.num_events }} \ | |
-USE_GUI=0 | |
echo "[DONE]" | |
ls -lthR |