Skip to content

Commit

Permalink
fix caching and restrictive depend
Browse files Browse the repository at this point in the history
  • Loading branch information
Home committed Dec 31, 2024
1 parent 733ee57 commit e590514
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 26 deletions.
67 changes: 42 additions & 25 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,39 @@ jobs:
outputs:
version: ${{ steps.get_version.outputs.VERSION }}
steps:
- uses: actions/checkout@v4
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Compute Cache Key
id: cache_key
run: |
key=$(cat stack.yaml stack.yaml.lock package.yaml | sha256sum | cut -d ' ' -f1)
echo "key=$key" >> $GITHUB_ENV
- name: Cache Stack Dependencies
uses: actions/cache@v3
with:
path: |
~/.stack
!~/.stack/programs
./.stack-work
key: ${{ runner.os }}-stack-${{ env.key }}
restore-keys: |
${{ runner.os }}-stack-${{ hashFiles('stack.yaml', 'stack.yaml.lock', 'package.yaml') }}
${{ runner.os }}-stack-
- name: Setup Haskell
uses: haskell-actions/setup@v2
with:
ghc-version: '9.6.6'
enable-stack: 'true'
stack-version: 'latest'

- name: Install Dependencies
run: stack build --only-dependencies

- name: Create Release
uses: softprops/action-gh-release@v1
with:
Expand All @@ -31,42 +60,30 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Setup Haskell
uses: haskell-actions/setup@v2
with:
ghc-version: '9.6.6'
enable-stack: 'true'
stack-version: 'latest'
- name: Checkout Code
uses: actions/checkout@v4

- name: Compute Cache Key
id: cache_key
run: echo "key=$(grep -v '^version:' package.yaml | sha256sum | cut -d ' ' -f1)" >> $GITHUB_ENV

- name: Cache Stack dependencies
- name: Restore Cache
uses: actions/cache@v3
with:
path: |
~/.stack
!~/.stack/programs
./.stack-work
key: ${{ runner.os }}-stack-${{ hashFiles('stack.yaml') }}-${{ env.key }}
key: ${{ needs.create_release.outputs.cache_key }}
restore-keys: |
${{ runner.os }}-stack-${{ hashFiles('stack.yaml', 'stack.yaml.lock', 'package.yaml') }}
${{ runner.os }}-stack-
- name: Cache fpm gems
uses: actions/cache@v3
- name: Setup Haskell
uses: haskell-actions/setup@v2
with:
path: |
~/.gem
key: ${{ runner.os }}-gem
ghc-version: '9.6.6'
enable-stack: 'true'
stack-version: 'latest'

- name: Install fpm
run: |
sudo apt-get update
sudo apt-get install -y ruby ruby-dev rubygems build-essential z3
sudo gem install --no-document fpm
- name: Install Dependencies
run: stack build --only-dependencies

- name: Build and Package
id: build_package
Expand Down
2 changes: 1 addition & 1 deletion reposcripts/package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ cp ./reposcripts/bore.toml $TEMPORARY_PKG_DIR/var/gopher/source/bore.toml
# Run fpm to create the Debian package.
fpm -s dir -t deb -n bore -v ${VERSION} \
--description "Bore gopherhole builder. Built on ${DISTRO}, Kernel ${KERNEL}, libc ${LIBC}" \
--depends "libc6 (>= ${LIBC})" \
--depends "libc6" \
--maintainer "someodd <[email protected]>" \
--url "http://www.someodd.zip/showcase/bore" \
--license "GPL" \
Expand Down

0 comments on commit e590514

Please sign in to comment.