Skip to content

Remove the description of dataization #1142

Remove the description of dataization

Remove the description of dataization #1142

Workflow file for this run

# The MIT License (MIT)
# Copyright (c) 2016-2024 Objectionary.com
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
name: GHC (build, test, haddock)
# Controls when the workflow will run
'on':
push:
branches:
- master
tags: [v*]
paths-ignore: [ 'README.md' ]
pull_request:
branches:
- master
paths-ignore: [ 'README.md' ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
permissions:
contents: write # to submit Haddock documentation to GitHub Pages
env:
syntax-dir: "eo-phi-normalizer/src/Language/EO/Phi/Syntax"
jobs:
check:
name: "Run static checks"
runs-on: ubuntu-latest
steps:
- name: 📥 Checkout repository
uses: actions/checkout@v4
with:
submodules: true
ref: ${{ github.ref }}
- uses: haskell-actions/run-fourmolu@v11
with:
version: "0.14.0.0"
pattern: |
eo-phi-normalizer/**/*.hs
!${{ env.syntax-dir }}/**/*.hs
- uses: haskell-actions/hlint-setup@v2
- name: Get hlint-bin
id: get-hlint-bin
run: |
chmod +x scripts/run-hlint.sh
echo "hlint-bin=$(realpath scripts/run-hlint.sh)" >> $GITHUB_OUTPUT
- uses: haskell-actions/hlint-run@v2
with:
hlint-bin: ${{ steps.get-hlint-bin.outputs.hlint-bin }}
- uses: yegor256/[email protected]
with:
license: LICENSE.txt
globs: >-
**/*.yml
**/*.yaml
**/*.hs
**/*.sh
**/*.cf
ignore: >-
**/.pre-commit-config.yaml
**/run-fourmolu.sh
**/Abs.hs
**/Print.hs
- uses: yegor256/[email protected]
with:
license: ./eo-phi-normalizer/LICENSE
globs: >-
**/Abs.hs
**/Print.hs
tests:
name: Run tests
needs: check
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
fail-fast: false
steps:
- name: 📥 Checkout repository
uses: actions/checkout@v4
with:
submodules: true
ref: ${{ github.ref }}
- name: Restore Syntax files
id: restore-syntax-files
uses: actions/cache/restore@v4
with:
key: syntax-files-${{ runner.os }}-${{ hashFiles(format('{0}.cf', env.syntax-dir), 'stack.yaml.lock') }}
path: |
${{ env.syntax-dir }}/Lex.hs
${{ env.syntax-dir }}/Par.hs
- name: Check Syntax files exist
if: steps.restore-syntax-files.outputs.cache-hit == 'true'
shell: bash
id: check-syntax-files
run: |
source scripts/lib.sh
check_syntax_files_exist
printf "SYNTAX_FILES_EXIST=$SYNTAX_FILES_EXIST\n" >> $GITHUB_OUTPUT
- name: 🧰 Setup Stack
uses: freckle/stack-action@v5
with:
stack-build-arguments: --pedantic
stack-build-arguments-build: --dry-run
stack-build-arguments-test: --ghc-options -O2 ${{ steps.check-syntax-files.outputs.SYNTAX_FILES_EXIST == 'true' && ' ' || '--reconfigure --force-dirty --ghc-options -fforce-recomp' }}
- name: Save Syntax files
uses: actions/cache/save@v4
if: steps.restore-syntax-files.outputs.cache-hit != 'true'
with:
key: syntax-files-${{ runner.os }}-${{ hashFiles(format('{0}.cf', env.syntax-dir), 'stack.yaml.lock') }}
path: |
${{ env.syntax-dir }}/Lex.hs
${{ env.syntax-dir }}/Par.hs
pipeline:
name: Run pipeline
needs: check
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
fail-fast: false
permissions:
contents: write
pull-requests: write
env:
branch_is_not_master: ${{ github.ref_name != 'master' }}
steps:
- name: 📥 Checkout repository
uses: actions/checkout@v4
with:
submodules: true
ref: ${{ github.ref }}
- name: Restore Syntax files
id: restore-syntax-files
uses: actions/cache/restore@v4
with:
key: syntax-files-${{ runner.os }}-${{ hashFiles(format('{0}.cf', env.syntax-dir), 'stack.yaml.lock') }}
path: |
${{ env.syntax-dir }}/Lex.hs
${{ env.syntax-dir }}/Par.hs
- name: Check Syntax files exist
if: steps.restore-syntax-files.outputs.cache-hit == 'true'
shell: bash
id: check-syntax-files
run: |
source scripts/lib.sh
check_syntax_files_exist
printf "SYNTAX_FILES_EXIST=$SYNTAX_FILES_EXIST\n" >> $GITHUB_OUTPUT
- name: 🧰 Setup Stack
uses: freckle/stack-action@v5
with:
stack-build-arguments: --pedantic --ghc-options -O2 --copy-bins ${{ steps.check-syntax-files.outputs.SYNTAX_FILES_EXIST == 'true' && ' ' || '--reconfigure --force-dirty --ghc-options -fforce-recomp' }}
test: false
- name: Save Syntax files
uses: actions/cache/save@v4
if: steps.restore-syntax-files.outputs.cache-hit != 'true'
with:
key: syntax-files-${{ runner.os }}-${{ hashFiles(format('{0}.cf', env.syntax-dir), 'stack.yaml.lock') }}
path: |
${{ env.syntax-dir }}/Lex.hs
${{ env.syntax-dir }}/Par.hs
- uses: actions/setup-node@v4
with:
node-version: "20.18.0"
cache: npm
- uses: actions/setup-java@v4
with:
distribution: "zulu"
java-version: 21.0.5+11
# TODO #340:10m switch to chrisdickinson/setup-yq after https://github.com/chrisdickinson/setup-yq/pull/14 is merged
- uses: deemp/setup-yq@latest
with:
yq-version: v4.44.1
yq-url: ${{ format('https://github.com/mikefarah/yq/releases/download/{{version}}/yq_{{platform}}_{{arch}}{0}', runner.os == 'Windows' && '.exe' || '') }}
- name: Check pipeline lock
id: check-pipeline-lock
shell: bash
run: |
source scripts/lib.sh
write_pipeline_lock
printf "Pipeline lock changed: $PIPELINE_LOCK_CHANGED\n"
printf "PIPELINE_LOCK_CHANGED=$PIPELINE_LOCK_CHANGED\n" >> $GITHUB_OUTPUT
printf "PIPELINE_LOCK_FILE_NEW_RELATIVE=$PIPELINE_LOCK_FILE_NEW_RELATIVE" >> $GITHUB_OUTPUT
- name: Restore pipeline files
id: pipeline-files
if: steps.check-pipeline-lock.outputs.PIPELINE_LOCK_CHANGED
uses: actions/cache/restore@v4
with:
key: pipeline-files-${{ runner.os }}-${{ hashFiles(steps.check-pipeline-lock.outputs.PIPELINE_LOCK_FILE_NEW_RELATIVE) }}
path: pipeline
- name: Run pipeline
shell: bash
env:
PIPELINE_LOCK_CHANGED: ${{ (steps.check-pipeline-lock.outputs.PIPELINE_LOCK_CHANGED == 'true') || (steps.pipeline-files.outputs.cache-hit != 'true') }}
EO_PHI_NORMALIZER_INSTALLED: "true"
run: ./scripts/pipeline.sh
- name: Check failing tests
shell: bash
if: always()
run: |
source scripts/lib.sh
get_failing_tests_non_normalized
get_failing_tests_normalized
- name: Save pipeline files
if: steps.check-pipeline-lock.outputs.PIPELINE_LOCK_CHANGED
uses: actions/cache/save@v4
with:
key: pipeline-files-${{ runner.os }}-${{ hashFiles(steps.check-pipeline-lock.outputs.PIPELINE_LOCK_FILE_NEW_RELATIVE) }}
path: pipeline
- name: Configure git
if: always() && env.branch_is_not_master && runner.os == 'Linux'
env:
# required for gh
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
${{ github.head_ref && format('gh pr checkout {0}', github.event.pull_request.number) || ''}}
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
- name: Commit and push changes in pipeline lock
if: always() && env.branch_is_not_master && runner.os == 'Linux' && steps.check-pipeline-lock.outputs.PIPELINE_LOCK_CHANGED
run: |
source scripts/lib.sh
commit_and_push_if_changed "$PIPELINE_LOCK_FILE_RELATIVE" "$PIPELINE_LOCK_FILE_RELATIVE"
- name: Commit and push changes in eo-phi-normalizer data files
if: always() && env.branch_is_not_master && runner.os == 'Linux'
run: |
source scripts/lib.sh
data_directory="$PIPELINE_EO_PHI_NORMALIZER_DATA_DIR"
commit_and_push_if_changed "$data_directory" "eo-phi-normalizer data files"
- name: Install mdsh
if: env.branch_is_not_master && runner.os == 'Linux'
uses: baptiste0928/[email protected]
with:
crate: mdsh
git: https://github.com/zimbatm/mdsh
branch: main
- name: Update Markdown files
if: env.branch_is_not_master && runner.os == 'Linux'
run: ./scripts/update-markdown.sh
- name: Commit and push changes in Markdown files
if: env.branch_is_not_master && runner.os == 'Linux'
run: |
source scripts/lib.sh
files=('site' 'proposals' 'README.md' 'CONTRIBUTING.md')
commit_and_push_if_changed "$files" "Markdown files"
- name: Create a directory for docs
if: runner.os == 'Linux'
run: mkdir -p dist
- name: Setup mdBook
if: runner.os == 'Linux'
uses: jontze/action-mdbook@v3
with:
token: ${{secrets.GITHUB_TOKEN}}
mdbook-version: "~0.4.43"
use-linkcheck: true
- name: Run mdbook
if: runner.os == 'Linux'
run: |
cd site/docs
mdbook build
mv docs/html ../../dist/docs
- name: Upload pipeline artifact
id: pipeline-artifact
if: always()
uses: actions/upload-artifact@v4
with:
# we can't have multiple artifact versions
# because we need to restore the most recent version in the docs job
#
# we can't use caches because we can't overwrite them
name: pipeline-files-${{ runner.os }}
overwrite: true
# Need to upload .eoc
include-hidden-files: true
# Problem
#
# The action doesn't save the pipeline directory.
# It saves just the content of this directory.
#
# Seems like the wildcard case (https://github.com/actions/upload-artifact#upload-using-multiple-paths-and-exclusions)
# is triggered when all paths start with "pipeline".
#
# Hence, to preserve the path structure, it's necessary
# to add a path that doesn't start with "pipeline".
path: |
pipeline
!pipeline/**/.eoc
!pipeline/eo-yaml
pipeline/eo-initial/.eoc/4-pull/org/
pipeline/phi-initial/.eoc/phi/org
dist
- name: Write about the artifact in the job summary
if: always()
shell: bash
run: |
cat << EOF >> $GITHUB_STEP_SUMMARY
<h2>Artifact</h2>
<p>
The
<a href="${{ steps.pipeline-artifact.outputs.artifact-url }}">
artifact
</a> contains files used or produced during the pipeline run:
</p>
<ul>
<li>EO and PHI programs</li>
<li>Reports</li>
</ul>
EOF
- name: Write the report in the job summary
shell: bash
run: |
cat << EOF >> $GITHUB_STEP_SUMMARY
<h2>Report</h2>
<details>
<summary>Click to expand</summary>
$(cat $(yq '.report.output.markdown' < pipeline/config.yaml))
</details>
EOF
docs:
needs: [pipeline, tests]
if: ${{ github.ref_name == 'master' }}
name: "Build and upload site (master)"
runs-on: ubuntu-latest
steps:
- name: 📥 Checkout repository
uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
- name: 🧰 Setup Stack
uses: freckle/stack-action@v5
with:
test: false
stack-build-arguments: --fast --haddock
cache-prefix: docs-
- name: Download pipeline artifact
uses: actions/download-artifact@v4
with:
pattern: pipeline-files-${{ runner.os }}
merge-multiple: true
- name: Add haddock
run: |
mkdir -p dist/haddock
mv $(stack path --local-doc-root)/* dist/haddock
- name: Add report
run: |
mkdir -p dist/report
cp pipeline/report/report.html dist/report/index.html
- name: Add index.html
run: mv site/index.html dist
- name: 🚀 Publish Site
uses: JamesIves/github-pages-deploy-action@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
folder: dist
single-commit: true