Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
150 changes: 150 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
# Check the syntax, semantics and layout of DDLm dictionaries

name: CIF Syntax and Style Check

# Controls when the action will run. Triggers the workflow on push or pull
# request events but only for the main branch
on:
push:
branches:
- main
paths-ignore:
- '.github/**'

pull_request:
branches:
- main
paths-ignore:
- '.github/**'

workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
syntax:
name: Syntax
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Check out the target repository
uses: actions/checkout@v6

# Check syntax of all CIF files
- name: Check CIF syntax
uses: COMCIFS/cif_syntax_check_action@master
id: cif_syntax_check

semantics:
name: Semantics
runs-on: ubuntu-latest
needs: syntax

steps:
- name: Check out the target repository
uses: actions/checkout@v6

- name: Check out the DDLm reference dictionary
uses: actions/checkout@v6
with:
repository: COMCIFS/DDLm
path: cif-dictionaries/DDLm

- name: Check out enumeration templates
uses: actions/checkout@v6
with:
repository: COMCIFS/Enumeration_Templates
path: cif-dictionaries/Enumeration_Templates

- name: Run dictionary validity checks
uses: COMCIFS/dictionary_check_action@main
id: ddlm_check

layout:
name: Layout
# Disable the layout check for now
if: false
runs-on: ubuntu-latest
needs: syntax

env:
JULIA_VERSION: '1.10'
JULIA_DEP_FILE: 'julia_cif_tools/Project.toml'

steps:
- name: Install Julia
uses: julia-actions/setup-julia@v3
with:
version: ${{ env.JULIA_VERSION }}

- name: Check out Julia tools
uses: actions/checkout@v6
with:
repository: jamesrhester/julia_cif_tools
path: julia_cif_tools

- name: Get the cache
uses: actions/cache@v5
id: cache
with:
path: ~/.julia
key: ${{ runner.os }}-julia-${{ env.JULIA_VERSION }}-${{ hashFiles(env.JULIA_DEP_FILE) }}

- name: Install Julia packages
if: steps.cache.outputs.cache-hit != 'true'
run: |
julia -e 'using Pkg, TOML; map(Pkg.add, collect(keys(TOML.parsefile("${{ env.JULIA_DEP_FILE }}")["deps"]))); Pkg.instantiate()'

- name: Check out the target repository
uses: actions/checkout@v6
with:
path: main

- name: Check out the DDLm reference dictionary
uses: actions/checkout@v6
with:
repository: COMCIFS/DDLm
path: DDLm

- name: Check out enumeration templates
uses: actions/checkout@v6
with:
repository: COMCIFS/Enumeration_Templates
path: enum

- name: Check out attribute templates
uses: actions/checkout@v6
with:
repository: COMCIFS/Attribute_Templates
path: templ

- name: Check out the coreCIF dictionary
uses: actions/checkout@v6
with:
repository: COMCIFS/cif_core
path: cif_core

- name: Move template files to the expected location
run: |
mv enum/templ_enum.cif cif_core/templ_enum.cif
mv templ/templ_attr.cif cif_core/templ_attr.cif

- name: Run diagnostics
run: |
ls -a
pwd
which julia

- name: Run dictionary layout checks
run: |
julia -e 'using Pkg; Pkg.status()'
for file in main/*.dic
do
echo "Checking $file"
julia -O0 ./julia_cif_tools/linter.jl -i $PWD/cif_core $file $PWD/DDLm/ddl.dic
if [ $? != 0 ]
then
exit 1 ;
fi
done