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
a0b0c0d
commit ab86262
Showing
8 changed files
with
123 additions
and
0 deletions.
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,88 @@ | ||
name: Deno | ||
|
||
on: | ||
push: | ||
create: | ||
pull_request: | ||
workflow_dispatch: | ||
schedule: | ||
- cron: '44 4 * * 0' | ||
|
||
jobs: | ||
deno: | ||
name: Deno | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: cache deno installation and deno.land dependencies | ||
uses: actions/cache@v2 | ||
with: | ||
key: ${{ runner.os }}-deno-${{ hashFiles('**/*') }} | ||
restore-keys: ${{ runner.os }}-deno- | ||
path: | | ||
/home/runner/.deno | ||
/home/runner/.cache/deno/deps/https/deno.land | ||
- name: install or update deno installation | ||
run: | | ||
export DENO_INSTALL="/home/runner/.deno" | ||
export PATH="${DENO_INSTALL}/bin:${PATH}" | ||
mkdir -p "${DENO_INSTALL}" | ||
deno upgrade || ( | ||
curl -fsSL https://deno.land/x/install/install.sh > "${DENO_INSTALL}/.sh"; | ||
sh "${DENO_INSTALL}/.sh" | ||
) | ||
deno --version | ||
deno info | ||
echo "DENO_INSTALL=${DENO_INSTALL}" >> "${GITHUB_ENV}" | ||
echo "PATH=${PATH}" >> "${GITHUB_ENV}" | ||
- name: build | ||
id: build | ||
run: | | ||
deno fmt | ||
git status | ||
declare had_changes="$( | ||
[[ -n "$(git status --porcelain)" ]] && echo true || echo false | ||
)" | ||
echo "::set-output name=had-changes::${had_changes}" | ||
- run: deno test | ||
|
||
- name: commit and push generated changes | ||
if: success() && steps.build.outputs.had-changes == 'true' && (github.event_name == 'push' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch') | ||
run: | | ||
declare br=" | ||
" | ||
declare branch="$(echo ${GITHUB_REF#refs/heads/})" | ||
declare date="$(git log -1 --pretty=format:'%ad')" | ||
declare short_hash="$(git rev-parse --short=8 HEAD)" | ||
declare short_subject="$(git log -1 --pretty=format:'%s')" | ||
declare short_subject="$(git log -1 --pretty=format:'%s')" | ||
if [[ ${#short_subject} -gt 50 ]]; then | ||
short_subject="${short_subject:0:49}…" | ||
fi | ||
declare author_name="$(git log -1 --pretty=format:'%an')" | ||
declare author_email="$(git log -1 --pretty=format:'%ae')" | ||
declare current_action_url="https://github.com/${GITHUB_REPOSITORY}/actions/runs/${{ github.run_id }}" | ||
export GIT_AUTHOR_DATE="${date}" | ||
export GIT_AUTHOR_NAME="${author_name}" | ||
export GIT_AUTHOR_EMAIL="${author_email}" | ||
export GIT_COMMITTER_DATE="${date}" | ||
export GIT_COMMITTER_NAME="github-actions" | ||
export GIT_COMMITTER_EMAIL="41898282+github-actions[bot]@users.noreply.github.com" | ||
git remote rm origin | ||
git remote add origin "https://${GITHUB_ACTOR}:${{ secrets.GITHUB_TOKEN }}@github.com/${GITHUB_REPOSITORY}.git" | ||
git checkout "${branch}" | ||
git add . | ||
git commit -m "⚙️ rebuild ${short_hash} (${short_subject})${br}${br}${current_action_url}" | ||
git push --set-upstream origin "${branch}" | ||
- name: fail if source files modified during build but this action cannot push | ||
if: success() && steps.build.outputs.had-changes == 'true' && !(github.event_name == 'push' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch') | ||
run: | | ||
echo "source files modified during build but this action cannot push" | ||
git status | ||
exit 1 |
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,3 @@ | ||
{ | ||
"deno.enable": true | ||
} |
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,5 @@ | ||
# x/database | ||
|
||
|
||
|
||
|
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 @@ | ||
export * as sql from "./sql/mod.ts"; |
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,5 @@ | ||
# x/database/sql | ||
|
||
`x/database/sql` provides an abstract interface for SQL databases in Deno, | ||
inspired by | ||
[Go's standard `database/sql` package](https://pkg.go.dev/database/sql). |
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 @@ | ||
export {} |
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,10 @@ | ||
import { assert } from "https://deno.land/std@0.87.0/testing/asserts.ts"; | ||
|
||
import * as sql from "./mod.ts"; | ||
|
||
Deno.test({ | ||
name: "import * from x/database/sql/mod.ts", | ||
fn() { | ||
assert(sql); | ||
}, | ||
}); |
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,10 @@ | ||
import { assert } from "https://deno.land/std@0.87.0/testing/asserts.ts"; | ||
|
||
import * as database from "./mod.ts"; | ||
|
||
Deno.test({ | ||
name: "import * from x/database/mod.ts", | ||
fn() { | ||
assert(database); | ||
}, | ||
}); |