Skip to content

Commit

Permalink
try
Browse files Browse the repository at this point in the history
  • Loading branch information
deemp committed May 21, 2024
1 parent 2405df9 commit 28cffdc
Showing 1 changed file with 177 additions and 177 deletions.
354 changes: 177 additions & 177 deletions .github/workflows/ghc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ jobs:
pipeline:
name: Run pipeline
# needs: check
needs: check
runs-on: ${{ matrix.os }}
strategy:
matrix:
Expand All @@ -122,84 +122,84 @@ jobs:
if: ${{ runner.os == 'Windows' }}
run: chcp 65001

- uses: mxschmitt/action-tmate@v3

# - 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
# cache: npm

# - uses: actions/setup-java@v4
# with:
# distribution: "zulu"
# java-version: 21

# # 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') }}
# NORMALIZER_INSTALLED: "true"
# run: ./scripts/pipeline.sh
# - uses: mxschmitt/action-tmate@v3

- 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
cache: npm

- uses: actions/setup-java@v4
with:
distribution: "zulu"
java-version: 21

# 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') }}
NORMALIZER_INSTALLED: "true"
run: ./scripts/pipeline.sh

- name: Check failing tests
shell: bash
Expand All @@ -210,104 +210,104 @@ jobs:
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() && 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() && 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 normalizer data files
# if: always() && runner.os == 'Linux'
# run: |
# source scripts/lib.sh
# data_directory="eo-phi-normalizer/data"
# commit_and_push_if_changed "$data_directory" "normalizer data files"

# - name: Install mdsh
# if: runner.os == 'Linux'
# uses: baptiste0928/cargo-install@v3.1.0
# with:
# crate: mdsh
# git: https://github.com/zimbatm/mdsh
# branch: main

# - name: Update Markdown files
# if: runner.os == 'Linux'
# run: ./scripts/update-markdown.sh

# - name: Commit and push changes in Markdown files
# if: runner.os == 'Linux'
# run: |
# source scripts/lib.sh
# files="site proposals README.md"
# commit_and_push_if_changed "$files" "Markdown files"

# - 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
# path: |
# pipeline
# !pipeline/**/.eoc
# !pipeline/yaml
# pipeline/phi/.eoc/4-pull/org
# pipeline/phi/.eoc/phi/org
# pipeline/phi/.eoc/print/org
# report

# - 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 report/report.md)
# </details>
# EOF
- 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() && 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() && 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 normalizer data files
if: always() && runner.os == 'Linux'
run: |
source scripts/lib.sh
data_directory="eo-phi-normalizer/data"
commit_and_push_if_changed "$data_directory" "normalizer data files"
- name: Install mdsh
if: runner.os == 'Linux'
uses: baptiste0928/cargo-install@v3.1.0
with:
crate: mdsh
git: https://github.com/zimbatm/mdsh
branch: main

- name: Update Markdown files
if: runner.os == 'Linux'
run: ./scripts/update-markdown.sh

- name: Commit and push changes in Markdown files
if: runner.os == 'Linux'
run: |
source scripts/lib.sh
files="site proposals README.md"
commit_and_push_if_changed "$files" "Markdown files"
- 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
path: |
pipeline
!pipeline/**/.eoc
!pipeline/yaml
pipeline/phi/.eoc/4-pull/org
pipeline/phi/.eoc/phi/org
pipeline/phi/.eoc/print/org
report
- 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 report/report.md)
</details>
EOF
docs:
needs: [pipeline, tests]
Expand Down

0 comments on commit 28cffdc

Please sign in to comment.