From 3de6542f11149cecd0fb6cadde39b76091455835 Mon Sep 17 00:00:00 2001 From: ERFANIUM Date: Sun, 10 Jul 2022 14:41:43 +0430 Subject: [PATCH] chore: add github workflows --- .github/workflows/ci.yml | 34 +++++++++++++++++++++++++ .github/workflows/udd.yml | 53 +++++++++++++++++++++++++++++++++++++++ test.ts | 3 +-- test_deps.ts | 2 ++ 4 files changed, 90 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/udd.yml create mode 100644 test_deps.ts diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..05b72b8 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,34 @@ +name: ci + +on: [push, pull_request] + +jobs: + build: + name: ubuntu-latest + runs-on: ubuntu-latest + timeout-minutes: 60 + + steps: + - name: Setup Environment + run: | + git config --global core.autocrlf false + git config --global core.eol lf + - name: Clone repository + uses: actions/checkout@v2 + + - name: Install Deno + uses: denoland/setup-deno@v1 + with: + deno-version: 1.x.x + + - name: Log versions + run: | + deno --version + # Lint & Format + - name: Lint & Format TS + run: | + deno lint + deno fmt --check + # Tests + - name: Test TS + run: deno test \ No newline at end of file diff --git a/.github/workflows/udd.yml b/.github/workflows/udd.yml new file mode 100644 index 0000000..9808e36 --- /dev/null +++ b/.github/workflows/udd.yml @@ -0,0 +1,53 @@ +name: udd-update-dependencies + +on: + workflow_dispatch: + schedule: + - cron: "42 9 * * *" + +jobs: + update-dependencies: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: denoland/setup-deno@v1 + with: + deno-version: 1.x.x + - name: Update dependencies + run: | + deno run -A https://deno.land/x/udd/main.ts deps.ts test_deps.ts + - name: Create Pull Request + uses: peter-evans/create-pull-request@v3 + id: pr + with: + commit-message: "Update dependencies" + title: Update dependencies + body: > + Dependencies updated by [udd](https://github.com/hayd/deno-udd). + branch: deno-dependency-updates + author: GitHub + delete-branch: true + - name: Retrieve commit sha + id: commit + run: | + echo "::set-output name=sha::$(git rev-parse HEAD)" + - name: Set commit status with pending + uses: Sibz/github-status-action@v1 + with: + authToken: ${{ secrets.GITHUB_TOKEN }} + context: "Basic tests" + state: "pending" + sha: ${{ steps.commit.outputs.sha }} + - name: Basic tests + id: test + continue-on-error: true + run: | + deno test --allow-read --allow-write + - name: Set commit status with outcome + uses: Sibz/github-status-action@v1 + with: + authToken: ${{ secrets.GITHUB_TOKEN }} + context: "Basic tests" + description: "To run other CI actions close/reopen this PR" + state: ${{ steps.test.outcome }} + sha: ${{ steps.commit.outputs.sha }} diff --git a/test.ts b/test.ts index 3487103..2c20051 100644 --- a/test.ts +++ b/test.ts @@ -1,7 +1,6 @@ // deno-lint-ignore-file require-await import { MongoClient, ObjectId } from "./mod.ts"; -import { deferred } from "https://deno.land/std@0.146.0/async/deferred.ts"; -import { assertEquals } from "https://deno.land/std@0.146.0/testing/asserts.ts"; +import { assertEquals, deferred } from "./test_deps.ts"; Deno.test("Sample Test", async () => { const fetchMock = deferred<{ url: string; init: RequestInit }>(); diff --git a/test_deps.ts b/test_deps.ts new file mode 100644 index 0000000..fed4a07 --- /dev/null +++ b/test_deps.ts @@ -0,0 +1,2 @@ +export { deferred } from "https://deno.land/std@0.146.0/async/deferred.ts"; +export { assertEquals } from "https://deno.land/std@0.146.0/testing/asserts.ts";