Skip to content

Commit

Permalink
Merge pull request #200 from unisonweb/cache-ucm
Browse files Browse the repository at this point in the history
Cache ucm release
  • Loading branch information
ceedubs authored Jan 15, 2025
2 parents 11ec7a0 + e8e3b1d commit 82fa833
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 16 deletions.
25 changes: 23 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:

jobs:
tests-transcript:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
strategy:
fail-fast: false
max-parallel: 4
Expand All @@ -20,12 +20,33 @@ jobs:
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: Restore cached ucm release
id: restore-cached-ucm
uses: actions/cache/restore@v4
with:
path: |
/opt/unisonlanguage
/usr/local/bin/ucm
key: ${{ runner.os }}-ucm-${{ matrix.ucm-release-version }}
- name: Install ucm
if: steps.restore-cached-ucm.outputs.cache-hit != 'true'
env:
UCM_RELEASE: ${{ matrix.ucm-release-version }}
run: ./install-ucm.sh
- name: Run tests transcript
env:
UNISON_BASE_VERSION: ${{ matrix.base-version }}
UCM_RELEASE: ${{ matrix.ucm-release-version }}
UNISON_DEBUG: timing
run: |
apt-get update && apt-get -y install gettext-base
cd tests
./run-tests.sh
- name: Cache ucm release
if: ${{ !cancelled() && steps.restore-cached-ucm.outputs.cache-hit != 'true' && startsWith(matrix.ucm-release-version, 'release') }}
id: save-ucm-to-cache
uses: actions/cache/save@v4
with:
path: |
/opt/unisonlanguage
/usr/local/bin/ucm
key: ${{ steps.restore-cached-ucm.outputs.cache-primary-key }}
20 changes: 20 additions & 0 deletions install-ucm.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env bash

set -euxo pipefail

release_file_name() {
case "$UCM_RELEASE" in
"release%2F0.5.23" | "release%2F0.5.27")
echo "ucm-linux.tar.gz"
;;
*)
echo "ucm-linux-x64.tar.gz"
;;
esac
}

mkdir -p /opt/unisonlanguage

curl --fail-with-body -L "https://github.com/unisonweb/unison/releases/download/${UCM_RELEASE}/$(release_file_name)" | tar -xz -C /opt/unisonlanguage

ln -s /opt/unisonlanguage/ucm /usr/local/bin/ucm
15 changes: 1 addition & 14 deletions tests/run-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,9 @@ TRANSCRIPT=pull-and-run-tests.md

envsubst < pull-and-run-tests.tpl.md > $TRANSCRIPT

release_file_name() {
case "$UCM_RELEASE" in
"release%2F0.5.23" | "release%2F0.5.27")
echo "ucm-linux.tar.gz"
;;
*)
echo "ucm-linux-x64.tar.gz"
;;
esac
}

curl --fail-with-body -L "https://github.com/unisonweb/unison/releases/download/${UCM_RELEASE}/$(release_file_name)" | tar -xz

exit_status=0

./ucm transcript "$TRANSCRIPT" || exit_status=$?
ucm transcript "$TRANSCRIPT" || exit_status=$?
cat pull-and-run-tests.output.md

exit "$exit_status"

0 comments on commit 82fa833

Please sign in to comment.