diff --git a/.github/scripts/post_pr_comment.sh b/.github/scripts/post_pr_comment.sh index 3048f6a7..4f390278 100755 --- a/.github/scripts/post_pr_comment.sh +++ b/.github/scripts/post_pr_comment.sh @@ -7,6 +7,15 @@ generate_post_data() EOF } PR_NUMBER=$(echo $GITHUB_REF | awk 'BEGIN { FS = "/" } ; { print $3 }') +echo "github ref:" $GITHUB_REF +echo "pr number:" $PR_NUMBER +echo "PR number" "${PR_NUMBER2}" +echo "PR number" "${PR_NUMBER}" +echo "github_repository:" "$GITHUB_REPOSITORY" + +PR_NUMBER=$(jq --raw-output .pull_request.number "$GITHUB_EVENT_PATH") +echo PR_NUMBER +#PR_NUMBER="${PR_NUMBER2}" curl -s -H "Authorization: token ${KEY4HEP_COMMENT_BOT_TOKEN}" \ -X POST -d "$(generate_post_data)" \ "https://api.github.com/repos/${GITHUB_REPOSITORY}/issues/${PR_NUMBER}/comments" diff --git a/.github/workflows/concretize-lxplus-pr-target.yaml b/.github/workflows/concretize-lxplus-pr-target.yaml new file mode 100644 index 00000000..0dcc4c79 --- /dev/null +++ b/.github/workflows/concretize-lxplus-pr-target.yaml @@ -0,0 +1,48 @@ +name: concretize-lxplus-comment-bot +on: [pull_request_target] +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Check if workflow should be run + run: | + ismember=$(curl \ + -o /dev/null --silent --head \ + -H "Authorization: token ${{ secrets.COMMENT_TOKEN }}" \ + --write-out '%{http_code}\n' \ + https://api.github.com/orgs/key4hep/members/vvolkl\ + ) + if [ "$ismember" = 204 ] + then + echo "" + else + exit 1 + fi + - uses: actions/checkout@v2 + with: + ref: ${{github.event.pull_request.head.ref}} + repository: ${{github.event.pull_request.head.repo.full_name}} + - uses: cvmfs-contrib/github-action-cvmfs@v2 + with: + cvmfs_repositories: 'sw.hsf.org,sw-nightlies.hsf.org,sft-nightlies.cern.ch,sft.cern.ch,geant4.cern.ch' + - name: Start container + run: | + docker run -it --name CI_container -e GITHUB_ENV=${GITHUB_ENV} -v ${GITHUB_WORKSPACE}:/Package -v /cvmfs:/cvmfs:shared -d clicdp/cc7-lcg /bin/bash + - name: Setup container + run: | + docker exec CI_container /bin/bash -c ' ln -s /usr/lib64/liblzma.so.5.2.2 /usr/lib64/liblzma.so;' + - name: Setup Spack + run: | + docker exec CI_container /bin/bash -c 'cd ./Package;\ + source scripts/ci_setup_spack2.sh;' + - name: Concretize + run: | + docker exec CI_container /bin/bash -c 'cd ./Package;\ + source spack/share/spack/setup-env.sh;\ + spack spec -I key4hep-stack | tee -a key4hep-stack-concretization.log;' + - name: Comment PR + env: + KEY4HEP_COMMENT_BOT_TOKEN: ${{ secrets.KEY4HEP_COMMENT_BOT_TOKEN }} + run: | + ${GITHUB_WORKSPACE}/.github/scripts/generate_pr_comment.sh + ${GITHUB_WORKSPACE}/.github/scripts/post_pr_comment.sh diff --git a/.github/workflows/concretize-lxplus.yaml b/.github/workflows/concretize-lxplus.yaml index 87648417..9367f5c6 100644 --- a/.github/workflows/concretize-lxplus.yaml +++ b/.github/workflows/concretize-lxplus.yaml @@ -25,10 +25,8 @@ jobs: docker exec CI_container /bin/bash -c 'cd ./Package;\ source spack/share/spack/setup-env.sh;\ spack spec -I key4hep-stack | tee -a key4hep-stack-concretization.log;' - - name: Comment PR - if: github.event_name == 'pull_request' - env: - KEY4HEP_COMMENT_BOT_TOKEN: ${{ secrets.KEY4HEP_COMMENT_BOT_TOKEN }} - run: | - ${GITHUB_WORKSPACE}/.github/scripts/generate_pr_comment.sh - ${GITHUB_WORKSPACE}/.github/scripts/post_pr_comment.sh + - uses: actions/upload-artifact@v2 + with: + name: concretization-log-artifact + path: key4hep-stack-concretization.log + retention-days: 5 diff --git a/config/compilers_centos7_cvmfs.yaml b/config/compilers_centos7_cvmfs.yaml new file mode 100644 index 00000000..5342c7a0 --- /dev/null +++ b/config/compilers_centos7_cvmfs.yaml @@ -0,0 +1,14 @@ +compilers: +- compiler: + paths: + cc: /cvmfs/sw.hsf.org/spackages/linux-centos7-haswell/gcc-4.8.5/gcc-8.3.0-avsmzt7bekq7ispf6zlarx6vwdretbae/bin/gcc + cxx: /cvmfs/sw.hsf.org/spackages/linux-centos7-haswell/gcc-4.8.5/gcc-8.3.0-avsmzt7bekq7ispf6zlarx6vwdretbae/bin/g++ + f77: /cvmfs/sw.hsf.org/spackages/linux-centos7-haswell/gcc-4.8.5/gcc-8.3.0-avsmzt7bekq7ispf6zlarx6vwdretbae/bin/gfortran + fc: /cvmfs/sw.hsf.org/spackages/linux-centos7-haswell/gcc-4.8.5/gcc-8.3.0-avsmzt7bekq7ispf6zlarx6vwdretbae/bin/gfortran + operating_system: centos7 + target: x86_64 + modules: [] + environment: {} + extra_rpaths: [] + flags: {} + spec: gcc@8.3.0 diff --git a/config/packages.yaml b/config/packages.yaml index ac6dff9d..00a90ad3 100644 --- a/config/packages.yaml +++ b/config/packages.yaml @@ -2,7 +2,7 @@ packages: all: target: [broadwell] - variants: build_type=Release + variants: build_type=Debug buildable: true version: [] providers: diff --git a/scripts/ci_setup_spack.sh b/scripts/ci_setup_spack.sh index 7edfcb7e..7ce6611f 100755 --- a/scripts/ci_setup_spack.sh +++ b/scripts/ci_setup_spack.sh @@ -13,7 +13,7 @@ echo ' - $SPACK_ROOT/var/spack/repos/key4hep-spack' >> spack/etc/spack/repos.yaml tar -czf key4hep-spack.tar.gz spack cp ${PWD}/spack/var/spack/repos/key4hep-spack/config/cvmfs_build/upstreams.yaml spack/etc/spack/ -# compiler setup + compiler setup spack load gcc spack compiler find --scope site tar -czf key4hep-spack_centos7-cvmfs.tar.gz spack diff --git a/scripts/ci_setup_spack2.sh b/scripts/ci_setup_spack2.sh new file mode 100755 index 00000000..ed0e74b2 --- /dev/null +++ b/scripts/ci_setup_spack2.sh @@ -0,0 +1,20 @@ +# set up spack inside the k4-spack repo + if [ -n "$SPACK_VERSION" ]; then git clone https://github.com/key4hep/spack ; cd spack; git checkout $SPACK_VERSION; cd ..; else git clone --depth 1 https://github.com/key4hep/spack; fi + source spack/share/spack/setup-env.sh +# get the right config files to the right places + cp config/packages.yaml spack/etc/spack/ + mkdir spack/var/spack/repos/key4hep-spack + cp -r * spack/var/spack/repos/key4hep-spack || true +# clean up git directories for zip + rm -rf spack/var/spack/repos/key4hep-spack/spack || true + rm -rf spack/.git +# register k4 package recipes with spack + echo "repos:" > spack/etc/spack/repos.yaml + echo ' - $SPACK_ROOT/var/spack/repos/key4hep-spack' >> spack/etc/spack/repos.yaml + tar -czf key4hep-spack.tar.gz spack + cp ${PWD}/spack/var/spack/repos/key4hep-spack/config/cvmfs_build/upstreams.yaml spack/etc/spack/ + cp config/compilers_centos7_cvmfs.yaml spack/etc/spack/compilers.yaml +# compiler setup +# spack load gcc +# spack compiler find --scope site +# tar -czf key4hep-spack_centos7-cvmfs.tar.gz spack