Skip to content

Commit

Permalink
chore: add github workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
erfanium committed Jul 10, 2022
1 parent 1dc6b7e commit 3de6542
Show file tree
Hide file tree
Showing 4 changed files with 90 additions and 2 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -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
53 changes: 53 additions & 0 deletions .github/workflows/udd.yml
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>
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 }}
3 changes: 1 addition & 2 deletions test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// deno-lint-ignore-file require-await
import { MongoClient, ObjectId } from "./mod.ts";
import { deferred } from "https://deno.land/[email protected]/async/deferred.ts";
import { assertEquals } from "https://deno.land/[email protected]/testing/asserts.ts";
import { assertEquals, deferred } from "./test_deps.ts";

Deno.test("Sample Test", async () => {
const fetchMock = deferred<{ url: string; init: RequestInit }>();
Expand Down
2 changes: 2 additions & 0 deletions test_deps.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { deferred } from "https://deno.land/[email protected]/async/deferred.ts";
export { assertEquals } from "https://deno.land/[email protected]/testing/asserts.ts";

0 comments on commit 3de6542

Please sign in to comment.