Skip to content

Commit

Permalink
Merge pull request #2 from unisoncomputing/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 b151b2b + e050cd6 commit c3961e9
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 17 deletions.
29 changes: 27 additions & 2 deletions .github/workflows/cloud-client-tests.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
on:
pull_request:
push:
branches:
- main
workflow_dispatch:
schedule:
- cron: '46 * * * *'

jobs:
cloud-client-tests:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
strategy:
fail-fast: false
max-parallel: 1
Expand All @@ -20,10 +24,22 @@ 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
env:
CLOUD_CLIENT_VERSION: ${{ matrix.cloud-client-version }}
UCM_RELEASE: ${{ matrix.ucm-release-version }}
UNISON_CLOUD_ACCESS_TOKEN: ${{ secrets.CLOUD_USER_ACCESS_TOKEN }}
UNISON_DEBUG: timing
run: |
Expand All @@ -49,3 +65,12 @@ jobs:
}
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
- 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.25" | "release%2F0.5.26" | "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
17 changes: 2 additions & 15 deletions run-tests.sh
Original file line number Diff line number Diff line change
@@ -1,25 +1,12 @@
#!/bin/bash
#!/usr/bin/env bash

set -euxo pipefail

release_file_name() {
case "$UCM_RELEASE" in
"release%2F0.5.25" | "release%2F0.5.26" | "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

envsubst < cloud-tests.tpl.md > cloud-tests.md

exit_status=0

./ucm transcript cloud-tests.md || exit_status=$?
ucm transcript cloud-tests.md || exit_status=$?
cat cloud-tests.output.md

exit "$exit_status"

0 comments on commit c3961e9

Please sign in to comment.