From cbd141fc809e46a43313e16d3fc738748ea048e2 Mon Sep 17 00:00:00 2001 From: Anton-4 <17049058+Anton-4@users.noreply.github.com> Date: Mon, 13 Oct 2025 19:37:37 +0200 Subject: [PATCH 1/2] add nightly support --- .github/workflows/test.yml | 5 ++++- README.md | 20 ++++++++++++++--- action.yml | 44 +++++++++++++++++++++++++++----------- 3 files changed, 53 insertions(+), 16 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7410252..59a3486 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -5,10 +5,11 @@ on: jobs: test: - name: Test on ${{ matrix.os }} ${{ matrix.arch }} + name: Test ${{ matrix.version }} on ${{ matrix.os }} ${{ matrix.arch }} runs-on: ${{ matrix.runner }} strategy: matrix: + version: [alpha4-rolling, nightly] include: - os: Linux arch: x86_64 @@ -29,6 +30,8 @@ jobs: - name: Setup Roc uses: ./ + with: + version: ${{ matrix.version }} - name: Check Roc version run: roc version diff --git a/README.md b/README.md index 50a1f47..52c9c5f 100644 --- a/README.md +++ b/README.md @@ -11,8 +11,20 @@ A GitHub Action to download and setup the Roc compiler for Linux and macOS. Add this step to your CI workflow: +### Using Nightly Releases + +```yaml +- uses: roc-lang/setup-roc@TODO + with: + version: nightly +``` + +### Using Major Releases + ```yaml -TODO +- uses: roc-lang/setup-roc@TODO + with: + version: alpha4-rolling ``` ## Platform Support @@ -30,10 +42,12 @@ This action supports the following platforms: 1. Detects your operating system and architecture 2. Downloads the appropriate Roc compiler release for your platform -3. Verifies the SHA256 checksum to ensure file integrity +3. Verifies the SHA256 checksum to ensure file integrity (skipped for nightly releases) 4. Extracts the compiler 5. Adds the Roc executable to the PATH ## Security -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. +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. + +For nightly releases, SHA256 verification is skipped since the files are updated regularly. diff --git a/action.yml b/action.yml index 1a6775e..ccdcb08 100644 --- a/action.yml +++ b/action.yml @@ -4,6 +4,11 @@ branding: icon: 'download' color: 'purple' +inputs: + version: + description: 'Version of Roc to install (e.g., "nightly", "alpha4-rolling")' + required: true + runs: using: 'composite' steps: @@ -12,6 +17,9 @@ runs: run: | set -euo pipefail + VERSION="${{ inputs.version }}" + echo "Installing Roc version: $VERSION" + # Detect OS and architecture OS=$(uname -s) ARCH=$(uname -m) @@ -68,23 +76,35 @@ runs: esac # Download Roc - DOWNLOAD_URL="https://github.com/roc-lang/roc/releases/download/alpha4-rolling/roc-${PLATFORM}-alpha4-rolling.tar.gz" + if [[ "$VERSION" == "nightly" ]]; then + DOWNLOAD_URL="https://github.com/roc-lang/roc/releases/download/nightly/roc_nightly-${PLATFORM}-latest.tar.gz" + SKIP_SHA_CHECK=true + DIR_PATTERN="roc_nightly-${PLATFORM}-*" + else + DOWNLOAD_URL="https://github.com/roc-lang/roc/releases/download/${VERSION}/roc-${PLATFORM}-${VERSION}.tar.gz" + SKIP_SHA_CHECK=false + fi + echo "Downloading Roc for $PLATFORM..." curl -fsSL -o roc.tar.gz "$DOWNLOAD_URL" - # Verify SHA256 checksum - echo "Verifying SHA256 checksum..." - ACTUAL_SHA=$($SHA_CMD roc.tar.gz | awk '{print $1}') + # Verify SHA256 checksum (skip for nightly releases) + if [[ "$SKIP_SHA_CHECK" == "false" ]]; then + echo "Verifying SHA256 checksum..." + ACTUAL_SHA=$($SHA_CMD roc.tar.gz | awk '{print $1}') - if [[ "$ACTUAL_SHA" != "$EXPECTED_SHA" ]]; then - echo "Error: SHA256 checksum mismatch!" - echo "Expected: $EXPECTED_SHA" - echo "Actual: $ACTUAL_SHA" - echo "This should never happen and could mean the file is malicious. Please make a post on and request investigation of this incident." - exit 1 - fi + if [[ "$ACTUAL_SHA" != "$EXPECTED_SHA" ]]; then + echo "Error: SHA256 checksum mismatch!" + echo "Expected: $EXPECTED_SHA" + echo "Actual: $ACTUAL_SHA" + echo "This should never happen and could mean the file is malicious. Please make a post on and request investigation of this incident." + exit 1 + fi - echo "SHA256 checksum verified successfully" + echo "SHA256 checksum verified successfully" + else + echo "Skipping SHA256 verification for nightly release" + fi # Extract Roc echo "Extracting Roc..." From 85cf13e696bd8ee01c1e0acc9794b114c5b90a0c Mon Sep 17 00:00:00 2001 From: Anton-4 <17049058+Anton-4@users.noreply.github.com> Date: Mon, 13 Oct 2025 19:56:54 +0200 Subject: [PATCH 2/2] fix matrix --- .github/workflows/test.yml | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 59a3486..29265df 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -9,20 +9,39 @@ jobs: runs-on: ${{ matrix.runner }} strategy: matrix: - version: [alpha4-rolling, nightly] include: - os: Linux arch: x86_64 runner: ubuntu-latest + version: alpha4-rolling + - os: Linux + arch: x86_64 + runner: ubuntu-latest + version: nightly + - os: Linux + arch: arm64 + runner: ubuntu-24.04-arm + version: alpha4-rolling - os: Linux arch: arm64 runner: ubuntu-24.04-arm + version: nightly - os: macOS arch: x86_64 runner: macos-15-intel + version: alpha4-rolling + - os: macOS + arch: x86_64 + runner: macos-15-intel + version: nightly + - os: macOS + arch: arm64 + runner: macos-latest + version: alpha4-rolling - os: macOS arch: arm64 runner: macos-latest + version: nightly steps: - name: Checkout repository