Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 59 additions & 1 deletion .dev/README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,60 @@

This directory is used for local testing. Nothing to see here.
# Development

Local development helpers for the `setup-elide` action.

## Prerequisites

- [Bun](https://bun.sh) (latest)
- [Node.js](https://nodejs.org) 24+
- [Docker](https://docs.docker.com/get-docker/) (for `test:docker`)

## Quick Reference

```bash
bun install # install dependencies
bun run build # format + bundle (dist/index.js + dist/post.js)
bun run test # run all unit tests (sequenced batches)
bun run test:ci # same as test, but produces JUnit XML + merged lcov
bun run test:docker # build + test in Docker container
bun run lint # oxlint
bun run format:check # biome format check
bun run format:write # biome format + write
bun run all # format + build + test
```

## Directory Layout

| Path | Purpose |
|---|---|
| `.dev/test-env.ts` | Preloaded by bun test to set `RUNNER_TEMP`, `RUNNER_TOOL_CACHE`, `ELIDE_HOME` |
| `.dev/tmp/` | Temp files created during test runs |
| `.dev/target/` | Simulated `ELIDE_HOME` for tests |
| `.dev/tool-cache/` | Simulated tool cache for tests |

## Test Batching

Tests run in sequenced batches because `bun:test`'s `mock.module()` creates
process-wide module replacements. Test files that mock the same module differently
must run in separate `bun test` invocations. The `test` script in `package.json`
handles this automatically.

## Architecture

See the [main README](../README.md) for user-facing documentation. Key source files:

| File | Role |
|---|---|
| `src/index.ts` | Entry point (calls `run()`) |
| `src/post.ts` | Post-step entry point (flushes telemetry) |
| `src/main.ts` | Orchestrator: option parsing, installer routing, outputs, summary |
| `src/options.ts` | Option types, defaults, normalization, validation, input parsing |
| `src/releases.ts` | CDN URL building, archive download/extract, tool cache, GitHub API |
| `src/command.ts` | Elide CLI interaction (`elide info`, `elide --version`) |
| `src/platform.ts` | Platform detection (`isDebianLike`, `isRpmBased`) |
| `src/telemetry.ts` | Sentry init/report/flush with aggressive scrubbing |
| `src/install-apt.ts` | apt installer |
| `src/install-shell.ts` | bash/PowerShell install script runner |
| `src/install-msi.ts` | Windows MSI installer |
| `src/install-pkg.ts` | macOS PKG installer |
| `src/install-rpm.ts` | Linux RPM installer |
35 changes: 26 additions & 9 deletions .github/codecov.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,31 @@
codecov:
require_ci_to_pass: yes
max_report_age: off
require_ci_to_pass: true
notify:
wait_for_ci: true

ignore:
- "__tests__"
- "dist"
- "node_modules"
coverage:
precision: 2
round: down
range: "80...100"
status:
project:
default:
informational: true
patch: off

comment: # this is a top-level key
layout: "diff, flags, files"
comment:
layout: "reach,diff,flags,files,footer"
behavior: default
require_changes: false
require_base: false
require_head: true

parsers:
javascript:
enable_partials: yes

github_checks:
annotations: true

bundle_analysis:
require_bundle_changes: "bundle_increase"
bundle_change_threshold: "1Kb"
87 changes: 77 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,37 @@ jobs:

- name: Test
id: test
run: bun run test
run: bun run test:ci

- name: "Report: Coverage"
- name: "Upload: Test Results"
if: ${{ !cancelled() && hashFiles('test-results/**') != '' }}
uses: codecov/codecov-action@57e3a136b779b570ffcdbf80b3bdc90e7fab3de2 # v6.0.0
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
token: ${{ secrets.CODECOV_TOKEN }}
report_type: test_results
files: test-results/batch1.xml,test-results/batch2.xml,test-results/batch3.xml,test-results/batch4.xml,test-results/batch5.xml,test-results/batch6.xml
fail_ci_if_error: false

- name: "Upload: Coverage"
if: ${{ !cancelled() && hashFiles('coverage/**') != '' }}
uses: codecov/codecov-action@57e3a136b779b570ffcdbf80b3bdc90e7fab3de2 # v6.0.0
with:
token: ${{ secrets.CODECOV_TOKEN }}
directory: ./coverage
files: coverage/lcov.info
fail_ci_if_error: false

- name: Build
run: bun run build

- name: "Upload: Bundle Analysis"
if: ${{ !cancelled() }}
run: |
bun x @codecov/bundle-analyzer ./dist \
--bundle-name=setup-elide \
--upload-token=${{ secrets.CODECOV_TOKEN }} \
--config-file=codecov-bundle.json
continue-on-error: true

test-action:
name: "Test: ${{ matrix.name }}"
Expand All @@ -62,16 +87,55 @@ jobs:
fail-fast: false
matrix:
include:
- name: linux-amd64
# --- Linux AMD64 ---
- name: linux-amd64 (archive)
runner: ubuntu-latest
installer: archive
- name: linux-amd64 (shell)
runner: ubuntu-latest
- name: linux-arm64
installer: shell
- name: linux-amd64 (apt)
runner: ubuntu-latest
installer: apt
# - name: linux-amd64 (rpm)
# runner: ubuntu-latest
# installer: rpm

# --- Linux ARM64 ---
- name: linux-arm64 (archive)
runner: ubuntu-24.04-arm
- name: macos-arm64
installer: archive
- name: linux-arm64 (shell)
runner: ubuntu-24.04-arm
installer: shell

# --- macOS ARM64 ---
- name: macos-arm64 (archive)
runner: macos-latest
- name: macos-amd64
installer: archive
- name: macos-arm64 (shell)
runner: macos-latest
installer: shell
# - name: macos-arm64 (pkg)
# runner: macos-latest
# installer: pkg

# --- macOS AMD64 ---
- name: macos-amd64 (archive)
runner: macos-15-intel
- name: windows-amd64
installer: archive

# --- Windows AMD64 ---
- name: windows-amd64 (archive)
runner: windows-latest
installer: archive
# - name: windows-amd64 (shell)
# runner: windows-latest
# installer: shell
# MSI: suppressed until installer is verified
# - name: windows-amd64 (msi)
# runner: windows-latest
# installer: msi

steps:
- name: Harden Runner
Expand All @@ -86,11 +150,14 @@ jobs:
- name: "Test: Local Action"
id: test-action
uses: ./
with: {}
with:
installer: ${{ matrix.installer }}

- name: "Test: Verify Installation"
shell: bash
run: |
elide --version
echo "Path: ${{ steps.test-action.outputs.path }}"
echo "Version: ${{ steps.test-action.outputs.version }}"
echo "Cached: ${{ steps.test-action.outputs.cached }}"
echo "Installer: ${{ steps.test-action.outputs.installer }}"
14 changes: 14 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,18 @@ jobs:
- name: "Build: Bundle"
run: bun run build

- name: "Sentry: Upload Source Maps"
if: env.SENTRY_AUTH_TOKEN != ''
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: elide-dev
SENTRY_PROJECT: setup-elide
run: |
npx @sentry/cli releases new "setup-elide@${GITHUB_REF_NAME#v}"
npx @sentry/cli releases files "setup-elide@${GITHUB_REF_NAME#v}" upload-sourcemaps dist/ --ext js --ext map
npx @sentry/cli releases finalize "setup-elide@${GITHUB_REF_NAME#v}"
npx @sentry/cli releases deploys "setup-elide@${GITHUB_REF_NAME#v}" new -e production

- name: "Build: Package Artifact"
run: |
TAG="${GITHUB_REF_NAME}"
Expand All @@ -54,6 +66,8 @@ jobs:
action.yml \
dist/index.js \
dist/index.js.map \
dist/post.js \
dist/post.js.map \
package.json \
.github/LICENSE
sha256sum "artifacts/setup-elide-${TAG}.tar.gz" > "artifacts/setup-elide-${TAG}.tar.gz.sha256"
Expand Down
Loading
Loading