-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b0773c6
commit a822139
Showing
4 changed files
with
123 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
name: Build and Release | ||
|
||
on: | ||
push: | ||
|
||
jobs: | ||
test: | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest, windows-latest, macos-13, macos-latest] | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: Set up Deno | ||
uses: denoland/setup-deno@v2 | ||
with: | ||
deno-version: v2.x | ||
- name: Run Tests | ||
run: deno -A test | ||
|
||
build: | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest, windows-latest, macos-13, macos-latest] | ||
runs-on: ${{ matrix.os }} | ||
needs: | ||
- test | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: Set up Deno | ||
uses: denoland/setup-deno@v2 | ||
with: | ||
deno-version: v2.x | ||
- name: Build | ||
run: deno task compile | ||
- name: Upload artifacts | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
path: builds/* | ||
|
||
release: | ||
runs-on: ubuntu-latest | ||
if: startsWith(github.ref, 'refs/tags/') | ||
needs: | ||
- build | ||
steps: | ||
- name: Create Release | ||
uses: softprops/action-gh-release@v2 | ||
with: | ||
files: build/* | ||
token: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import { describe, it, beforeAll } from "jsr:@std/testing/bdd"; | ||
import { assertEquals, assertRejects } from "jsr:@std/assert"; | ||
import { ensureDir } from "jsr:@std/fs"; | ||
|
||
import global, { NotInstalled, NoGlobalVersion } from "./global.ts"; | ||
|
||
describe("global", () => { | ||
describe("when an argument is passed", () => { | ||
describe("when DR version has been registered", () => { | ||
beforeAll(async () => { | ||
await ensureDir(`${Deno.env.get("HOME")}/.drenv/versions/1.0.0`); | ||
await Deno.writeTextFile(`${Deno.env.get("HOME")}/.drenv/versions/1.0.0/CHANGELOG-CURR.txt`, "* 1.0.0"); | ||
}) | ||
|
||
it("writes to the ~/.drenv/.dragonruby-version file", async () => { | ||
await global("1.0.0"); | ||
|
||
const result = await Deno.readTextFile(`${Deno.env.get("HOME")}/.drenv/.dragonruby-version`); | ||
|
||
assertEquals(result, "1.0.0"); | ||
}) | ||
}) | ||
}) | ||
|
||
describe("when an argument is not passed", () => { | ||
describe("when version has been set", () => { | ||
beforeAll(async () => { | ||
await Deno.writeTextFile(`${Deno.env.get("HOME")}/.drenv/.dragonruby-version`, "1.0.0"); | ||
}) | ||
|
||
it("returns the version from the ~/.drenv/.dragonruby-version file", async () => { | ||
const result = await global(); | ||
|
||
assertEquals(result, "1.0.0"); | ||
}) | ||
}) | ||
|
||
describe("when version has not been set", () => { | ||
beforeAll(async () => { | ||
await Deno.remove(`${Deno.env.get("HOME")}/.drenv/.dragonruby-version`); | ||
}) | ||
|
||
it("raises an error", async () => { | ||
assertRejects( | ||
async () => { | ||
await global(); | ||
}, | ||
NoGlobalVersion, | ||
"drenv: no global version configured" | ||
) | ||
}) | ||
}) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.