Skip to content

Commit

Permalink
feat: add v1 version of action (#2)
Browse files Browse the repository at this point in the history
Co-authored-by: Lorna Jane Mitchell <[email protected]>
Co-authored-by: Roman Sainchuk <[email protected]>
  • Loading branch information
3 people authored May 17, 2024
1 parent 0e61e47 commit 07f073e
Show file tree
Hide file tree
Showing 40 changed files with 77,327 additions and 19,773 deletions.
3 changes: 3 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Repository CODEOWNERS

@Redocly/plug-and-play
5 changes: 3 additions & 2 deletions .github/linters/.eslintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ ignorePatterns:
- '**/dist/.*'
- '**/coverage/.*'
- '*.json'
- 'fake-api-server/**/*'

parser: '@typescript-eslint/parser'

Expand Down Expand Up @@ -76,8 +77,8 @@ rules:
'@typescript-eslint/promise-function-async': 'error',
'@typescript-eslint/require-array-sort-compare': 'error',
'@typescript-eslint/restrict-plus-operands': 'error',
'@typescript-eslint/semi': ['error', 'never'],
'@typescript-eslint/semi': 'off',
'@typescript-eslint/space-before-function-paren': 'off',
'@typescript-eslint/type-annotation-spacing': 'error',
'@typescript-eslint/unbound-method': 'error'
'@typescript-eslint/unbound-method': 'error',
}
20 changes: 20 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
## What/Why/How?

<!-- Summarize your changes briefly.
Avoid long-winded descriptions. Be precise and concise. -->

## Reference

<!-- Add references if applicable -->

## Testing

<!-- Describe how these changes have been tested or list testing steps. -->

## Screenshots / Video (optional)

<!-- If useful, provide screenshots or videos of your changes. -->

## Additional context

<!-- If useful, provide additional context. -->
67 changes: 0 additions & 67 deletions .github/workflows/check-dist.yml

This file was deleted.

114 changes: 102 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Continuous Integration
name: CI

on:
pull_request:
Expand All @@ -10,10 +10,13 @@ on:

permissions:
contents: read
statuses: write

# TODO: add caching for node_modules between jobs

jobs:
test-typescript:
name: TypeScript Tests
code-quality:
name: Code Quality
runs-on: ubuntu-latest

steps:
Expand All @@ -33,32 +36,119 @@ jobs:
run: npm ci

- name: Check Format
id: npm-format-check
run: npm run format:check
id: npm-prettier-check
run: npm run prettier:check

- name: Lint
id: npm-lint
run: npm run lint

- name: Test
test-unit:
name: Unit Tests
runs-on: ubuntu-latest

steps:
- name: Checkout
id: checkout
uses: actions/checkout@v4

- name: Setup Node.js
id: setup-node
uses: actions/setup-node@v4
with:
node-version-file: .node-version
cache: npm

- name: Install Dependencies
id: npm-ci
run: npm ci

- name: Unit tests
id: npm-ci-test
run: npm run ci-test
run: npm run test:ci

# In TypeScript actions, `dist/` is a special directory. When you reference
# an action with the `uses:` property, `dist/index.js` is the code that will be
# run. For this project, the `dist/index.js` file is transpiled from other
# source files. This workflow ensures the `dist/` directory contains the
# expected transpiled code.
#
# If this workflow is run from a feature branch, it will act as an additional CI
# check and fail if the checked-in `dist/` directory does not match what is
# expected from the build.
check-dist:
name: Check "dist" folder
runs-on: ubuntu-latest

test-action:
name: GitHub Actions Test
steps:
- name: Checkout
id: checkout
uses: actions/checkout@v4

- name: Setup Node.js
id: setup-node
uses: actions/setup-node@v4
with:
node-version-file: .node-version
cache: npm

- name: Install Dependencies
id: install
run: npm ci

- name: Build dist/ Directory
id: build
run: npm run bundle

# This will fail the workflow if the PR wasn't created by Dependabot.
- name: Compare Directories
id: diff
run: |
if [ "$(git diff --ignore-space-at-eol --text dist/ | wc -l)" -gt "0" ]; then
echo "Detected uncommitted changes after build. See status below:"
git diff --ignore-space-at-eol --text dist/
exit 1
fi
# If `dist/` was different than expected, and this was not a Dependabot
# PR, upload the expected version as a workflow artifact.
- if: ${{ failure() && steps.diff.outcome == 'failure' }}
name: Upload Artifact
id: upload
uses: actions/upload-artifact@v4
with:
name: dist
path: dist/

test-smoke:
name: Action smoke test
runs-on: ubuntu-latest

steps:
- name: Checkout
id: checkout
uses: actions/checkout@v4

- name: Test Local Action
- name: Install modules
id: install-modules
run: npm install

- name: Start fake server
id: fake-server-start
run: npm run fake-server:start

- name: Run Local Action
id: test-action
uses: ./
with:
milliseconds: 2000
organization: 'ci-test-org'
project: 'ci-test-project'
domain: 'http://localhost:3000'
files: 'tests/test-folder-1 tests/test-root-file.yaml'
mountPath: 'test-folder'
env:
REDOCLY_AUTHORIZATION: ${{ secrets.REDOCLY_AUTHORIZATION }}

- name: Print Output
id: output
run: echo "${{ steps.test-action.outputs.time }}"
run: echo "${{ steps.test-action.outputs.pushId }}"
48 changes: 0 additions & 48 deletions .github/workflows/codeql-analysis.yml

This file was deleted.

49 changes: 0 additions & 49 deletions .github/workflows/linter.yml

This file was deleted.

4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -101,3 +101,7 @@ __tests__/runner/*
.idea
.vscode
*.code-workspace

# Custom
fake-api-server/.dist
results.json
4 changes: 2 additions & 2 deletions .prettierrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
"printWidth": 80,
"tabWidth": 2,
"useTabs": false,
"semi": false,
"semi": true,
"singleQuote": true,
"quoteProps": "as-needed",
"jsxSingleQuote": false,
"trailingComma": "none",
"trailingComma": "all",
"bracketSpacing": true,
"bracketSameLine": true,
"arrowParens": "avoid",
Expand Down
3 changes: 0 additions & 3 deletions CODEOWNERS

This file was deleted.

Loading

0 comments on commit 07f073e

Please sign in to comment.