Skip to content

Commit

Permalink
Fork chores
Browse files Browse the repository at this point in the history
  • Loading branch information
placintaalexandru committed Dec 29, 2023
1 parent 9e02862 commit b1fc454
Show file tree
Hide file tree
Showing 35 changed files with 15,476 additions and 16,443 deletions.
33 changes: 16 additions & 17 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
{
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": "./tsconfig.eslint.json"
},
"plugins": ["@typescript-eslint"],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking",
"plugin:@typescript-eslint/recommended",
"plugin:prettier/recommended",
"prettier",
"prettier/@typescript-eslint"
],
"rules": {
"@typescript-eslint/ban-ts-ignore": "off"
}
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": "./tsconfig.eslint.json"
},
"plugins": ["@typescript-eslint"],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking",
"plugin:@typescript-eslint/recommended",
"plugin:prettier/recommended",
"prettier"
],
"rules": {
"@typescript-eslint/ban-ts-ignore": "off"
}
}
14 changes: 14 additions & 0 deletions .githooks/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash

# This commit hook checks whether we ran `npm run build` when committed TypeScript files.
# For GitHub actions to work, we need to check the compiled JavaScript into VCS.
#
# This script can yield false positives in cases where you only make stylistic changes to the TypeScript code that don't result in changes to the compiled JavaScript code.
# It is your responsibility as a developer to then commit the changes with `git commit --no-verify` and simply skip this commit hook.

TS_FILES=$(git diff --staged --name-only | grep -c "src/")
DIST_MODIFIED=$(git diff --staged --name-only | grep -c "dist/index.js")

if [ "$TS_FILES" -gt 0 ] && [ "$DIST_MODIFIED" -eq 0 ] ; then
npm run build && git add dist/index.js
fi
20 changes: 20 additions & 0 deletions .github/coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# ref: https://docs.codecov.com/docs/codecovyml-reference
coverage:
range: 80..100
round: down
precision: 1
status:
# ref: https://docs.codecov.com/docs/commit-status
project:
default:
# Avoid false negatives
threshold: 2%

# Test files aren't important for coverage
ignore:
- "tests"

# Make comments less noisy
comment:
layout: "files"
require_changes: yes
7 changes: 7 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
version: 2
updates:
# When a new version of action exists
- package-ecosystem: github-actions
directory: /
schedule:
interval: daily
36 changes: 36 additions & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Lint check
on:
push:
branches:
- main
pull_request:
# The branches below must be a subset of the branches above
branches:
- main
schedule:
# Every Monday at midnight: https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#schedule
- cron: "0 0 * * 1"
permissions:
contents: read
concurrency:
# Cancel old actions upon push
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
lint:
runs-on: ubuntu-latest
name: Lint check
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup node
uses: actions/setup-node@v4
with:
node-version: 18

- name: Install dependencies
run: npm ci

- name: Lint check
run: npm run lint
18 changes: 0 additions & 18 deletions .github/workflows/ci.yml

This file was deleted.

89 changes: 89 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
# 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.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: CodeQL
on:
push:
branches:
- main
pull_request:
# The branches below must be a subset of the branches above
branches:
- main
schedule:
# Every Monday at midnight: https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#schedule
- cron: "0 0 * * 1"
permissions:
contents: read
concurrency:
# Cancel old actions upon push
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
analyze:
name: Analyze
# Runner size impacts CodeQL analysis time. To learn more, please see:
# - https://gh.io/recommended-hardware-resources-for-running-codeql
# - https://gh.io/supported-runners-and-hardware-resources
# - https://gh.io/using-larger-runners
# Consider using larger runners for possible analysis time improvements.
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
timeout-minutes: ${{ (matrix.language == 'swift' && 300) || 600 }}
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language:
- javascript-typescript
# CodeQL supports [ 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift' ]
# Use only 'java-kotlin' to analyze code written in Java, Kotlin or both
# Use only 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support

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

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
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.

# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality

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

# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun

