Skip to content

Commit cbd141f

Browse files
committed
add nightly support
1 parent 68881a7 commit cbd141f

3 files changed

Lines changed: 53 additions & 16 deletions

File tree

.github/workflows/test.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,11 @@ on:
55

66
jobs:
77
test:
8-
name: Test on ${{ matrix.os }} ${{ matrix.arch }}
8+
name: Test ${{ matrix.version }} on ${{ matrix.os }} ${{ matrix.arch }}
99
runs-on: ${{ matrix.runner }}
1010
strategy:
1111
matrix:
12+
version: [alpha4-rolling, nightly]
1213
include:
1314
- os: Linux
1415
arch: x86_64
@@ -29,6 +30,8 @@ jobs:
2930

3031
- name: Setup Roc
3132
uses: ./
33+
with:
34+
version: ${{ matrix.version }}
3235

3336
- name: Check Roc version
3437
run: roc version

README.md

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,20 @@ A GitHub Action to download and setup the Roc compiler for Linux and macOS.
1111

1212
Add this step to your CI workflow:
1313

14+
### Using Nightly Releases
15+
16+
```yaml
17+
- uses: roc-lang/setup-roc@TODO
18+
with:
19+
version: nightly
20+
```
21+
22+
### Using Major Releases
23+
1424
```yaml
15-
TODO
25+
- uses: roc-lang/setup-roc@TODO
26+
with:
27+
version: alpha4-rolling
1628
```
1729
1830
## Platform Support
@@ -30,10 +42,12 @@ This action supports the following platforms:
3042
3143
1. Detects your operating system and architecture
3244
2. Downloads the appropriate Roc compiler release for your platform
33-
3. Verifies the SHA256 checksum to ensure file integrity
45+
3. Verifies the SHA256 checksum to ensure file integrity (skipped for nightly releases)
3446
4. Extracts the compiler
3547
5. Adds the Roc executable to the PATH
3648
3749
## Security
3850
39-
The action verifies the SHA256 checksum of the downloaded file to ensure it hasn't been tampered with. If the checksum doesn't match, the action will fail.
51+
For major releases, the action verifies the SHA256 checksum of the downloaded file to ensure it hasn't been tampered with. If the checksum doesn't match, the action will fail.
52+
53+
For nightly releases, SHA256 verification is skipped since the files are updated regularly.

action.yml

Lines changed: 32 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ branding:
44
icon: 'download'
55
color: 'purple'
66

7+
inputs:
8+
version:
9+
description: 'Version of Roc to install (e.g., "nightly", "alpha4-rolling")'
10+
required: true
11+
712
runs:
813
using: 'composite'
914
steps:
@@ -12,6 +17,9 @@ runs:
1217
run: |
1318
set -euo pipefail
1419
20+
VERSION="${{ inputs.version }}"
21+
echo "Installing Roc version: $VERSION"
22+
1523
# Detect OS and architecture
1624
OS=$(uname -s)
1725
ARCH=$(uname -m)
@@ -68,23 +76,35 @@ runs:
6876
esac
6977
7078
# Download Roc
71-
DOWNLOAD_URL="https://github.com/roc-lang/roc/releases/download/alpha4-rolling/roc-${PLATFORM}-alpha4-rolling.tar.gz"
79+
if [[ "$VERSION" == "nightly" ]]; then
80+
DOWNLOAD_URL="https://github.com/roc-lang/roc/releases/download/nightly/roc_nightly-${PLATFORM}-latest.tar.gz"
81+
SKIP_SHA_CHECK=true
82+
DIR_PATTERN="roc_nightly-${PLATFORM}-*"
83+
else
84+
DOWNLOAD_URL="https://github.com/roc-lang/roc/releases/download/${VERSION}/roc-${PLATFORM}-${VERSION}.tar.gz"
85+
SKIP_SHA_CHECK=false
86+
fi
87+
7288
echo "Downloading Roc for $PLATFORM..."
7389
curl -fsSL -o roc.tar.gz "$DOWNLOAD_URL"
7490
75-
# Verify SHA256 checksum
76-
echo "Verifying SHA256 checksum..."
77-
ACTUAL_SHA=$($SHA_CMD roc.tar.gz | awk '{print $1}')
91+
# Verify SHA256 checksum (skip for nightly releases)
92+
if [[ "$SKIP_SHA_CHECK" == "false" ]]; then
93+
echo "Verifying SHA256 checksum..."
94+
ACTUAL_SHA=$($SHA_CMD roc.tar.gz | awk '{print $1}')
7895
79-
if [[ "$ACTUAL_SHA" != "$EXPECTED_SHA" ]]; then
80-
echo "Error: SHA256 checksum mismatch!"
81-
echo "Expected: $EXPECTED_SHA"
82-
echo "Actual: $ACTUAL_SHA"
83-
echo "This should never happen and could mean the file is malicious. Please make a post on <https://roc.zulipchat.com> and request investigation of this incident."
84-
exit 1
85-
fi
96+
if [[ "$ACTUAL_SHA" != "$EXPECTED_SHA" ]]; then
97+
echo "Error: SHA256 checksum mismatch!"
98+
echo "Expected: $EXPECTED_SHA"
99+
echo "Actual: $ACTUAL_SHA"
100+
echo "This should never happen and could mean the file is malicious. Please make a post on <https://roc.zulipchat.com> and request investigation of this incident."
101+
exit 1
102+
fi
86103
87-
echo "SHA256 checksum verified successfully"
104+
echo "SHA256 checksum verified successfully"
105+
else
106+
echo "Skipping SHA256 verification for nightly release"
107+
fi
88108
89109
# Extract Roc
90110
echo "Extracting Roc..."

0 commit comments

Comments
 (0)