Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update pre-submits #289

Merged
merged 1 commit into from
Oct 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 13 additions & 15 deletions .github/workflows/pre-submit.actions.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,26 @@
name: Actions pre submits
on: [pull_request, workflow_dispatch]

on:
pull_request:
branches: [main]
workflow_dispatch:

permissions: read-all

jobs:
action-presubmit:
check-dist:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3.0.2
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3.0.2

- name: Setup Node.js 16
uses: actions/setup-node@969bd2663942d722d85b6a8626225850c2f7be4b # tag=v3.5.0
- name: Set Node.js 16
uses: actions/setup-node@2fddd8803e2f5c9604345a0b591c3020ee971a93 # tag=v3.4.1
with:
node-version: 16

- name: Install dependencies
working-directory: actions/installer
run: npm ci

- name: Run build and tests
- name: Rebuild the dist/ directory
working-directory: actions/installer
run: npm run all
run: make package

- name: Compare the expected and actual dist/ directories
working-directory: actions/installer
Expand All @@ -34,10 +33,9 @@ jobs:
exit 1
fi

# If there are uncommited changes in dist/, upload the directory
- name: Upload dist/
# If index.js was different from expected, upload the expected version as an artifact
- uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8
if: ${{ failure() && steps.diff.conclusion == 'failure' }}
uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # tag=v3.1.0
with:
name: dist
path: dist/
18 changes: 18 additions & 0 deletions .github/workflows/pre-submit.lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Lint

on: [pull_request]

permissions:
# Needed to check out the repo.
contents: read

jobs:
eslint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3.0.2
- uses: actions/setup-node@v3
with:
node-version: 16
- working-directory: actions/installer
run: make lint
41 changes: 41 additions & 0 deletions actions/installer/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
SHELL := /bin/bash
OUTPUT_FORMAT = $(shell if [ "${GITHUB_ACTIONS}" == "true" ]; then echo "github"; else echo ""; fi)

.PHONY: help
help: ## Shows all targets and help from the Makefile (this message).
@echo "installer Makefile"
@echo "Usage: make [COMMAND]"
@echo ""
@grep --no-filename -E '^([/a-z.A-Z0-9_%-]+:.*?|)##' $(MAKEFILE_LIST) | \
awk 'BEGIN {FS = "(:.*?|)## ?"}; { \
if (length($$1) > 0) { \
printf " \033[36m%-20s\033[0m %s\n", $$1, $$2; \
} else { \
if (length($$2) > 0) { \
printf "%s\n", $$2; \
} \
} \
}'

node_modules/.installed: package.json package-lock.json
npm ci
touch node_modules/.installed

.PHONY: action
action: node_modules/.installed ## Builds the action.
npm run build

.PHONY: package
package: node_modules/.installed ## Builds the distribution package.
npm run all

.PHONY: clean
clean:
rm -rf dist lib node_modules

## Testing
#####################################################################

.PHONY: lint
lint: node_modules/.installed ## Runs eslint.
npm run lint