Skip to content

Commit

Permalink
CI: add automated GitHub prereleases
Browse files Browse the repository at this point in the history
  • Loading branch information
ulysses4ever committed Apr 23, 2023
1 parent 5f77754 commit 7402038
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 5 deletions.
44 changes: 39 additions & 5 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,9 @@ jobs:
# see https://github.com/actions/virtual-environments/issues/2619#issuecomment-788397841
sudo /usr/sbin/purge
fi
tar -cvf cabal-head.tar -C $(dirname "$CABAL_EXEC") $(basename "$CABAL_EXEC")
echo "CABAL_EXEC_TAR=cabal-head.tar" >> $GITHUB_ENV
export CABAL_EXEC_TAR="cabal-head-${{ runner.os }}-x86_64.tar"
tar -cvf $CABAL_EXEC_TAR -C $(dirname "$CABAL_EXEC") $(basename "$CABAL_EXEC")
echo "CABAL_EXEC_TAR=$CABAL_EXEC_TAR" >> $GITHUB_ENV
# We upload the cabal executable built with the ghc used in the release for:
# - Reuse it in the dogfooding job (although we could use the cached build dir)
Expand All @@ -146,7 +147,7 @@ jobs:
if: matrix.ghc == env.GHC_FOR_RELEASE
uses: actions/upload-artifact@v3
with:
name: cabal-${{ runner.os }}-${{ matrix.ghc }}
name: cabal-${{ runner.os }}-x86_64
path: ${{ env.CABAL_EXEC_TAR }}

- name: Validate lib-tests
Expand Down Expand Up @@ -271,11 +272,11 @@ jobs:
- name: Download cabal executable from workflow artifacts
uses: actions/download-artifact@v3
with:
name: cabal-${{ runner.os }}-${{ matrix.ghc }}
name: cabal-${{ runner.os }}-x86_64
path: cabal-head

- name: Untar the cabal executable
run: tar -xf ./cabal-head/cabal-head.tar -C ./cabal-head
run: tar -xf ./cabal-head/cabal-head-${{ runner.os }}-x86_64.tar -C cabal-head

- name: print-config using cabal HEAD
run: sh validate.sh ${{ env.COMMON_FLAGS }} --with-cabal ./cabal-head/cabal -s print-config
Expand All @@ -285,6 +286,39 @@ jobs:
- name: Build using cabal HEAD
run: sh validate.sh ${{ env.COMMON_FLAGS }} --with-cabal ./cabal-head/cabal -s build

prerelease-head:
name: Create a GitHub prerelease with the binary artifacts
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master'

# IMPORTANT! Any job added to the workflow should be added here too
needs: [validate, validate-old-ghcs, dogfooding]

steps:
- uses: actions/download-artifact@v2
with:
name: cabal-Windows-x86_64

- uses: actions/download-artifact@v2
with:
name: cabal-Linux-x86_64

- uses: actions/download-artifact@v2
with:
name: cabal-macOS-x86_64

- name: Create GitHub prerelease
uses: "marvinpinto/[email protected]"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: "cabal-head"
prerelease: true
title: "cabal-head"
files: |
cabal-head-Windows-x86_64.tar
cabal-head-Linux-x86_64.tar
cabal-head-macOS-x86_64.tar
# We use this job as a summary of the workflow
# It will fail if any of the previous jobs does it
# This way we can use it exclusively in branch protection rules
Expand Down
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,14 @@ Ways to get the `cabal-install` binary
2. _[Download from official website](https://www.haskell.org/cabal/download.html)_:
the `cabal-install` binary download for your platform should contain the `cabal` executable.

_Getting unreleased versions of `cabal-install`_: gives you a chance to try out yet-unreleased features.
Currently, we only provide binaries for `x86_64` platforms.

1. _[GitHub preview release built from the tip of the `master branch](https://github.com/haskell/cabal/releases/tag/cabal-head)_:

2. Even more cutting-edge binaries built from pull requests are always available
from the `Validate` worklow page on GitHub at the very bottom of the page.

Ways to build `cabal-install` for everyday use
--------------------------------------------

Expand Down

0 comments on commit 7402038

Please sign in to comment.