From 59c3e7f2cb8dde2464ba20c07e64719c84ce9c52 Mon Sep 17 00:00:00 2001 From: Henry Bell Date: Wed, 30 Oct 2024 11:02:59 +0000 Subject: [PATCH] ci: add GitHub Actions config (#1) --- .github/dependabot.yaml | 52 ++++++++++++++++++++++++ .github/release-please.yml | 23 +++++++++++ .github/workflows/codehealth.yaml | 66 +++++++++++++++++++++++++++++++ .github/workflows/unit_tests.yaml | 45 +++++++++++++++++++++ 4 files changed, 186 insertions(+) create mode 100644 .github/dependabot.yaml create mode 100644 .github/release-please.yml create mode 100644 .github/workflows/codehealth.yaml create mode 100644 .github/workflows/unit_tests.yaml diff --git a/.github/dependabot.yaml b/.github/dependabot.yaml new file mode 100644 index 0000000..bdc50df --- /dev/null +++ b/.github/dependabot.yaml @@ -0,0 +1,52 @@ +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +--- +updates: + # Github-actions dependencies + - directory: "/" + package-ecosystem: "github-actions" + schedule: + interval: "weekly" + commit-message: + prefix: "fix" + + # NPM dependencies -- only prompt to update minor versions. + - directory: "/" + package-ecosystem: "npm" + schedule: + interval: "weekly" + ignore: + - dependency-name: "*" + update-types: ["version-update:semver-major"] + commit-message: + prefix: "fix" + + # Docker dependencies + - directory: "/" + package-ecosystem: "docker" + schedule: + interval: "weekly" + commit-message: + prefix: "fix" + + # Terraform dependencies + - directory: "/terraform" + package-ecosystem: "terraform" + schedule: + interval: "weekly" + commit-message: + prefix: "fix" + +version: 2 diff --git a/.github/release-please.yml b/.github/release-please.yml new file mode 100644 index 0000000..5680b94 --- /dev/null +++ b/.github/release-please.yml @@ -0,0 +1,23 @@ +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +handleGHRelease: true +manifest: true +branches: + - branch: version_1 + handleGHRelease: true + manifest: true + - branch: version_2 + handleGHRelease: true + manifest: true diff --git a/.github/workflows/codehealth.yaml b/.github/workflows/codehealth.yaml new file mode 100644 index 0000000..46e9d82 --- /dev/null +++ b/.github/workflows/codehealth.yaml @@ -0,0 +1,66 @@ +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: "Code health checks (npm audit, eslint, tscompiler, ...)" + +on: + push: + pull_request: + +jobs: + analyze: + name: "Analyze" + runs-on: ubuntu-latest + permissions: + actions: read + contents: read + strategy: + fail-fast: false + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Use Node.js + uses: actions/setup-node@v4 + with: + node-version: 20 + check-latest: true + + - name: Use terraform + uses: hashicorp/setup-terraform@v3 + + - name: Install node modules + run: npm install + + - name: Execute "npm run typecheck" + run: npm run typecheck + + - name: Execute "npm run eslint" + run: npm run eslint + + - name: Execute "npm run check-format" + run: npm run check-format + + - name: Execute "npm run mdlint" + run: npm run mdlint + + - name: Execute "npm audit" + run: npm audit + + - name: Execute "npm run markdown-link-check" + run: npm run markdown-link-check + + - name: terraform validate deployments + run: npm run terraform-validate diff --git a/.github/workflows/unit_tests.yaml b/.github/workflows/unit_tests.yaml new file mode 100644 index 0000000..ef4603e --- /dev/null +++ b/.github/workflows/unit_tests.yaml @@ -0,0 +1,45 @@ +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: Node.js unit tests + +on: [push, pull_request] + +jobs: + unit-tests: + runs-on: ubuntu-latest + + defaults: + run: + working-directory: src/poller/poller-core + + 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: npm install + run: npm install + + - name: Unit tests + run: npm test + env: + CI: true