refactor: use enum
to handle options, rather than meaningless char
s
#116
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: CI | |
on: | |
pull_request: | |
push: | |
branches: [ main ] | |
tags: [ '*' ] | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
cancel-in-progress: true | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
stringspinner: | |
runs-on: ubuntu-latest | |
container: | |
image: archlinux/archlinux:latest | |
steps: | |
- name: update container packages | |
run: pacman -Syu --noconfirm | |
- name: install dependencies | |
run: | | |
pkgs=( | |
fmt | |
gcc | |
gcc-fortran | |
git | |
meson | |
ninja | |
pkgconf | |
python | |
tree | |
# additional dependencies for documentation generation | |
perl | |
# additional dependencies for pythia build | |
make | |
rsync | |
which | |
) | |
pacman -S --noconfirm ${pkgs[*]} | |
echo "[+++++] PACKAGE VERSIONS:" | |
for pkg in ${pkgs[@]}; do | |
echo "$pkg: $(pacman -Qi $pkg | grep -E '^Version')" | |
done | |
- name: git checkout | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
path: stringspinner_src | |
- name: build pythia | |
run: | | |
git clone https://gitlab.com/Pythia8/releases.git pythia_src | |
prefix=$(pwd)/pythia_install | |
cd pythia_src | |
./configure \ | |
--prefix=$prefix \ | |
--cxx=$(which g++) \ | |
--cxx-common="-fPIC" \ | |
--cxx-shared="-shared -ldl" | |
make -j4 | |
make install | |
echo "[+] set pythia environment vars:" | |
echo PATH=$prefix/bin${PATH:+:${PATH}} | tee -a $GITHUB_ENV | |
echo LD_LIBRARY_PATH=$prefix/lib${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}} | tee -a $GITHUB_ENV | |
echo PYTHIA8DATA=$prefix/share/Pythia8/xmldoc | tee -a $GITHUB_ENV | |
- name: pythia version | |
run: | | |
echo "## Pythia Version:" >> $GITHUB_STEP_SUMMARY | |
pythia8-config --version | tee -a $GITHUB_STEP_SUMMARY | |
- name: meson setup | |
run: meson setup build stringspinner_src --prefix=$(pwd)/install | |
- run: meson install | |
working-directory: build | |
- run: tree install | |
- run: meson test | |
working-directory: build | |
- name: test installation | |
run: install/bin/clas-stringspinner --num-events 1 | |
- name: test OSG options | |
run: install/bin/clas-stringspinner --trig 10 --docker --seed 1448577483 # see `clas12-mcgen` documentation | |
- name: test relocatability | |
run: | | |
mkdir relocated | |
cp -r install relocated/ | |
relocated/install/bin/clas-stringspinner --num-events 1 | |
- name: test symlinking | |
run: | | |
ln -sv install/bin/clas-stringspinner | |
./clas-stringspinner --num-events 1 | |
- name: generate documentation | |
run: | | |
mkdir publish | |
stringspinner_src/.github/generate_usage_guide.sh install/bin/clas-stringspinner |& tee publish/index.html | |
- name: upload documentation | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
retention-days: 3 | |
path: publish/ | |
deploy_webpages: | |
if: ${{ github.ref_type == 'tag' }} | |
needs: stringspinner | |
runs-on: ubuntu-latest | |
permissions: | |
pages: write | |
id-token: write | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
steps: | |
- name: deployment | |
id: deployment | |
uses: actions/deploy-pages@v4 |