# If the Autobuild fails above, remove it and uncomment the following three lines.
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.

# - run: |
# echo "Run, Build Application using script"
# ./location_of_script_within_repo/buildscript.sh

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
with:
category: "/language:${{matrix.language}}"
42 changes: 42 additions & 0 deletions .github/workflows/unit_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Unit tests
on:
push:
branches:
- main
pull_request:
# The branches below must be a subset of the branches above
branches:
- main
schedule:
# Every Monday at midnight: https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#schedule
- cron: "0 0 * * 1"
permissions:
contents: read
concurrency:
# Cancel old actions upon push
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
test:
name: Units tests
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup node
uses: actions/setup-node@v4
with:
node-version: 18

- name: Install dependencies
run: npm ci

- name: Run test
run: npm run test

- name: Upload to codecov.io
uses: codecov/codecov-action@v3
env:
fail_ci_if_error: true
verbose: true
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -92,3 +92,6 @@ typings/

# IntelliJ IDEs
.idea

# macOS specifics
.DS_Store
2 changes: 1 addition & 1 deletion .npmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
@actions-rs:registry=https://npm.pkg.github.com
@crusty-pie:registry=https://npm.pkg.github.com
80 changes: 80 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# Contributing to `clippy` GitHub Action

The following is a set of guidelines for contributing to the `clippy` GitHub
Action.

## Reporting bugs

Before creating bug reports, please check the GitHub issues list for Action you are using
as you might find out that you don't need to create one.\
When you are creating a bug report, please include as many details as possible.

Note: If you find a closed issue that seems like it is the same thing that you're experiencing,
open a new issue and include a link to the original issue in the body of your new one.

### How do I submit a bug report?

Bugs are tracked as a GitHub issues in the corresponding Action repositories.

Explain the problem and include additional details to help maintainers reproduce the problem:

1. Use a clear and descriptive title for the issue to identify the problem.
2. Describe the exact steps which reproduce the problem in as many details as possible.
3. Provide specific examples to demonstrate the steps.
Include links to the workflow files (pointing to the specific commit, and not to the `main` branch) and
attach step logs to the issue (consider enabling
[debug logs](https://github.com/actions/toolkit/blob/master/docs/action-debugging.md)
first).
4. Describe the behavior you observed after following the steps and point out what exactly is the problem with that behavior.
5. Explain which behavior you expected to see instead **and why**.

## Feature requests

**New ideas are welcomed!**

Feature requests are also tracked as a GitHub issues in the corresponding
Action repositories.

Explain the idea and include as many additional details as possible:

1. Use a clear and descriptive title for the issue.
2. Describe your motivation and how Rust community could benefit from this
change.
3. Provide workflow step examples, if applicable.
4. Include links to the related tools, alternative implementations or any other
information sources.

### Backwards compatibility

Please note that maintaining backwards compatibility is critically important;
any changes that require a new major version to be published will be postponed
till there will be enough changes to make a new major release.

## Pull Requests

### Breaking changes

If your change introduces any new functionality or breaks the backwards
compatibility in any matter - **do not rush to create a Pull Request at all**.

Do not waste your time on that, check
[Backwards compatibility](#backwards-compatibility) section first for
motivation, and create an issue first, explain why you want to make this change
and let the discussion happen.

### Open a Pull Request

The Code you are contributing should pass the following checks:

1. Should change only one specific thing
2. Not raising any compiler errors or warnings
- **do not use lint annotations to mask specific error**
3. Conforms to formatting rules (use `npm run format` command)
4. Not raising any lint warnings (use `npm run lint` command)
5. All tests should pass (use `npm run test` command)

Now create a GitHub Pull Request with a patch:

1. Ensure the Pull Request description clearly describes the problem and solution
2. Include the relevant issue number if applicable
3. Ensure that all the checks from above are passing
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

The MIT License (MIT)

Copyright (c) 2019 actions-rs team and contributors
Copyright (c) 2019 crusty-pie team and contributors

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
Loading

0 comments on commit b1fc454

Please sign in to comment.