Skip to content

Commit

Permalink
Merge pull request #13 from paul-gilber/github-workflows
Browse files Browse the repository at this point in the history
added github workflows
  • Loading branch information
paul-gilber authored Nov 3, 2023
2 parents 9606446 + 642d2a6 commit 08bb5eb
Show file tree
Hide file tree
Showing 40 changed files with 1,330 additions and 71 deletions.
47 changes: 0 additions & 47 deletions .devcontainer/compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ networks:
# Service top-level element reference: https://docs.docker.com/compose/compose-file/05-services/
services:
devcontainer:
depends_on:
demoapp-backend:
condition: service_healthy
image: mcr.microsoft.com/devcontainers/base:bullseye
environment:
# Enable Docker BuildKit https://docs.docker.com/build/buildkit/
Expand All @@ -24,50 +21,6 @@ services:
# Red Hat runtime image already exposes port 8080, thus `expose` keyword can be omitted
# expose:
# - "8080"
networks:
- backend # Connect to `backend` network
- frontend # Connect to `frontend` network
demoapp-backend:
depends_on:
mysql:
condition: service_healthy # healthy status is indicated by `healthcheck` keyword
image: ${DEMOAPP_BACKEND_IMAGE} # defined in .env file
environment:
# Externalized Spring Configuration: https://docs.spring.io/spring-boot/docs/1.5.6.RELEASE/reference/html/boot-features-external-config.html
SPRING_DATASOURCE_USERNAME: root
SPRING_DATASOURCE_PASSWORD: ${MYSQL_ROOT_PASSWORD} # defined in .env file
healthcheck:
# Check Spring Boot Actuator
test: curl --fail http://demoapp-backend:8080/actuator/health # command for testing health
# Specifying durations: https://docs.docker.com/compose/compose-file/11-extension/#specifying-durations
interval: 5s # specifies the time duration or interval in which the healthcheck process will execute
timeout: 1s # defines the time duration to wait for a healthcheck
retries: 10 # is used to define the number of tries to implement the health check after failure
networks:
- backend # Connect to `backend` network
- frontend # Connect to `frontend` network
restart: always
mysql: # Service name is also used as hostname when connecting from other containers
image: mysql:8.0 # https://hub.docker.com/_/mysql
environment:
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD} # defined in .env file
MYSQL_DATABASE: ${MYSQL_DATABASE} # defined in .env file
MYSQL_USER: ${MYSQL_USER} # defined in .env file
MYSQL_PASSWORD: ${MYSQL_PASSWORD} # defined in .env file
healthcheck:
# Login to mysql demoapp db
test: mysql --host=localhost --user=root --password=$$MYSQL_ROOT_PASSWORD demoapp # command for testing health
# Specifying durations: https://docs.docker.com/compose/compose-file/11-extension/#specifying-durations
interval: 5s # specifies the time duration or interval in which the healthcheck process will execute
timeout: 1s # defines the time duration to wait for a healthcheck
retries: 10 # is used to define the number of tries to implement the health check after failure
restart: unless-stopped
volumes:
- type: volume
source: mysql-data
target: /var/lib/mysql
networks:
- backend # Connect to `backend` network

# Volumes top-level element reference: https://docs.docker.com/compose/compose-file/07-volumes/
volumes:
Expand Down
2 changes: 2 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
# Default environment configuration when application is started inside devcontainer
REACT_APP_DEMOAPP_BACKEND_URL=http://localhost:8080
HOST=0.0.0.0
PORT=8080
38 changes: 38 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: 'bug'
assignees: ''

---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Desktop (please complete the following information):**
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]

**Smartphone (please complete the following information):**
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]

**Additional context**
Add any other context about the problem here.
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: 'enhancement'
assignees: ''

---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
9 changes: 9 additions & 0 deletions .github/actions/container-structure-test/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM alpine:3.18

# Get VERSION from: https://github.com/GoogleContainerTools/container-structure-test/releases
ARG VERSION=latest

RUN apk add --no-cache curl

