-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into logo-feature
- Loading branch information
Showing
4 changed files
with
158 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
name: CI Workflow | ||
|
||
on: | ||
push: | ||
branches: | ||
- '**' | ||
pull_request: | ||
branches: | ||
- '**' | ||
|
||
jobs: | ||
setup_and_test: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
node-version: ['18.x', '20.x'] | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Set up Node.js | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
cache: 'yarn' | ||
|
||
- name: Check Node.js version | ||
run: node -v | ||
|
||
- name: Install dependencies | ||
run: yarn install --frozen-lockfile | ||
|
||
- name: Lint code | ||
run: yarn lint:all | ||
|
||
- name: Build projects | ||
run: yarn build:all | ||
|
||
- name: Test projects | ||
run: yarn test:all | ||
|
||
validate_commit_messages: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
- name: Ensure full git history | ||
run: | | ||
if [ -f $(git rev-parse --git-dir)/shallow ]; then | ||
git fetch --prune --unshallow | ||
else | ||
git fetch --prune origin | ||
fi | ||
- name: Validate Commit Messages | ||
run: | | ||
commit_messages=$(git log --format=%B origin/main..HEAD) | ||
echo "Checking commit messages: $commit_messages" | ||
IFS=$'\n' | ||
for message in $commit_messages; do | ||
if [[ "$message" =~ ^Merge ]]; then | ||
echo "Skipping merge commit: $message" | ||
elif ! echo "$message" | grep -Pq '^(ADD:|FIX:|DEL:|UPD:) .+'; then | ||
echo "Invalid commit message: '$message'" | ||
echo "Commit messages must start with ADD:, FIX:, DEL:, or UPD:" | ||
exit 1 | ||
fi | ||
done | ||
echo "All commit messages adhere to the format." | ||
validate_branch_names: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Validate Branch Names | ||
run: | | ||
if [ "${{ github.event_name }}" == "pull_request" ]; then | ||
if [ -z "${{ github.head_ref }}" ]; then | ||
branch_name=$(echo $GITHUB_REF | sed -n 's/refs\/heads\/\([^/]*\)/\1/p') | ||
echo "Extracted branch name from ref: $branch_name" | ||
else | ||
branch_name=${{ github.head_ref }} | ||
echo "Running in a fork pull request with branch: $branch_name" | ||
fi | ||
else | ||
branch_name=$(git rev-parse --abbrev-ref HEAD) | ||
echo "Current branch: $branch_name" | ||
fi | ||
if ! echo "$branch_name" | grep -Eq '^(main|feature/.+|hotfix/.+)$'; then | ||
echo "Error: Branch name $branch_name does not fit the naming convention." | ||
exit 1 | ||
fi | ||
echo "Branch name fits the naming convention." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
apiVersion: scaffolder.backstage.io/v1beta3 | ||
# https://backstage.io/docs/features/software-catalog/descriptor-format#kind-template | ||
kind: Template | ||
metadata: | ||
name: GKE-cluster | ||
title: Initiate Deployment. | ||
description: Deploy application to google cloud for the first time or update an existing deployment. | ||
spec: | ||
owner: user:guest | ||
type: service | ||
|
||
# These parameters are used to generate the input form in the frontend, and are | ||
# used to gather input data for the execution of the template. | ||
parameters: | ||
- title: Public github repo link to deploy | ||
required: | ||
- repoUrl | ||
properties: | ||
repoUrl: | ||
title: Public github Repo to deploy | ||
description: Provide the github repository link in the following format <https://github.com/your_user_name/your_repository_name> | ||
pattern: ^https:\/\/github\.com\/[a-zA-Z0-9_-]+\/[a-zA-Z0-9_-] | ||
type: string | ||
ui:options: | ||
allowedHosts: | ||
- github.com | ||
action: | ||
title: Action | ||
default: create | ||
# Note changing these paramters will lead to not triggering the github actions, it must be create or update. | ||
description: Action to perform (create new deployment for application/Update for updating an already deployed application) | ||
enum: | ||
- create | ||
- update | ||
|
||
# These steps are executed in the scaffolder backend, using data that we gathered | ||
# via the parameters above. | ||
steps: | ||
# Start a github Action to build a GKE cluster with Terraform | ||
- id: github-action | ||
name: Trigger Github Action | ||
action: github:actions:dispatch | ||
input: | ||
workflowId: ${{parameters.action}}-image.yml | ||
repoUrl: 'github.com?repo=idp-hosted-projects&owner=codeuniversity' | ||
branchOrTagName: 'main' | ||
workflowInputs: | ||
githubRepo: ${{ parameters.repoUrl }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters