diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..6334139 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,28 @@ +version: 2 +updates: + - package-ecosystem: npm + directory: / + schedule: + interval: weekly + day: monday + time: '04:00' + timezone: Europe/Bratislava + open-pull-requests-limit: 5 + labels: + - dependencies + commit-message: + prefix: chore(deps) + + - package-ecosystem: github-actions + directory: / + schedule: + interval: weekly + day: monday + time: '04:30' + timezone: Europe/Bratislava + open-pull-requests-limit: 5 + labels: + - dependencies + - github-actions + commit-message: + prefix: chore(actions) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml new file mode 100644 index 0000000..6e016f9 --- /dev/null +++ b/.github/workflows/codeql.yml @@ -0,0 +1,38 @@ +name: CodeQL Security + +on: + push: + branches: [main] + pull_request: + branches: [main] + schedule: + - cron: '23 3 * * 1' + +permissions: + contents: read + security-events: write + +jobs: + analyze: + name: Analyze JavaScript + runs-on: ubuntu-latest + timeout-minutes: 20 + + steps: + - name: Harden runner + uses: step-security/harden-runner@v2.22.1 + with: + egress-policy: audit + + - name: Check out repository + uses: actions/checkout@v7.0.1 + + - name: Initialize CodeQL + uses: github/codeql-action/init@v4.38.3 + with: + languages: javascript-typescript + build-mode: none + + - name: Analyze + uses: github/codeql-action/analyze@v4.38.3 + diff --git a/.github/workflows/dependency-review.yml b/.github/workflows/dependency-review.yml new file mode 100644 index 0000000..0ef3a6b --- /dev/null +++ b/.github/workflows/dependency-review.yml @@ -0,0 +1,29 @@ +name: Dependency Review + +on: + pull_request: + branches: [main] + +permissions: + contents: read + +jobs: + review: + name: Review dependency changes + runs-on: ubuntu-latest + timeout-minutes: 10 + + steps: + - name: Harden runner + uses: step-security/harden-runner@v2.22.1 + with: + egress-policy: audit + + - name: Check out repository + uses: actions/checkout@v7.0.1 + + - name: Dependency review + uses: actions/dependency-review-action@v5.0.0 + with: + fail-on-severity: high + diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml index 2284b93..fdfe99d 100644 --- a/.github/workflows/node.js.yml +++ b/.github/workflows/node.js.yml @@ -1,31 +1,52 @@ -# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node -# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs - -name: Node.js CI +name: Trinity Worker CI on: push: - branches: [ "main" ] + branches: [main] pull_request: - branches: [ "main" ] + branches: [main] -jobs: - build: +permissions: + contents: read - runs-on: ubuntu-latest +concurrency: + group: ci-${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true +jobs: + validate: + name: Node ${{ matrix.node-version }} validation + runs-on: ubuntu-latest + timeout-minutes: 15 strategy: + fail-fast: false matrix: - node-version: [18.x, 20.x, 22.x] - # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ + node-version: [20.x, 22.x] steps: - - uses: actions/checkout@v4 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v4 - with: - node-version: ${{ matrix.node-version }} - cache: 'npm' - - run: npm ci - - run: npm run build --if-present - - run: npm test + - name: Harden runner + uses: step-security/harden-runner@v2.22.1 + with: + egress-policy: audit + + - name: Check out repository + uses: actions/checkout@v7.0.1 + + - name: Set up Node.js + uses: actions/setup-node@v7.1.0 + with: + node-version: ${{ matrix.node-version }} + cache: npm + + - name: Install locked dependencies + run: npm ci + + - name: Validate JavaScript syntax + run: find src -type f -name '*.js' -print0 | xargs -0 -n1 node --check + + - name: Audit production dependencies + run: npm audit --omit=dev --audit-level=high + + - name: Build Cloudflare Worker without deploying + run: npx wrangler deploy --dry-run --outdir .wrangler-dist + diff --git a/.github/workflows/webpack.yml b/.github/workflows/webpack.yml deleted file mode 100644 index 9626ff6..0000000 --- a/.github/workflows/webpack.yml +++ /dev/null @@ -1,28 +0,0 @@ -name: NodeJS with Webpack - -on: - push: - branches: [ "main" ] - pull_request: - branches: [ "main" ] - -jobs: - build: - runs-on: ubuntu-latest - - strategy: - matrix: - node-version: [18.x, 20.x, 22.x] - - steps: - - uses: actions/checkout@v4 - - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v4 - with: - node-version: ${{ matrix.node-version }} - - - name: Build - run: | - npm install - npx webpack