# Get command from: https://github.com/GoogleContainerTools/container-structure-test#linux
RUN curl -LO https://storage.googleapis.com/container-structure-test/${VERSION}/container-structure-test-linux-amd64 && chmod +x container-structure-test-linux-amd64 && mv container-structure-test-linux-amd64 /usr/local/bin/container-structure-test
25 changes: 25 additions & 0 deletions .github/actions/container-structure-test/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
name: Container Structure Tests
description: |
Container Structure Tests provide a powerful framework to validate the structure of a container image.
These tests can be used to check the output of commands in an image, as well as verify metadata and contents of the filesystem.
See https://github.com/GoogleContainerTools/container-structure-test
Note: This action does not pull remote images
inputs:
image:
description: Container Image to test
required: true
configFile:
description: Path to Container Structure Test Configuration File
required: false
default: default-container-structure-test.yaml
runs:
using: docker
image: Dockerfile
args:
- container-structure-test
- test
- --image
- ${{ inputs.image }}
- --config
- ${{ inputs.configFile }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
# Run command:
# > container-structure-test test --image demoapp-frontend --config container-structure-test.yaml
schemaVersion: 2.0.0

metadataTest:
user: ''

fileExistenceTests:
- name: Check Container structure test is installed
path: /usr/local/bin/container-structure-test
shouldExist: true
permissions: -rwxr-xr-x
uid: 0
gid: 0
67 changes: 67 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
---
# actions/labeler configuration: https://github.com/marketplace/actions/labeler

# Default GitHub Labels: https://docs.github.com/en/issues/using-labels-and-milestones-to-track-work/managing-labels#about-default-labels

# Add `documentation` label
documentation:
# to any changes of markdown files on any folder or subfolders
- '**/*.md'
# to any changes within docs folder
- docs/**

# Add `javascript` label
javascript:
# to any changes within `src` folder
- src/**
# to any changes within `public` folder
- public/**

# Add `dependencies` label
dependencies:
- package.json
- package-lock.json


# Add `container` label
container:
# to any changes of any Containerfile within this repository
- '**/Containerfile*'
# to any changes of any Dockerfile within this repository
- '**/Dockerfile*'
# to any chages to container-structure-test.yaml file
- container-structure-test.yaml
# to any chages to compose.yaml or compose.yml file
- compose.yaml
- compose.yml

# Add `devcontainer` label
devcontainer:
# to any changes within .devcontainer folder
- .devcontainer/**

# Add `github-workflow` label
github-workflow:
# to any changes within .github folder
- .github/**

# Add `vscode-settings` label
vscode-settings:
# to any changes within .vscode folder
- .vscode/**

# Add `git-config` label
git-config:
# to any changes within .git folder
- .git/**
# to any changes to .gitattributes file
- .gitattributes
# to any changes to .gitignore file
- .gitignore
# to any changes within .githooks folder
- .githooks/**

# Add `lint` label
lint:
# to any changes to files, folders and subfolders with `lint` keyword
- '**lint**'
15 changes: 15 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!--
Creating a pull request template for your repository
https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/creating-a-pull-request-template-for-your-repository
-->
Brief description of why this PR is necessary and/or what this PR solves.

- Fixes [ISSUE #1]
- Fixes [ISSUE #2]

Checklist:
* [ ] The title of this PR states what changed and the related issues number (used for the release note).
* [ ] The description of this PR includes a brief description of why this PR is necessary and/or what this PR solves.
* [ ] The description of this PR includes "Fixes [ISSUE #]" to automatically close associated issues.
* [ ] The changes in this PR are accompanied by documentation.
* [ ] The changes in this PR include unit and/or e2e tests. PRs without these are unlikely to be merged.
45 changes: 45 additions & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
---
# Configuration for .github/workflows/release-drafter.yml

name-template: 'v$RESOLVED_VERSION 📢'
tag-template: 'v$RESOLVED_VERSION'
categories:
- title: '🚀 Features'
labels:
- 'feature'
- 'enhancement'
- title: '🐛 Bug Fixes'
labels:
- 'fix'
- 'bugfix'
- 'bug'
- title: '🧰 Maintenance'
# label: 'chore'
labels:
- documentation # label from .github/labeler.yml
change-template: '- $TITLE @$AUTHOR (#$NUMBER)'
change-title-escapes: '\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks.
version-resolver:
major:
labels:
- 'major'
- java # label from .github/labeler.yml
minor:
labels:
- 'minor'
- dependencies # label from .github/labeler.yml
- npm # label from .github/labeler.yml
- gradle # label from .github/labeler.yml
patch:
labels:
- 'patch'
default: patch
template: |
## Changes
$CHANGES
## Install from the command line
```sh
DEMOAPP_BACKEND_IMAGE="ghcr.io/$OWNER/$REPOSITORY:v$RESOLVED_VERSION" docker compose --project-directory deploy/docker-compose up
```
41 changes: 41 additions & 0 deletions .github/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
---
# Setup automatically generated release notes
# https://docs.github.com/en/repositories/releasing-projects-on-github/automatically-generated-release-notes#configuring-automatically-generated-release-notes

changelog:
exclude:
labels:
- ignore-for-release
categories:
- title: Breaking Changes 🛠
labels:
- Semver-Major
- breaking-change
- title: Exciting New Features 🎉
labels:
- Semver-Minor
- enhancement
- title: Documentation Improvements
labels:
- documentation
- title: Java Changes
labels:
- java
- title: Dependency Changes
labels:
- dependencies
- npm
- gradle
- title: Container Changes
labels:
- container
- title: Local Development Changes
labels:
- devcontainer
- vscode-settings
- title: Workflow Changes
labels:
- github-workflow
- title: Other Changes
labels:
- "*"
Loading

0 comments on commit 08bb5eb

Please sign in to comment.