mirror of
https://github.com/slsa-framework/slsa-verifier.git
synced 2026-08-26 09:37:19 +00:00
Update pre-submits (#289)
Signed-off-by: Ian Lewis <ianlewis@google.com> Signed-off-by: Ian Lewis <ianlewis@google.com>
This commit is contained in:
@@ -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
|
||||
- name: Rebuild the dist/ directory
|
||||
working-directory: actions/installer
|
||||
run: npm ci
|
||||
|
||||
- name: Run build and tests
|
||||
working-directory: actions/installer
|
||||
run: npm run all
|
||||
run: make package
|
||||
|
||||
- name: Compare the expected and actual dist/ directories
|
||||
working-directory: actions/installer
|
||||
@@ -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/
|
||||
|
||||
@@ -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
|
||||
@@ -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
|
||||
Reference in New Issue
Block a user