Skip to content

Commit

Permalink
[actions] set up a first simple version of my "manual" workflow, incl…
Browse files Browse the repository at this point in the history
…uding code generation of all processes in the repo (currently 15)

This is derived from the default manual.yaml for simple github manual tests

Code generation also includes checking clang formatting
After code generation, the code is compared to that in the repo and an error is thrown if there are differences

Eventually, the idea is to include here also tput and tmad tests
  • Loading branch information
valassi committed Oct 30, 2023
1 parent 24fb807 commit 9604817
Show file tree
Hide file tree
Showing 2 changed files with 101 additions and 24 deletions.
76 changes: 76 additions & 0 deletions .github/workflows/manual.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
#!/bin/bash
# Copyright (C) 2020-2023 CERN and UCLouvain.
# Licensed under the GNU Lesser General Public License (version 3 or later).
# Created by: A. Valassi (Oct 2023) for the MG5aMC CUDACPP plugin.
# Further modified by: A. Valassi (2023) for the MG5aMC CUDACPP plugin.

# Verbose script
###set -x

# Automatic exit on error
set -e

# Exit status
status=0

# Initialise
echo "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"
echo "[manual.sh] starting at $(date)"
echo "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"

echo
echo "Current directory is $(pwd)"
echo "Current git commit is $(git log --oneline -n1 | cut -d' ' -f1)"
topdir=$(pwd)

#echo
#echo "Contents of . (start)"
#ls
#echo "Contents of . (end)"

#echo
#echo "Contents of MG5aMC/mg5amcnlo (start)"
#ls MG5aMC/mg5amcnlo
#echo "Contents of MG5aMC/mg5amcnlo (end)"

# Code generation
cd ${topdir}/epochX/cudacpp
processes="$(git ls-tree --name-only HEAD *.mad *.sa)"
###processes="gg_tt.mad"
for proc in $processes; do
echo
echo "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"
echo "Code generation for ${proc}"
echo "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"
if [ "${proc%.mad}" != "${proc}" ]; then
# Generate code and check clang formatting
./CODEGEN/generateAndCompare.sh ${proc%.mad} --mad
elif [ "${proc%.sa}" != "${proc}" ]; then
# Generate code and check clang formatting
./CODEGEN/generateAndCompare.sh ${proc%.sa}
else
echo "WARNING! SKIP process directory '${proc}' because it does not end in .mad or .sa"
fi
# Check if there are any differences to the current repo
git checkout HEAD ${proc}/CODEGEN*.txt
if [ "${proc%.mad}" != "${proc}" ]; then
git checkout HEAD ${proc}/Cards/me5_configuration.txt
###sed -i 's/DEFAULT_F2PY_COMPILER=f2py.*/DEFAULT_F2PY_COMPILER=f2py3/' ${proc}/Source/make_opts
git checkout HEAD ${proc}/Source/make_opts
fi
echo
echo "git diff (start)"
git diff --exit-code
echo "git diff (end)"
done

# Finalise
echo
echo "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"
if [ $status -eq 0 ]; then
echo "[manual.sh] $stage finished with status=$status (OK) at $(date)"
else
echo "[manual.sh] $stage finished with status=$status (NOT OK) at $(date)"
fi
echo "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"
exit $status
49 changes: 25 additions & 24 deletions .github/workflows/manual.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,33 @@
# This is a basic workflow that is manually triggered
# Copyright (C) 2020-2023 CERN and UCLouvain.
# Licensed under the GNU Lesser General Public License (version 3 or later).
# Created by: A. Valassi (Oct 2023) for the MG5aMC CUDACPP plugin.
# Further modified by: A. Valassi (2023) for the MG5aMC CUDACPP plugin.

name: Manual workflow
name: Manual test suite

# Controls when the action will run. Workflow runs when manually triggered using the UI
# or API.
on:
push:
paths:
- '.github/workflows/manual.*'
workflow_dispatch:
# Inputs the workflow accepts.
inputs:
name:
# Friendly description to be shown in the UI instead of 'name'
description: 'Person to greet'
# Default value if no value is explicitly provided
default: 'World'
# Input has to be provided for the workflow to run
required: true
# The data type of the input
type: string
#inputs:
# name:
# description: 'Person to greet'
# default: 'World'
# required: true
# type: string

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "greet"
greet:
# The type of runner that the job will run on
codegen:
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Runs a single command using the runners shell
- name: Send greeting
run: echo "Hello ${{ inputs.name }}"
# See https://github.com/actions/checkout
# (NB actions/checkout@v2 is deprecated)
# (NB actions/checkout@v4 need "Allow owner and select non-owner" and "Allow actions created by github")
- uses: actions/checkout@v4
with:
submodules: 'true'
- name: codegen_step
run: echo Current directory is $(pwd); echo execute .github/workflows/manual.sh; .github/workflows/manual.sh
#- name: Send greeting
# run: echo "Hello ${{ inputs.name }}"

0 comments on commit 9604817

Please sign in to comment.