Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(ci): add workflows to build and test code #271

Merged
merged 1 commit into from
Mar 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
91 changes: 91 additions & 0 deletions .github/workflows/flow-build-application.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
##
# 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

code-style:
name: Code Style
uses: ./.github/workflows/zxc-compile-code.yaml
needs:
- code
with:
custom-job-label: Check
enable-code-style-check: true

unit-tests:
name: Unit Tests
uses: ./.github/workflows/zxc-compile-code.yaml
if: ${{ github.event_name == 'push' || github.event.inputs.enable-unit-tests == 'true' }}
with:
custom-job-label: Standard
enable-unit-tests: true

e2e-tests:
name: E2E Tests
uses: ./.github/workflows/zxc-compile-code.yaml
if: ${{ github.event_name == 'push' || github.event.inputs.enable-e2e-tests == 'true' }}
with:
custom-job-label: Standard
enable-e2e-tests: true

analyze:
name: Analyze
uses: ./.github/workflows/zxc-code-analysis.yaml
needs:
- unit-tests
- e2e-tests
if: ${{ (github.event_name == 'push' || github.event.inputs.enable-unit-tests == 'true' || github.event.inputs.enable-e2e-tests == 'true') && !failure() && !cancelled() }}
with:
custom-job-label: Source Code
#enable-snyk-scan: ${{ github.event_name == 'push' || github.event.inputs.enable-snyk-scan == 'true' }}
enable-codecov-analysis: true
enable-codacy-coverage: true
enable-e2e-coverage-report: ${{ github.event_name == 'push' || github.event.inputs.enable-e2e-tests == 'true' }}
secrets:
snyk-token: ${{ secrets.SNYK_TOKEN }}
codecov-token: ${{ secrets.CODECOV_TOKEN }}
codacy-project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
105 changes: 105 additions & 0 deletions .github/workflows/flow-pull-request-checks.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
##
# 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

code-style:
name: Code Style
uses: ./.github/workflows/zxc-compile-code.yaml
needs:
- build
with:
custom-job-label: Check
enable-code-style-check: true

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

e2e-tests:
name: E2E Tests
uses: ./.github/workflows/zxc-compile-code.yaml
needs:
- code-style
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
enable-e2e-coverage-report: true
secrets:
codecov-token: ${{ secrets.CODECOV_TOKEN }}

codacy-coverage:
name: Codacy
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: Coverage
enable-codacy-coverage: true
enable-e2e-coverage-report: true
secrets:
codacy-project-token: ${{ secrets.CODACY_PROJECT_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 }}
47 changes: 47 additions & 0 deletions .github/workflows/flow-pull-request-formatting.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
##
# 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:
contents: read
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 }}
Loading