Skip to content

Commit

Permalink
improve ci workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
GrantBirki committed Aug 7, 2023
1 parent 6ceeae7 commit 91e9793
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 36 deletions.
16 changes: 6 additions & 10 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,20 @@ on:
- main
- 'releases/*'

permissions:
contents: read

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

# check the node version from the .node-version file
- name: fetch node version
id: node-version
run: |
version=$(cat .node-version)
echo "version=${version}" >> $GITHUB_OUTPUT
- name: setup node
uses: actions/setup-node@v3
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # pin@v3.6.0
with:
node-version: ${{ steps.node-version.outputs.version }}
cache: npm
node-version-file: .node-version
cache: 'npm'

- name: install dependencies
run: npm ci
Expand Down
24 changes: 10 additions & 14 deletions .github/workflows/package-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,33 +7,29 @@ on:
pull_request:
workflow_dispatch:

permissions:
contents: read

jobs:
package-check:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

# check the node version from the .node-version file
- name: fetch node version
id: node-version
run: |
version=$(cat .node-version)
echo "version=${version}" >> $GITHUB_OUTPUT
- name: setup node
uses: actions/setup-node@v3
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # pin@v3.6.0
with:
node-version: ${{ steps.node-version.outputs.version }}
cache: npm
node-version-file: .node-version
cache: 'npm'

- name: Install dependencies
- name: install dependencies
run: npm ci

- name: Rebuild the dist/ directory
- name: rebuild the dist/ directory
run: npm run bundle

- name: Compare the expected and actual dist/ directories
- name: compare the expected and actual dist/ directories
run: |
if [ "$(git diff --ignore-space-at-eol dist/ | wc -l)" -gt "0" ]; then
echo "Detected uncommitted changes after build. See status below:"
Expand All @@ -43,7 +39,7 @@ jobs:
id: diff

# If index.js was different than expected, upload the expected version as an artifact
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # pin@v3.1.2
if: ${{ failure() && steps.diff.conclusion == 'failure' }}
with:
name: dist
Expand Down
23 changes: 11 additions & 12 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,23 @@ on:
- main
- 'releases/*'

permissions:
contents: read

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

# check the node version from the .node-version file
- name: fetch node version
id: node-version
run: |
version=$(cat .node-version)
echo "version=${version}" >> $GITHUB_OUTPUT
- name: setup node
uses: actions/setup-node@v3
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # pin@v3.6.0
with:
node-version: ${{ steps.node-version.outputs.version }}
cache: npm
node-version-file: .node-version
cache: 'npm'

- name: install dependencies
run: npm ci

- run: npm ci
- run: npm run ci-test
- name: test
run: npm run ci-test

0 comments on commit 91e9793

Please sign in to comment.