Skip to content

Commit

Permalink
Merge 234aa46 into 9dbf966
Browse files Browse the repository at this point in the history
  • Loading branch information
Kesin11 authored Sep 20, 2023
2 parents 9dbf966 + 234aa46 commit 474a540
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 14 deletions.
14 changes: 14 additions & 0 deletions .github/actions/setup-deno-with-cache/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Setup Deno with cache
description: setup-deno with dependencies cache
runs:
using: "composite"
steps:
- uses: actions/cache@v3
with:
path: ~/.cache/deno
key: deno-${{ github.job }}-${{ runner.os }}-${{ hashFiles('deno.lock') }}
restore-keys: |
deno-${{ github.job }}-${{ runner.os }}-
- uses: denoland/setup-deno@v1
with:
deno-version: "v1.36.x"
33 changes: 19 additions & 14 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,16 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: denoland/setup-deno@v1
with:
deno-version: v1.36.x
- uses: ./.github/actions/setup-deno-with-cache
- id: fmt
run: deno fmt
run: deno fmt --check
- id: lint
run: deno lint
check-dist:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: denoland/setup-deno@v1
with:
deno-version: v1.36.x
- uses: ./.github/actions/setup-deno-with-cache
- name: Rebuild the dist/ directory
run: deno task bundle
- name: Compare the expected and actual dist/ directories
Expand All @@ -38,25 +34,35 @@ jobs:
git diff
exit 1
fi
# post processes
- name: Upload dist for post job
if: ${{ always() }}
uses: actions/upload-artifact@v3
with:
name: js_dist
path: |
dist/
action.yml
- name: Create dist/*.js size json
if: ${{ always() }}
run: |
find ./dist -type f -printf '%s %f\n' \
| jq -n -R '{name: "dist_size", key: "dist_size", metrics: [inputs | capture("(?<value>\\S+)\\s+(?<key>.+)") + {unit: "byte"} | .value |= tonumber | .name = .key ]}' \
> dist_js_sizes.json
cat dist_js_sizes.json
# octocov must needs some coverage files but this job don't exec test, so put dummy file.
- name: Create dummy coverage
if: ${{ always() }}
run: touch coverage.out
- uses: k1LoW/octocov-action@v0
if: ${{ always() }}
env:
OCTOCOV_CUSTOM_METRICS_DIST_JS: dist_js_sizes.json
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: denoland/setup-deno@v1
with:
deno-version: v1.36.x
- uses: ./.github/actions/setup-deno-with-cache
- id: test
run: deno test

Expand All @@ -65,10 +71,9 @@ jobs:
if: ${{ always() }}
needs: [ check, check-dist, test ]
steps:
- uses: actions/checkout@v4
- uses: denoland/setup-deno@v1
- name: Download bundled dist
uses: actions/download-artifact@v3
with:
deno-version: v1.36.x
- run: deno task bundle
name: js_dist
- name: Run self action
uses: ./
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ You can set `GITHUB_API_URL` environment variable to use this action with GHES.
```

# DEVELOPMENT

## Setup

```
deno task setup:githooks
```
Expand Down

0 comments on commit 474a540

Please sign in to comment.