Add release versioning for cryptol

This commit is contained in:
Jared Weakly 2020-07-21 09:34:26 -07:00
parent 4c9ee03b59
commit 4832160fd9
3 changed files with 23 additions and 8 deletions

2
.github/ci.sh vendored
View File

@ -90,7 +90,7 @@ build() {
if [[ "$ghc_ver" =~ 8.8.3|8.10.1 && $IS_WIN ]]; then JOBS=1; else JOBS=2; fi
cabal v2-configure -j$JOBS --minimize-conflict-set
for _ in {1..3}; do # retry due to flakiness with windows builds
cabal v2-build "$@" cryptol:exe:cryptol cryptol:exe:cryptol-html && break
./cry build "$@" && break
done
}

View File

@ -11,10 +11,16 @@ jobs:
changed: ${{ steps.outputs.outputs.changed-files }}
cryptol-version: ${{ steps.outputs.outputs.cryptol-version }}
name: ${{ steps.outputs.outputs.name }}
release: ${{ steps.env.outputs.release }}
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- id: env
if: |
(startsWith(github.head_ref, 'release-')
|| (github.event_name == 'pull_request' && startsWith(github.head_ref, 'actions/')))
run: .github/ci.sh output release 1
- id: outputs
run: |
.github/ci.sh set_files ${{ github.sha }}
@ -40,6 +46,8 @@ jobs:
- os: windows-latest
ghc: 8.8.3
name: Cryptol - GHC v${{ matrix.ghc }} - ${{ matrix.os }}
env:
RELEASE: ${{ needs.outputs.outputs.release }}
steps:
- uses: actions/checkout@v2
with:
@ -88,9 +96,7 @@ jobs:
run: .github/ci.sh test_dist
- if: >-
(startsWith(github.head_ref, 'release-')
|| (github.event_name == 'pull_request' && startsWith(github.head_ref, 'actions/')))
&& matrix.ghc == '8.10.1'
env.RELEASE && matrix.ghc == '8.10.1'
uses: actions/upload-artifact@v2
with:
path: dist/bin
@ -101,8 +107,7 @@ jobs:
needs: [outputs]
if: >-
(startsWith(github.head_ref, 'release-')
|| (github.event_name == 'pull_request'
&& startsWith(github.head_ref, 'actions/')))
|| (github.event_name == 'pull_request' && startsWith(github.head_ref, 'actions/')))
|| contains(needs.outputs.outputs.changed, 'docs/')
steps:
- uses: actions/checkout@v2

14
cry
View File

@ -41,9 +41,19 @@ case $COMMAND in
dirty_string="-- Last build $(date)"
echo "$dirty_string" >> src/GitRev.hs
cabal v2-build exe:cryptol
if [[ -n "$RELEASE" ]]; then
sed -i.bak -e 's/^commitShortHash = .*$/commitShortHash = "UNKNOWN"/' \
-e 's/^commitHash = .*$/commitHash = "UNKNOWN"/' \
-e 's/^commitBranch = .*$/commitBranch = "UNKNOWN"/' \
-e 's/^commitDirty = .*$/commitDirty = False/' \
-e '/import qualified GitRev/d' \
src/Cryptol/Version.hs
rm -f src/Cryptol/Version.hs.bak
fi
sed -i.bak "/^$dirty_string/d" src/GitRev.hs
cabal v2-build "$@" exe:cryptol
sed -i.bak "/^-- Last build/d" src/GitRev.hs
rm -f src/GitRev.hs.bak
;;