From 4c77569a4b964b6f31d6a0362bae11501b312e3b Mon Sep 17 00:00:00 2001 From: Uzlopak Date: Thu, 11 Aug 2022 09:11:00 +0200 Subject: [PATCH] add redis workflow (#60) * add redis workflow * Update .github/workflows/plugins-ci-redis.yml Co-authored-by: Frazer Smith Co-authored-by: Frazer Smith --- .github/workflows/plugins-ci-redis.yml | 140 +++++++++++++++++++++++++ 1 file changed, 140 insertions(+) create mode 100644 .github/workflows/plugins-ci-redis.yml diff --git a/.github/workflows/plugins-ci-redis.yml b/.github/workflows/plugins-ci-redis.yml new file mode 100644 index 0000000..bf7a458 --- /dev/null +++ b/.github/workflows/plugins-ci-redis.yml @@ -0,0 +1,140 @@ +name: Plugin CI - Redis + +on: + workflow_call: + inputs: + auto-merge-exclude: + description: 'A comma separated list of packages that you do not want to be auto-merged.' + required: false + default: 'fastify' + type: string + license-check: + description: 'Check licenses' + required: false + type: boolean + default: false + license-check-allowed-additional: + description: 'A semicolon seperate list of additional licenses to allow.' + required: false + type: string + default: '' + lint: + description: 'Set to true to run linting scripts.' + required: false + default: false + type: boolean + +jobs: + dependency-review: + name: Dependency Review + if: github.event_name == 'pull_request' + runs-on: ubuntu-latest + permissions: + contents: read + steps: + - name: Check out repo + uses: actions/checkout@v3 + with: + persist-credentials: false + + - name: Dependency review + uses: actions/dependency-review-action@v2 + + license-check: + if: > + !failure() && + !cancelled() && + inputs.license-check == true + name: Check Licenses + runs-on: ubuntu-latest + permissions: + contents: read + steps: + - uses: actions/checkout@v3 + with: + persist-credentials: false + + - name: Setup Node + uses: actions/setup-node@v3 + with: + node-version: lts/* + + - name: Install dependencies + run: npm i --ignore-scripts + + - name: Check Licenses + run: ${{ format('npx license-checker --production --onlyAllow="0BSD;Apache-2.0;BSD-2-Clause;BSD-3-Clause;ISC;MIT;{0}"', inputs.license-check-allowed-additional) }} + + linter: + name: Lint Code + if: > + !failure() && + !cancelled() && + inputs.lint == true + runs-on: ubuntu-latest + permissions: + contents: read + steps: + - name: Check out repo + uses: actions/checkout@v3 + with: + persist-credentials: false + + - name: Setup Node + uses: actions/setup-node@v3 + with: + node-version: lts/* + + - name: Install dependencies + run: npm i + + - name: Lint code + run: npm run lint + + test: + name: Node.js ${{ matrix.node-version }} - ${{ matrix.db }} + runs-on: ubuntu-latest + strategy: + matrix: + node-version: [14, 16, 18] + db: [5, 6, 7] + services: + redis: + image: redis:${{ matrix.db }} + ports: + - '6379:6379' + options: '--entrypoint redis-server' + + steps: + - name: Check out repo + uses: actions/checkout@v3 + with: + persist-credentials: false + + - name: Setup Node ${{ matrix.node-version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + + - name: Install dependencies + run: npm i --ignore-scripts + + - name: Run tests + run: npm test + + automerge: + name: Automerge Dependabot PRs + if: > + github.event_name == 'pull_request' && + github.event.pull_request.user.login == 'dependabot[bot]' + needs: test + permissions: + pull-requests: write + contents: write + runs-on: ubuntu-latest + steps: + - uses: fastify/github-action-merge-dependabot@v3 + with: + exclude: ${{ inputs.auto-merge-exclude }} + github-token: ${{ secrets.GITHUB_TOKEN }} + target: major