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

Release version 2.0 #26

Merged
merged 36 commits into from
Dec 24, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
85f04ab
Normalise line-endings
SleeplessByte Dec 24, 2020
09367e3
Ignore generated files
SleeplessByte Dec 24, 2020
2135fb5
Ignore generated directory
SleeplessByte Dec 24, 2020
0d459cf
Rename deploy workflows
SleeplessByte Dec 24, 2020
ad49925
Add code-formatting
SleeplessByte Dec 24, 2020
288a0e4
Update dependencies
SleeplessByte Dec 24, 2020
8225b51
Add CI workflows and scripts
SleeplessByte Dec 24, 2020
6941d88
Allow remote downloads in run.sh
SleeplessByte Dec 24, 2020
35b0dd4
Update eslint configuration to recognise prettier
SleeplessByte Dec 24, 2020
daef77b
Add scripts for easier maintenance
SleeplessByte Dec 24, 2020
4a60682
Remove tooling_webserver
SleeplessByte Dec 24, 2020
cba3066
Change LICENSE
SleeplessByte Dec 24, 2020
a31a3b2
Link directories
SleeplessByte Dec 24, 2020
62f7995
Add smoke tests
SleeplessByte Dec 24, 2020
d1a581b
Format the code
SleeplessByte Dec 24, 2020
d3e977e
Add code ql workflow
SleeplessByte Dec 24, 2020
b0c20c0
Bump the version
SleeplessByte Dec 24, 2020
c33a90f
Explain how to maintain in the README.md
SleeplessByte Dec 24, 2020
f666453
Create CHANGELOG.md
SleeplessByte Dec 24, 2020
37e4bb4
Expose binary
SleeplessByte Dec 24, 2020
303bc8c
Make executable
SleeplessByte Dec 24, 2020
0a181e4
Check reporter
SleeplessByte Dec 24, 2020
1049096
Echo to stderr
SleeplessByte Dec 24, 2020
a6354ce
Pass in CWD
SleeplessByte Dec 24, 2020
10e2972
Resolve the root path to find the reporter
SleeplessByte Dec 24, 2020
4a6626a
Only postinstall when we want it to
SleeplessByte Dec 24, 2020
aaf1654
Format
SleeplessByte Dec 24, 2020
cff7cf3
Satisfy linter
SleeplessByte Dec 24, 2020
9b24984
Back to dot path
SleeplessByte Dec 24, 2020
a0592aa
Echo those paths
SleeplessByte Dec 24, 2020
ee59e2a
Show us DIST please
SleeplessByte Dec 24, 2020
c0c29b3
Attempt explicitely outputting to dist
SleeplessByte Dec 24, 2020
ec017b6
Pipe those failures
SleeplessByte Dec 24, 2020
43276fd
Simplify binaries
SleeplessByte Dec 24, 2020
80c1eb0
Fix build step and simplify workflow further
SleeplessByte Dec 24, 2020
2ea2391
Make executable
SleeplessByte Dec 24, 2020
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
34 changes: 24 additions & 10 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,25 @@
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended"
"plugin:@typescript-eslint/recommended",
"prettier",
"prettier/@typescript-eslint",
"plugin:import/errors",
"plugin:import/warnings",
"plugin:import/typescript"
],
"rules": {
"@typescript-eslint/explicit-function-return-type": [
"warn", {
"warn",
{
"allowExpressions": false,
"allowTypedFunctionExpressions": true,
"allowHigherOrderFunctions": true
}
],
"@typescript-eslint/explicit-member-accessibility": [
"warn", {
"warn",
{
"accessibility": "no-public",
"overrides": {
"accessors": "explicit",
Expand All @@ -38,27 +45,34 @@
}
}
],
"@typescript-eslint/indent": ["error", 2],
"@typescript-eslint/no-inferrable-types": [
"error", {
"error",
{
"ignoreParameters": true
}
],
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/no-parameter-properties": [
"warn", {
"warn",
{
"allows": [
"private", "protected", "public",
"private readonly", "protected readonly", "public readonly"
"private",
"protected",
"public",
"private readonly",
"protected readonly",
"public readonly"
]
}
],
"@typescript-eslint/no-unused-vars": "off",
"@typescript-eslint/no-use-before-define": [
"error", {
"error",
{
"functions": false,
"typedefs": false
}
]
],
"import/no-unresolved": "off"
}
}
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* text=auto eol=lf
45 changes: 45 additions & 0 deletions .github/workflows/ci.js.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# This workflow will do a clean install of node dependencies and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions

name: javascript-test-runner / master

on:
push:
branches: [master]

jobs:
precheck:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Use Node.js LTS (14.x)
uses: actions/setup-node@v1
with:
node-version: 14.x

- name: Install project dependencies
run: yarn install --frozen-lockfile --ignore-scripts

- name: Run exercism/javascript-test-runner ci precheck (lint code)
run: bin/lint.sh

ci:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [12.x, 14.x, 15.x]

steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}

- name: Install project dependencies
run: yarn install --frozen-lockfile --ignore-scripts

- name: Build the test-runner (using Node ${{ matrix.node-version }})
run: bin/test.sh
61 changes: 61 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
name: 'codeql'

on:
push:
branches: [master]
pull_request:
# The branches below must be a subset of the branches above
branches: [master]
schedule:
- cron: '0 14 * * 5'

jobs:
analyze:
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
# Override automatic language detection by changing the below list
# Supported options are ['csharp', 'cpp', 'go', 'java', 'javascript', 'python']
language: ['javascript']
# Learn more...
# https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#overriding-automatic-language-detection

steps:
- name: Checkout repository
uses: actions/checkout@v2

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language

#- run: |
# make bootstrap
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Push to DockerHub
name: javascript-test-runner / deploy / dockerhub

on:
push:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Deploy to Amazon ECR
name: javascript-test-runner / deploy / amazon-ecr

env:
aws_region: eu-west-2
Expand Down
110 changes: 110 additions & 0 deletions .github/workflows/format-code.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
name: 'Format code'

on:
issue_comment:
types: [created]

jobs:
format:
name: 'Format code'
runs-on: ubuntu-latest
if: github.event.issue.pull_request != '' && contains(github.event.comment.body, '/format')
steps:
- name: 'Post acknowledgement that it will format code'
continue-on-error: true # Never fail the build if this fails
uses: actions/github-script@6e5ee1dc1cb3740e5e5e76ad668e3f526edbfe45 # 2.0.0
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
github.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: 'The "Format code" action has started running.'
})

