|
| 1 | +# setup-probitas |
| 2 | + |
| 3 | +Set up your GitHub Actions workflow with [Probitas](https://github.com/jsr-probitas/probitas), a scenario-based testing framework for Deno. |
| 4 | + |
| 5 | +## Usage |
| 6 | + |
| 7 | +### Basic Setup |
| 8 | + |
| 9 | +The simplest setup installs the latest stable Deno and Probitas versions: |
| 10 | + |
| 11 | +```yaml |
| 12 | +- uses: jsr-probitas/setup-probitas@v1 |
| 13 | +``` |
| 14 | +
|
| 15 | +### Full Example Workflow |
| 16 | +
|
| 17 | +```yaml |
| 18 | +name: Test |
| 19 | + |
| 20 | +on: |
| 21 | + push: |
| 22 | + branches: [main] |
| 23 | + pull_request: |
| 24 | + branches: [main] |
| 25 | + |
| 26 | +jobs: |
| 27 | + test: |
| 28 | + runs-on: ubuntu-latest |
| 29 | + steps: |
| 30 | + - uses: actions/checkout@v4 |
| 31 | + |
| 32 | + - uses: jsr-probitas/setup-probitas@v1 |
| 33 | + with: |
| 34 | + deno-version: stable |
| 35 | + probitas-version: latest |
| 36 | + cache: true |
| 37 | + |
| 38 | + - name: Run Probitas tests |
| 39 | + run: probitas run |
| 40 | +``` |
| 41 | +
|
| 42 | +## Inputs |
| 43 | +
|
| 44 | +| Input | Description | Default | |
| 45 | +|-------|-------------|---------| |
| 46 | +| `deno-version` | The Deno version to install. Can be a semver version, `stable`, `lts`, `rc`, or `canary`. | `stable` | |
| 47 | +| `probitas-version` | The Probitas version to install from JSR. Can be a semver version or `latest`. | `latest` | |
| 48 | +| `cache` | Cache downloaded modules & packages automatically in GitHub Actions cache. | `true` | |
| 49 | +| `cache-hash` | A hash used as part of the cache key, which defaults to a hash of the deno.lock files. | - | |
| 50 | + |
| 51 | +## Outputs |
| 52 | + |
| 53 | +| Output | Description | |
| 54 | +|--------|-------------| |
| 55 | +| `cache-hit` | A boolean indicating whether the cache was hit. | |
| 56 | +| `deno-version` | The Deno version that was installed. | |
| 57 | +| `probitas-version` | The Probitas version that was installed. | |
| 58 | + |
| 59 | +## Examples |
| 60 | + |
| 61 | +### Specify Versions |
| 62 | + |
| 63 | +```yaml |
| 64 | +- uses: jsr-probitas/setup-probitas@v1 |
| 65 | + with: |
| 66 | + deno-version: "2.1.0" |
| 67 | + probitas-version: "0.1.0" |
| 68 | +``` |
| 69 | + |
| 70 | +### Use LTS Deno |
| 71 | + |
| 72 | +```yaml |
| 73 | +- uses: jsr-probitas/setup-probitas@v1 |
| 74 | + with: |
| 75 | + deno-version: lts |
| 76 | +``` |
| 77 | + |
| 78 | +### Disable Cache |
| 79 | + |
| 80 | +```yaml |
| 81 | +- uses: jsr-probitas/setup-probitas@v1 |
| 82 | + with: |
| 83 | + cache: false |
| 84 | +``` |
| 85 | + |
| 86 | +### Custom Cache Key |
| 87 | + |
| 88 | +```yaml |
| 89 | +- uses: jsr-probitas/setup-probitas@v1 |
| 90 | + with: |
| 91 | + cache-hash: ${{ hashFiles('**/deno.json', '**/deno.lock') }} |
| 92 | +``` |
| 93 | + |
| 94 | +### Matrix Testing |
| 95 | + |
| 96 | +Test across multiple Deno versions: |
| 97 | + |
| 98 | +```yaml |
| 99 | +jobs: |
| 100 | + test: |
| 101 | + runs-on: ubuntu-latest |
| 102 | + strategy: |
| 103 | + matrix: |
| 104 | + deno-version: [stable, lts, "2.0.0"] |
| 105 | + steps: |
| 106 | + - uses: actions/checkout@v4 |
| 107 | +
|
| 108 | + - uses: jsr-probitas/setup-probitas@v1 |
| 109 | + with: |
| 110 | + deno-version: ${{ matrix.deno-version }} |
| 111 | +
|
| 112 | + - run: probitas run |
| 113 | +``` |
| 114 | + |
| 115 | +### Run with Selectors and Tags |
| 116 | + |
| 117 | +```yaml |
| 118 | +- uses: jsr-probitas/setup-probitas@v1 |
| 119 | +
|
| 120 | +- name: Run integration tests |
| 121 | + run: probitas run -s tag:integration |
| 122 | +
|
| 123 | +- name: Run with custom reporter |
| 124 | + run: probitas run --reporter json > results.json |
| 125 | +``` |
| 126 | + |
| 127 | +### Multiple Operating Systems |
| 128 | + |
| 129 | +```yaml |
| 130 | +jobs: |
| 131 | + test: |
| 132 | + strategy: |
| 133 | + matrix: |
| 134 | + os: [ubuntu-latest, macos-latest, windows-latest] |
| 135 | + runs-on: ${{ matrix.os }} |
| 136 | + steps: |
| 137 | + - uses: actions/checkout@v4 |
| 138 | + - uses: jsr-probitas/setup-probitas@v1 |
| 139 | + - run: probitas run |
| 140 | +``` |
| 141 | + |
| 142 | +## How It Works |
| 143 | + |
| 144 | +This action performs the following steps: |
| 145 | + |
| 146 | +1. **Setup Deno**: Uses [denoland/setup-deno](https://github.com/denoland/setup-deno) to install Deno with the specified version and cache configuration |
| 147 | +2. **Install Probitas CLI**: Installs the Probitas CLI from JSR using `deno install` |
| 148 | +3. **Verify Installation**: Confirms both Deno and Probitas are correctly installed and available in the PATH |
| 149 | + |
| 150 | +## Caching |
| 151 | + |
| 152 | +Caching is enabled by default and helps speed up your workflows by: |
| 153 | + |
| 154 | +- Caching Deno's compiled module cache |
| 155 | +- Caching downloaded dependencies based on your `deno.lock` file |
| 156 | +- Reducing network requests and installation time |
| 157 | + |
| 158 | +The cache key is automatically generated based on: |
| 159 | +- The GitHub job ID |
| 160 | +- The runner OS and architecture |
| 161 | +- A hash of `deno.lock` files in your project (customizable via `cache-hash`) |
| 162 | + |
| 163 | +## Related Projects |
| 164 | + |
| 165 | +- [Probitas](https://github.com/jsr-probitas/probitas) - The main Probitas framework |
| 166 | +- [setup-deno](https://github.com/denoland/setup-deno) - Deno setup action (used internally) |
| 167 | + |
| 168 | +## License |
| 169 | + |
| 170 | +See [LICENSE](LICENSE) file for details. |
0 commit comments