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..46d522f --- /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: ['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/.travis.yml b/.travis.yml deleted file mode 100644 index dd3ce42..0000000 --- a/.travis.yml +++ /dev/null @@ -1,11 +0,0 @@ -dist: focal -language: node_js -node_js: - - node -sudo: false -install: - - npm config set prefer-offline false - - npm install - -script: - - npm run lint -- --report-unused-disable-directives --max-warnings 0