diff --git a/.github/workflows/ci-branch.yml b/.github/workflows/ci-branch.yml new file mode 100644 index 0000000..815231f --- /dev/null +++ b/.github/workflows/ci-branch.yml @@ -0,0 +1,24 @@ +name: CI + +on: + push: + branches: + - develop + - master + pull_request: + types: [opened, synchronize, reopened] + workflow_dispatch: + +permissions: + contents: read + +concurrency: + group: ci-branch-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + branch: + uses: ./.github/workflows/ci-reusable.yml + with: + checkout-ref: ${{ github.event.pull_request.head.sha || github.sha }} + secrets: inherit diff --git a/.github/workflows/ci-pull-request.yml b/.github/workflows/ci-pull-request.yml new file mode 100644 index 0000000..a124f2e --- /dev/null +++ b/.github/workflows/ci-pull-request.yml @@ -0,0 +1,19 @@ +name: CI + +on: + pull_request: + types: [opened, synchronize, reopened] + +permissions: + contents: read + +concurrency: + group: ci-pr-${{ github.event.pull_request.number }} + cancel-in-progress: true + +jobs: + pull-request: + uses: ./.github/workflows/ci-reusable.yml + with: + checkout-ref: '' + secrets: inherit diff --git a/.github/workflows/ci-reusable.yml b/.github/workflows/ci-reusable.yml new file mode 100644 index 0000000..4f71985 --- /dev/null +++ b/.github/workflows/ci-reusable.yml @@ -0,0 +1,38 @@ +name: CI Pipeline + +on: + workflow_call: + inputs: + checkout-ref: + description: 'Git ref to checkout (empty for default merge commit)' + type: string + required: false + default: '' + +permissions: + contents: read + +jobs: + test: + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: ['lts/*', 'node'] + + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + ref: ${{ inputs.checkout-ref || github.ref }} + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + + - name: Install project dependencies + run: npm install + + - name: Run ESLint + run: npm run lint -- --report-unused-disable-directives --max-warnings 0 diff --git a/.github/workflows/update-copyright-years.yml b/.github/workflows/update-copyright-years.yml new file mode 100644 index 0000000..f11ba95 --- /dev/null +++ b/.github/workflows/update-copyright-years.yml @@ -0,0 +1,23 @@ +name: Update copyright year(s) in license file + +on: + schedule: + - cron: "20 8 12 1 *" + +jobs: + run: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + ref: develop + fetch-depth: 0 + - uses: FantasticFiasco/action-update-license-year@v2 + with: + token: ${{ secrets.GITHUB_TOKEN }} + path: README.md + branchName: license/{{currentYear}} + commitTitle: update license + commitBody: Let's keep legal happy. + prTitle: Update copyright years in README.md file + prBody: It's that time of the year, let's update the license. diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 989c161..0000000 --- a/.travis.yml +++ /dev/null @@ -1,13 +0,0 @@ -dist: focal -language: node_js -node_js: - - lts/* - - node -sudo: false -install: - - npm config set prefer-offline false - - npm install -script: - - echo -e "\x1b\x5b35;1m*** Linting...\x1b\x5b0m" - - npm run lint -- --report-unused-disable-directives --max-warnings 0 - - echo -e "\x1b\x5b35;1m*** Linting complete\x1b\x5b0m"