- name: 'Download PR data'
run: |
PR_DATA="/tmp/pr.json"

jq -r ".issue.pull_request.url" "$GITHUB_EVENT_PATH" | \
xargs curl --header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' -o "$PR_DATA" --url

- name: 'Check fork status'
id: fork_status
run: |
IS_FORK="$(jq '.head.repo.fork' "/tmp/pr.json")"
echo "::set-output name=fork::$IS_FORK"

- name: 'Setup SSH deploy key'
if: steps.fork_status.outputs.fork == 'false'
run: |
mkdir ~/.ssh
echo "${{ secrets.DEPLOY_KEY }}" > ~/.ssh/id_ed25519
chmod 600 ~/.ssh/id_ed25519

- name: 'Checkout code'
run: |
PR_DATA="/tmp/pr.json"

HEAD_REF=$(jq -r ".head.ref" "$PR_DATA")

if [ ${{ steps.fork_status.outputs.fork }} == "false" ]; then
echo "::debug::Setting up repo using SSH"
HEAD_REPO=$(jq -r '.head.repo.ssh_url' "$PR_DATA")
else
echo "::debug::Setting up repo using HTTPS"
HEAD_REPO=$(jq -r '.head.repo.clone_url | sub("https://"; "https://x-access-token:${{ secrets.GITHUB_TOKEN }}@")' "$PR_DATA")
fi

git clone $HEAD_REPO .
git checkout -b "$HEAD_REF" "origin/$HEAD_REF"

- name: 'Format code'
run: ./bin/format.sh
env:
EXERCISM_PRETTIER_VERSION: '2.2.1'

- name: 'Commit formatted code'
run: |
# Check if there is nothing to commit (i.e. no formatting changes made)
if [ -z "$(git status --porcelain)" ]; then
echo "Code is already formatted correctly"
exit 0
fi

# Setup the git user (required to commit anything)
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"

# Commit the changes made by prettier
git add .
git commit -m "[CI] Format code"
git push

- name: 'Post acknowledgement that it has formatted the code'
continue-on-error: true # Never fail the build if this fails
uses: actions/github-script@6e5ee1dc1cb3740e5e5e76ad668e3f526edbfe45 # 2.0.0
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
github.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: 'The "Format code" action has finished running.'
})

- name: 'Post reminder to trigger build manually'
continue-on-error: true # Never fail the build if this fails
if: steps.fork_status.outputs.fork == 'true'
uses: actions/github-script@6e5ee1dc1cb3740e5e5e76ad668e3f526edbfe45 # 2.0.0
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
github.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: 'For security reasons, `/format` does not trigger CI builds when the PR has been submitted from a fork. If checks were not passing due to code format, trigger a build to make the required checks pass, through one of the following ways:\n\n- Push an empty commit to this branch: `git commit --allow-empty -m "Trigger builds"`.\n- Close and reopen the PR.\n- Push a regular commit to this branch.'
})
47 changes: 47 additions & 0 deletions .github/workflows/pr.ci.js.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# This workflow will do a clean install of node dependencies and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions

name: javascript-test-runner / pr

on: pull_request

jobs:
precheck:
runs-on: ubuntu-latest

steps:
- name: Checkout PR
uses: actions/checkout@v2

- name: Use Node.js LTS (14.x)
uses: actions/setup-node@v1
with:
node-version: 14.x

- name: Install project dependencies
run: yarn install --frozen-lockfile --ignore-scripts

- name: Run exercism/javascript ci precheck (lint code)
run: bin/lint.sh

ci:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [12.x, 14.x, 15.x]

steps:
- name: Checkout PR
uses: actions/checkout@v2

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}

- name: Install project dependencies
run: yarn install --frozen-lockfile --ignore-scripts

- name: Build the test-runner (using Node ${{ matrix.node-version }})
run: bin/test.sh
18 changes: 18 additions & 0 deletions .github/workflows/verify-code-formatting.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: javascript-test-runner / format

on:
push:
pull_request:
workflow_dispatch:

jobs:
verify:
runs-on: ubuntu-latest
steps:
- name: 'Checkout code'
uses: actions/checkout@v2

- name: 'Verify formatting of all files'
run: ./bin/check-formatting.sh
env:
EXERCISM_PRETTIER_VERSION: '2.2.1'
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ jest.json
results.json
junit.xml
results.xml
tmp

yarn-error.log

Expand Down
4 changes: 4 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/test/fixtures
/tmp
/dist
/node_modules
9 changes: 9 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"trailingComma": "es5",
"tabWidth": 2,
"semi": false,
"singleQuote": true,
"arrowParens": "always",
"printWidth": 80,
"endOfLine": "lf"
}
Loading