Skip to content

Commit

Permalink
Add setup for a new freeze file without cabal index timestap for use …
Browse files Browse the repository at this point in the history
…in cache key

Use bash (windows)

polish
  • Loading branch information
0rphee committed Oct 20, 2023
1 parent 862d87e commit a72e765
Showing 1 changed file with 34 additions and 1 deletion.
35 changes: 34 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,44 @@ jobs:
run: |
cabal freeze
- name: Setup cabal.project.freeze.cache.key
shell: bash
run: |
# Create a new caba.project.freeze.cache.key file for the cache key, removing the cabal index timestamp in the last line
source_file="cabal.project.freeze"
target_file="cabal.project.freeze.cache.key"
# Check if the source file exists
if [ ! -e "$source_file" ]; then
echo "Source file '$source_file' does not exist."
exit 1
fi
# Copy the source file to the target file
cp "$source_file" "$target_file"
# Check if the copy was successful
if [ $? -ne 0 ]; then
echo "Failed to copy the source file to the target file."
exit 1
fi
# Remove the last line from the target file
sed -i'' -e '$d' "$target_file"
# Check if the removal of the last line was successful
if [ $? -ne 0 ]; then
echo "Failed to remove the last line from the target file."
exit 1
fi
echo "File '$target_file' created with the last line removed."
- uses: actions/[email protected]
name: Cache ~/.cabal/store
with:
path: ${{ steps.setup-haskell-cabal.outputs.cabal-store }}
key: ${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles('cabal.project.freeze') }}
key: ${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles('cabal.project.freeze.cache.key') }}

- name: Build
run: |
Expand Down

0 comments on commit a72e765

Please sign in to comment.