Skip to content

Store the run time (and time at which the run ends) to the output file #514

Store the run time (and time at which the run ends) to the output file

Store the run time (and time at which the run ends) to the output file #514

Workflow file for this run

name: 'PR-Checks'
on:
workflow_dispatch:
pull_request:
types: [opened, reopened, synchronize]
branches:
- master
concurrency:
group: prCheck-${{ github.ref }}
cancel-in-progress: true
defaults:
run:
shell: bash
jobs:
# Validate YAML
Validate-YAML:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: "Set environmental variables"
run: |
echo "GALACTICUS_EXEC_PATH=$GITHUB_WORKSPACE" >> $GITHUB_ENV
- name: Mark directory safe
run: |
git config --global --add safe.directory $GALACTICUS_EXEC_PATH
- name: Install tools
run: |
sudo apt -y update
sudo apt install -y yamllint
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v45
with:
files: |
**/*.yml
- name: Validate any YAML files
run: |
status=0
for file in ${{ steps.changed-files.outputs.all_changed_files }}; do
if yamllint $file; then
echo "YAML $file is valid"
else
echo "YAML $file is invalid"
status=1
fi
done
exit $status
# Validate XML
Validate-XML:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: "Set environmental variables"
run: |
echo "GALACTICUS_EXEC_PATH=$GITHUB_WORKSPACE" >> $GITHUB_ENV
- name: Mark directory safe
run: |
git config --global --add safe.directory $GALACTICUS_EXEC_PATH
- name: Install tools
run: |
sudo apt -y update
sudo apt install -y libxml2-utils
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v45
with:
files: |
**/*.xml
- name: Validate any XML files
run: |
status=0
for file in ${{ steps.changed-files.outputs.all_changed_files }}; do
echo "Validating XML file: $file"
if xmllint --noout $file; then
echo "XML $file is valid"
else
echo "XML $file is invalid"
status=1
fi
done
exit $status
# Validate Perl scripts
Validate-Perl-Scripts:
runs-on: ubuntu-latest
container: ghcr.io/galacticusorg/buildenv:latest
steps:
- uses: actions/checkout@v4
- name: Check out repository analysis-perl
uses: actions/checkout@v4
with:
repository: galacticusorg/analysis-perl
path: analysis-perl
- name: "Set environmental variables"
run: |
echo "GALACTICUS_EXEC_PATH=$GITHUB_WORKSPACE" >> $GITHUB_ENV
echo "GALACTICUS_ANALYSIS_PERL_PATH=$GITHUB_WORKSPACE/analysis-perl" >> $GITHUB_ENV
- name: Mark directory safe
run: |
git config --global --add safe.directory $GALACTICUS_EXEC_PATH
- name: Get changed scripts
id: changed-scripts
uses: tj-actions/changed-files@v45
with:
files: |
**/*.pl
- name: Install tools
run: |
apt -y update
apt install -y libxml-simple-perl
- name: Validate any Perl scripts
run: |
status=0
for file in ${{ steps.changed-scripts.outputs.all_changed_files }}; do
if perl -c $file; then
echo "Perl script $file compiles correctly"
else
echo "Perl script $file fails to compile"
status=1
fi
if [[ -x $file ]]; then
echo "Perl script $file is executable"
else
echo "Perl script $file is not executable"
status=1
fi
done
exit $status
# Validate Perl modules
Validate-Perl-Modules:
runs-on: ubuntu-latest
container: ghcr.io/galacticusorg/buildenv:latest
steps:
- uses: actions/checkout@v4
- name: "Set environmental variables"
run: |
echo "GALACTICUS_EXEC_PATH=$GITHUB_WORKSPACE" >> $GITHUB_ENV
- name: Mark directory safe
run: |
git config --global --add safe.directory $GALACTICUS_EXEC_PATH
- name: Get changed modules
id: changed-modules
uses: tj-actions/changed-files@v45
with:
files: |
**/*.pm
- name: Install tools
run: |
apt -y update
apt install -y libxml-simple-perl
- name: Validate any Perl modules
run: |
status=0
for file in ${{ steps.changed-modules.outputs.all_changed_files }}; do
if perl -c $file; then
echo "Perl module $file compiles correctly"
else
echo "Perl module $file fails to compile"
status=1
fi
done
exit $status
# Fortran static analysis
Fortran-Static-Analysis:
runs-on: ubuntu-latest
container: ghcr.io/galacticusorg/buildenv:latest
steps:
- uses: actions/checkout@v4
- name: "Set environmental variables"
run: |
echo "GALACTICUS_EXEC_PATH=$GITHUB_WORKSPACE" >> $GITHUB_ENV
- name: Mark directory safe
run: |
git config --global --add safe.directory $GALACTICUS_EXEC_PATH
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v45
with:
files: |
**/*.F90
- name: Perform static analysis on Fortran files
run: |
status=0
for file in ${{ steps.changed-files.outputs.all_changed_files }}; do
if ./scripts/aux/staticAnalyzer.pl $file; then
echo "Fortran file $file passes analysis"
else
echo "Fortran file $file fails analysis"
status=1
fi
done
exit $status
# Embedded XML and LaTeX checks
Embedded-XML-LaTeX:
runs-on: ubuntu-latest
container: ghcr.io/galacticusorg/buildenv:latest
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: "Set environmental variables"
run: |
echo "GALACTICUS_EXEC_PATH=$GITHUB_WORKSPACE" >> $GITHUB_ENV
echo "DICTIONARY=en_US" >> $GITHUB_ENV
- name: Mark directory safe
run: |
git config --global --add safe.directory $GALACTICUS_EXEC_PATH
- name: Install tools
run: |
apt -y update
apt install -y texlive texlive-latex-extra texlive-science texlive-extra-utils hunspell hunspell-en-us libxml-simple-perl libregexp-common-perl libfile-temp-perl
- name: Build class information
run: |
cd $GALACTICUS_EXEC_PATH
make -j2 work/build/stateStorables.xml
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v45
with:
files: |
**/*.F90
**/*.Inc
- name: Perform checks of embedded XML and LaTeX
run: |
status=0
for file in ${{ steps.changed-files.outputs.all_changed_files }}; do
if ./scripts/aux/embeddedAnalyzer.pl $file warnings.md; then
echo "Embedded XML/LaTeX in file $file passes analysis"
else
echo "Embedded XML/LaTeX in file $file fails analysis"
status=1
fi
done
exit $status
- name: Check file existence
id: check_files
uses: andstor/file-existence-action@v3
with:
files: warnings.md
- name: Output to a job summary
if: steps.check_files.outputs.files_exists == 'true'
run: |
cat warnings.md >> $GITHUB_STEP_SUMMARY
- name: Comment on the PR if any warnings were found
if: steps.check_files.outputs.files_exists == 'true'
continue-on-error: true
uses: thollander/actions-comment-pull-request@v2
with:
filePath: warnings.md
# Spell check LaTeX files
Spell-Check-LaTeX:
runs-on: ubuntu-latest
container: ghcr.io/galacticusorg/buildenv:latest
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: "Set environmental variables"
run: |
echo "GALACTICUS_EXEC_PATH=$GITHUB_WORKSPACE" >> $GITHUB_ENV
echo "DICTIONARY=en_US" >> $GITHUB_ENV
- name: Mark directory safe
run: |
git config --global --add safe.directory $GALACTICUS_EXEC_PATH
- name: Install tools
run: |
apt -y update
apt install -y texlive texlive-latex-extra texlive-science texlive-extra-utils hunspell hunspell-en-us libxml-simple-perl libregexp-common-perl libfile-temp-perl
- name: Build class information
run: |
cd $GALACTICUS_EXEC_PATH
make -j2 work/build/stateStorables.xml
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v45
with:
files: |
**/*.tex
- name: Perform checks of LaTeX files
run: |
status=0
for file in ${{ steps.changed-files.outputs.all_changed_files }}; do
./scripts/aux/spellChecker.pl $file warnings.md
done
- name: Check file existence
id: check_files
uses: andstor/file-existence-action@v3
with:
files: warnings.md
- name: Comment on the PR if any warnings were found
if: steps.check_files.outputs.files_exists == 'true'
uses: thollander/actions-comment-pull-request@v2
with:
filePath: warnings.md