Skip to content

Commit 2ffde51

Browse files
authored
DT-6: Config deno.json and create workflow
feat(workflows): Add github action workflows for linting , formatting and compliance
1 parent 1155c48 commit 2ffde51

File tree

2 files changed

+104
-0
lines changed

2 files changed

+104
-0
lines changed
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# Workflow for DevTools Compliance
2+
3+
name: DevTools Compliance
4+
5+
on:
6+
pull_request:
7+
types:
8+
[
9+
opened,
10+
edited,
11+
synchronize,
12+
reopened,
13+
labeled,
14+
unlabeled,
15+
assigned,
16+
unassigned,
17+
]
18+
19+
jobs:
20+
check-compliance:
21+
name: Check DevTools Compliance
22+
runs-on: ubuntu-latest
23+
24+
steps:
25+
- name: Checkout repository
26+
uses: actions/checkout@v4
27+
with:
28+
fetch-depth: 0
29+
30+
- name: Show PR Labels and Assignees
31+
run: |
32+
echo "PR Labels: ${{ toJson(github.event.pull_request.labels) }}"
33+
echo "PR Assignees: ${{ toJson(github.event.pull_request.assignees) }}"
34+
35+
- name: Verify PR Assignee
36+
run: |
37+
if [ "${{ toJson(github.event.pull_request.assignees) }}" == "[]" ]; then
38+
echo "👮 This PR does not have any assignees. Please assign at least one assignee."
39+
exit 1
40+
fi
41+
42+
- name: Verify PR Label
43+
run: |
44+
if [ "${{ toJson(github.event.pull_request.labels) }}" == "[]" ]; then
45+
echo "👮 This PR does not have any labels. Please assign at least one label."
46+
exit 1
47+
fi
48+
continue-on-error: true
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# Workflow for DevTools CI/CD
2+
# This workflow runs linting and formatting checks on pull requests.
3+
# It ensures that the code adheres to style guidelines and is free of linting errors.
4+
5+
name: DevTools CI/CD
6+
7+
on:
8+
pull_request:
9+
types: [opened, reopened, synchronize]
10+
11+
jobs:
12+
lint-and-format:
13+
name: Lint and Format Check
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Checkout repository
18+
uses: actions/checkout@v4
19+
with:
20+
fetch-depth: 0
21+
22+
- name: Setup Deno
23+
uses: denoland/setup-deno@v2
24+
with:
25+
deno-version: v2.x
26+
27+
- name: Cache Deno dependencies
28+
uses: actions/cache@v4
29+
with:
30+
path: |
31+
~/.deno
32+
~/node_modules
33+
~/.cache/deno
34+
35+
key: ${{ runner.os }}-deno-v2-${{ hashFiles('deno.json') }}
36+
37+
- name: 🔍 Get all changed files
38+
id: changed-file-list
39+
run: |
40+
echo "changed_files=$(git diff --name-only --diff-filter=ACMRT --merge-base origin/master | xargs)" >> $GITHUB_OUTPUT
41+
42+
- name: Run linter
43+
if: steps.changed-file-list.outputs.changed_files != ''
44+
run: deno task lint --permit-no-files --compact ${{ steps.changed-file-list.outputs.changed_files }}
45+
46+
- name: Run formatter
47+
if: steps.changed-file-list.outputs.changed_files != ''
48+
run: deno task fmt --permit-no-files --check ${{ steps.changed-file-list.outputs.changed_files }}
49+
50+
- name: Run check
51+
if: steps.changed-file-list.outputs.changed_files != ''
52+
run: deno check --allow-import
53+
54+
- name: Run tests
55+
if: steps.changed-file-list.outputs.changed_files != ''
56+
run: deno test -A --no-check --env-file=.env-dev

0 commit comments

Comments
 (0)