Skip to content

Commit

Permalink
chore(ci): add initial workflow definitions (#7)
Browse files Browse the repository at this point in the history
Signed-off-by: Nathan Klick <[email protected]>
  • Loading branch information
nathanklick authored Feb 19, 2024
1 parent 0de2c53 commit 189e952
Show file tree
Hide file tree
Showing 15 changed files with 722 additions and 9 deletions.
48 changes: 48 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
###################################
##### Global Protection Rule ######
###################################
# NOTE: This rule is overriden by the more specific rules below. This is the catch-all rule for all files not covered by the more specific rules below.
* @hashgraph/release-engineering @hashgraph/release-engineering-managers

############################
##### Project Files ######
############################

/src/** @hashgraph/release-engineering @leninmehedy
/test/** @hashgraph/release-engineering @leninmehedy
/resources/** @hashgraph/release-engineering @leninmehedy

#########################
##### Core Files ######
#########################

# NOTE: Must be placed last to ensure enforcement over all other rules

# Protection Rules for Github Configuration Files and Actions Workflows
/.github/ @hashgraph/release-engineering-managers

# NodeJS project files
package.json @hashgraph/release-engineering-managers
package-lock.json @hashgraph/release-engineering-managers
jest.config.mjs @hashgraph/release-engineering-managers

# Codacy Tool Configurations
/config/ @hashgraph/release-engineering-managers
.remarkrc @hashgraph/release-engineering-managers

# Semantic Release Configuration
.releaserc @hashgraph/release-engineering-managers

# Self-protection for root CODEOWNERS files (this file should not exist and should definitely require approval)
/CODEOWNERS @hashgraph/release-engineering-managers

# Protect the repository root files
/README.md @hashgraph/release-engineering @hashgraph/release-engineering-managers
**/LICENSE @hashgraph/release-engineering @hashgraph/release-engineering-managers

# CodeCov configuration
**/codecov.yml @hashgraph/release-engineering @hashgraph/release-engineering-managers

# Git Ignore definitions
**/.gitignore @hashgraph/release-engineering @hashgraph/release-engineering-managers
**/.gitignore.* @hashgraph/release-engineering @hashgraph/release-engineering-managers
7 changes: 6 additions & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,10 @@ updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
interval: "daily"
open-pull-requests-limit: 5
- package-ecosystem: "npm"
directory: "/"
schedule:
interval: "daily"
open-pull-requests-limit: 15
65 changes: 65 additions & 0 deletions .github/workflows/flow-build-application.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
##
# Copyright (C) 2022-2023 Hedera Hashgraph, 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: "Build Application"
on:
workflow_dispatch:
inputs:
enable-unit-tests:
description: "Unit Testing Enabled"
type: boolean
required: false
default: true
enable-e2e-tests:
description: "E2E Testing Enabled"
type: boolean
required: false
default: false
enable-snyk-scan:
description: "Snyk Scan Enabled"
type: boolean
required: false
default: false
push:
branches:
- main
- 'release/*'

defaults:
run:
shell: bash

jobs:
code:
name: Code
uses: ./.github/workflows/zxc-compile-code.yaml
with:
enable-unit-tests: ${{ github.event_name == 'push' || github.event.inputs.enable-unit-tests == 'true' }}
enable-e2e-tests: ${{ github.event_name == 'push' || github.event.inputs.enable-e2e-tests == 'true' }}

analyze:
name: Analyze
uses: ./.github/workflows/zxc-code-analysis.yaml
needs:
- code
if: ${{ github.event_name == 'push' || github.event.inputs.enable-unit-tests == 'true' || github.event.inputs.enable-e2e-tests == 'true' }}
with:
custom-job-label: Source Code
enable-snyk-scan: ${{ github.event_name == 'push' || github.event.inputs.enable-snyk-scan == 'true' }}
enable-codecov-analysis: ${{ github.event_name == 'push' || github.event.inputs.enable-unit-tests == 'true' || github.event.inputs.enable-e2e-tests == 'true' }}
secrets:
snyk-token: ${{ secrets.SNYK_TOKEN }}
codecov-token: ${{ secrets.CODECOV_TOKEN }}
82 changes: 82 additions & 0 deletions .github/workflows/flow-pull-request-checks.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
##
# Copyright (C) 2023-2024 Hedera Hashgraph, 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: "PR Checks"
on:
workflow_dispatch:
pull_request:
types:
- opened
- reopened
- synchronize

defaults:
run:
shell: bash

concurrency:
group: pr-checks-${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
build:
name: Code
uses: ./.github/workflows/zxc-compile-code.yaml

unit-tests:
name: Unit Tests
uses: ./.github/workflows/zxc-compile-code.yaml
needs:
- build
with:
custom-job-label: Standard
enable-unit-tests: true

e2e-tests:
name: E2E Tests
uses: ./.github/workflows/zxc-compile-code.yaml
needs:
- build
if: false
with:
custom-job-label: Standard
enable-e2e-tests: true

codecov:
name: CodeCov
uses: ./.github/workflows/zxc-code-analysis.yaml
needs:
- unit-tests
#- e2e-tests
if: ${{ github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name && github.actor != 'dependabot[bot]' }}
with:
custom-job-label: Standard
enable-codecov-analysis: true
secrets:
codecov-token: ${{ secrets.CODECOV_TOKEN }}

# snyk:
# name: Snyk Scan
# uses: ./.github/workflows/zxc-code-analysis.yaml
# needs:
# - unit-tests
# - e2e-tests
# if: ${{ github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name && github.actor != 'dependabot[bot]' }}
# with:
# custom-job-label: Standard
# enable-snyk-scan: true
# secrets:
# snyk-token: ${{ secrets.SNYK_TOKEN }}
65 changes: 65 additions & 0 deletions .github/workflows/flow-pull-request-formatting.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
##
# Copyright (C) 2023 Hedera Hashgraph, 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: "PR Formatting"
on:
workflow_dispatch:
pull_request_target:
types:
- opened
- reopened
- edited
- synchronize

defaults:
run:
shell: bash

permissions:
statuses: write

concurrency:
group: pr-formatting-${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
title-check:
name: Title Check
runs-on: [self-hosted, Linux, medium, ephemeral]
steps:
- name: Check PR Title
uses: aslafy-z/conventional-pr-title-action@a0b851005a0f82ac983a56ead5a8111c0d8e044a # v3.2.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

code-formatting:
name: Code Formatting
runs-on: [self-hosted, Linux, medium, ephemeral]
steps:
- name: Checkout Code
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

- name: Setup Node
uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1
with:
node-version: ${{ inputs.node-version }}
cache: npm

- name: Install Dependencies
run: npm ci

- name: Check Formatting
run: npm run check
Loading

0 comments on commit 189e952

Please sign in to comment.