diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..85d1978 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,122 @@ +# Check the syntax, semantics and layout of the DDLm reference dictionary. +# +# Note, that the reference dictionary is validated against itself therefore +# an additional external checkout of the DDLm repository is not needed. + +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: Checkout + uses: actions/checkout@v4 + + # 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: Checkout + uses: actions/checkout@v4 + + - name: Checkout enumeration templates + uses: actions/checkout@v4 + 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 + runs-on: ubuntu-latest + needs: syntax + + steps: + - name: Get the cache + uses: actions/cache@v4 + id: cache + with: + path: ~/.julia + key: ${{ runner.os }}-julia-v2 + + - name: Install Julia + uses: julia-actions/setup-julia@v2 + with: + version: '1.10' + + - name: Install Julia packages + if: steps.cache.outputs.cache-hit != 'true' + run: | + julia -e 'import Pkg;Pkg.add("CrystalInfoFramework");Pkg.add("Lerche");Pkg.add("ArgParse")' + + - name: Checkout + uses: actions/checkout@v4 + with: + path: main + + - name: Checkout julia tools + uses: actions/checkout@v4 + with: + repository: jamesrhester/julia_cif_tools + path: julia_cif_tools + + - name: Checkout enumeration templates + uses: actions/checkout@v4 + with: + repository: COMCIFS/Enumeration_Templates + path: enum + + - name: Move template files to the expected location + run: | + mv enum/templ_enum.cif main/templ_enum.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/main $file $PWD/main/ddl.dic + if [ $? != 0 ] + then + exit 1 ; + fi + done