Skip to content
Merged
Show file tree
Hide file tree
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
23 changes: 23 additions & 0 deletions .github/scripts/extract_resolver_and_flags_for_stack.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/usr/bin/env bash

set -euo pipefail

CABAL_FILE="${CABAL_FILE:?Environment variable CABAL_FILE is required}"

readarray -t EXP_FLAGS < <(awk -f ./.github/script_helpers/extract_flags.awk "$CABAL_FILE")

echo "extracting experimental flags and setting them to true."
echo "if this fails, please verify all flags in package.yaml are set to true/false in stack.yaml"
for flag in "${EXP_FLAGS[@]}"; do
pattern="^( *${flag})[[:space:]]*:[[:space:]]*(true|false)"
grep -qE "${pattern}" stack.yaml
sed -i -E "s/${pattern}/\1: true/g" stack.yaml
done

echo "contents of stack.yaml file:"
cat stack.yaml

RESOLVER=$(grep -E '^(snapshot|resolver):' stack.yaml | awk '{ print $2 }')

printf "\nchose resolver %s" "$RESOLVER"
echo "resolver=$RESOLVER" >>"$GITHUB_OUTPUT"
10 changes: 5 additions & 5 deletions .github/workflows/build-and-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ jobs:
- name: Extract resolver
id: extract
shell: bash
run: |
RESOLVER=$(grep -E '^(snapshot|resolver):' stack.yaml | awk '{ print $2 }')
echo "resolver=$RESOLVER" >> $GITHUB_OUTPUT
run: bash ./.github/scripts/extract_resolver_and_flags_for_stack.sh
env:
CABAL_FILE: jbeam-edit.cabal
- name: Cache global Stack dependencies
uses: actions/cache@v4.3.0
with:
Expand All @@ -45,7 +45,7 @@ jobs:
stack-global-${{ matrix.os }}-${{
steps.extract.outputs.resolver
}}-${{
hashFiles('stack.yaml.lock')
hashFiles('stack.yaml', '**/stack.yaml.lock')
}}
restore-keys: |
stack-global-${{ matrix.os }}-${{ steps.extract.outputs.resolver }}-
Expand All @@ -58,7 +58,7 @@ jobs:
stack-local-${{ matrix.os }}-${{
steps.extract.outputs.resolver
}}-${{
hashFiles('**/stack.yaml.lock', '**/package.yaml')
hashFiles('**/stack.yaml', '**/stack.yaml.lock', '**/package.yaml')
}}
restore-keys: |
stack-local-${{ matrix.os }}-${{ steps.extract.outputs.resolver }}-
Expand Down
1 change: 1 addition & 0 deletions stack.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ packages: [.]

flags:
jbeam-edit:
lsp-server: false
transformation: false
dump-ast: false
windows-example-paths: false