chore: repo clean up
This commit is contained in:
@@ -1,33 +0,0 @@
|
||||
---
|
||||
name: Bug
|
||||
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.
|
||||
|
||||
## Expected Behaviour
|
||||
A clear and concise description of what you expected to happen.
|
||||
|
||||
## Actual Behaviour
|
||||
A clear and concise description of what you expected to happen.
|
||||
|
||||
## Steps To Reproduce
|
||||
|
||||
1. Go to '...'
|
||||
2. Click on '....'
|
||||
3. Scroll down to '....'
|
||||
4. See error
|
||||
|
||||
## Screenshots
|
||||
If applicable, add screenshots to help explain your problem.
|
||||
|
||||
## Additional information
|
||||
|
||||
- **OS:** [MacOS, Windows, Linux]
|
||||
- **Browser:** [Chrome, Safari, Firefox]
|
||||
- **Extra info:** Add any other context about the problem here.
|
||||
@@ -1,28 +0,0 @@
|
||||
---
|
||||
name: Enhancement
|
||||
about: Work for the team that cannot be written as a user story
|
||||
title: ''
|
||||
labels: enhancement
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
## Brief description
|
||||
|
||||
A clear and concise description of what the task is.
|
||||
|
||||
## User Story
|
||||
|
||||
As a user, I want...
|
||||
|
||||
## Acceptance Criteria
|
||||
|
||||
- [ ] One..
|
||||
- [ ] Two..
|
||||
- [ ] Tests passing
|
||||
- [ ] PR merged
|
||||
|
||||
## Additional context
|
||||
|
||||
- Add any other context about the task here.
|
||||
- Or here
|
||||
@@ -1,15 +0,0 @@
|
||||
version: 2
|
||||
updates:
|
||||
- package-ecosystem: "npm"
|
||||
directory: "/client"
|
||||
schedule:
|
||||
interval: "weekly"
|
||||
- package-ecosystem: "maven"
|
||||
directory: "/server"
|
||||
schedule:
|
||||
interval: "weekly"
|
||||
- package-ecosystem: "github-actions"
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: "weekly"
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
# Description
|
||||
Closes #issue
|
||||
|
||||
## Time Spent
|
||||
|
||||
- [ ] Just a couple of minutes
|
||||
- [ ] Around XX:XX (hours and minutes)
|
||||
|
||||
## Tests
|
||||
- [ ] 🧠 Not needed
|
||||
- [ ] 👀 Eyeball
|
||||
- [ ] 🤖 Added tests
|
||||
- [ ] 💻 Build, tests, and lint are passing locally
|
||||
|
||||
## Additional Notes
|
||||
|
||||
Add here, if any
|
||||
|
||||
### What gif/image best describes this PR or how it makes you feel?
|
||||
<!-- GIFs For Github Chrome Extension https://chromewebstore.google.com/detail/gifs-for-github/dkgjnpbipbdaoaadbdhpiokaemhlphep consider using width="200" in the img tag -->
|
||||
@@ -1,4 +1,4 @@
|
||||
name: Main Tasknote-web
|
||||
name: Build and Push App Docker Image
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
@@ -17,157 +17,56 @@ on:
|
||||
- 'client/Caddyfile'
|
||||
|
||||
jobs:
|
||||
tasknote-web-code-checks:
|
||||
name: Tasknote-web Code Checks
|
||||
build-and-push:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v5
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
fetch-depth: 0
|
||||
ref: ${{ github.event.pull_request.head.ref }}
|
||||
|
||||
- name: Set up Node
|
||||
uses: actions/setup-node@v6
|
||||
with:
|
||||
node-version: '22'
|
||||
- name: Clean and Install
|
||||
run: cd client && npm ci
|
||||
- name: Build
|
||||
run: cd client && npm run build
|
||||
- name: Lint
|
||||
run: cd client && npm run lint
|
||||
- name: Unit tests
|
||||
run: cd client && npm run test:coverage
|
||||
- name: SonarQube Scan
|
||||
uses: SonarSource/sonarqube-scan-action@v6.0.0
|
||||
with:
|
||||
projectBaseDir: client
|
||||
args: >
|
||||
-Dsonar.organization=ricardo-campos-org
|
||||
-Dsonar.projectKey=ricardo-campos-org_react-typescript-todolist_client
|
||||
-Dsonar.javascript.lcov.reportPaths=coverage/lcov.info
|
||||
-Dsonar.typescript.tsconfigPaths=tsconfig.json
|
||||
-Dsonar.sources=src/
|
||||
-Dsonar.exclusions=src/__test__/**
|
||||
-Dsonar.tests=src/__test__/
|
||||
-Dsonar.verbose=false
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
|
||||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
||||
|
||||
image-promotion-and-deploy:
|
||||
name: Image promotion and deployment
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
DEPLOY_DOMAIN: ${{ vars.DEPLOY_DOMAIN }}
|
||||
GHCR_USERNAME: ${{ vars.GHCR_USERNAME }}
|
||||
GHCR_PASSWORD: ${{ secrets.GHCR_PASSWORD }}
|
||||
API_KEY: ${{ secrets.DOKPLOY_API_KEY }}
|
||||
CLIENT_APPID: ${{ secrets.PROD_WEB_CLIENT_ID }}
|
||||
steps:
|
||||
- uses: docker/login-action@v3
|
||||
name: Login to GitHub Container Registry
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Pull image with source tag
|
||||
run: docker pull ghcr.io/ricardo-campos-org/react-typescript-todolist/tasknote-web:candidate
|
||||
|
||||
- name: Extract PR number using docker inspect
|
||||
id: inspect
|
||||
- name: Generate version tag
|
||||
id: version
|
||||
run: |
|
||||
SOURCE_PR=$(docker inspect ghcr.io/ricardo-campos-org/react-typescript-todolist/tasknote-web:candidate | jq -r '.[0].Config.Env[] | select(startswith("SOURCE_PR="))' | sed -n 's/SOURCE_PR=\(v[0-9]*\).*/\1/p')
|
||||
echo "SOURCE_PR=$SOURCE_PR" >> $GITHUB_ENV
|
||||
echo "source_pr=$SOURCE_PR" >> $GITHUB_OUTPUT
|
||||
DATE=$(date +'%Y.%m.%d')
|
||||
TAG="app-v${DATE}.${{ github.run_number }}"
|
||||
echo "tag=${TAG}" >> $GITHUB_OUTPUT
|
||||
echo "Generated tag: ${TAG}"
|
||||
|
||||
- name: Re-tag the image
|
||||
run: |
|
||||
docker tag ghcr.io/ricardo-campos-org/react-typescript-todolist/tasknote-web:candidate ghcr.io/ricardo-campos-org/react-typescript-todolist/tasknote-web:prod-${{ steps.inspect.outputs.source_pr }}
|
||||
docker tag ghcr.io/ricardo-campos-org/react-typescript-todolist/tasknote-web:candidate ghcr.io/ricardo-campos-org/react-typescript-todolist/tasknote-web:latest
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Push new tag
|
||||
run: docker push --all-tags ghcr.io/ricardo-campos-org/react-typescript-todolist/tasknote-web
|
||||
|
||||
- name: Checking cURL version
|
||||
run: curl --version
|
||||
|
||||
- name: Update image tag to be deployed
|
||||
uses: nick-fields/retry@v3.0.2
|
||||
- name: Log in to Docker Hub
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
timeout_minutes: 2
|
||||
max_attempts: 3
|
||||
command: |
|
||||
response=$(curl -X POST \
|
||||
"${DEPLOY_DOMAIN}/api/application.saveDockerProvider" \
|
||||
--max-time 30 \
|
||||
-H "accept: application/json" \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "x-api-key: ${API_KEY}" \
|
||||
-d '{
|
||||
"dockerImage": "ghcr.io/ricardo-campos-org/react-typescript-todolist/tasknote-web:prod-${{ steps.inspect.outputs.source_pr }}",
|
||||
"applicationId": "'"${CLIENT_APPID}"'",
|
||||
"username": "'"${GHCR_USERNAME}"'",
|
||||
"password": "'"${GHCR_PASSWORD}"'",
|
||||
"registryUrl": "ghcr.io"
|
||||
}' \
|
||||
-w "\n%{http_code}" \
|
||||
-s)
|
||||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
|
||||
status_code=$(echo "$response" | tail -n1)
|
||||
echo "Status code: $status_code"
|
||||
|
||||
if [ "$status_code" != "200" ]; then
|
||||
body=$(echo "$response" | sed '$d')
|
||||
|
||||
echo "Update failed with status code $status_code"
|
||||
echo -e "Response body: $body"
|
||||
exit 1
|
||||
else
|
||||
echo "Updated succeeded!"
|
||||
fi
|
||||
|
||||
- name: Trigger Deployment
|
||||
uses: nick-fields/retry@v3.0.2
|
||||
- name: Extract metadata for Docker
|
||||
id: meta
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
timeout_minutes: 2
|
||||
max_attempts: 3
|
||||
command: |
|
||||
sleep 15
|
||||
images: ${{ secrets.DOCKER_USERNAME }}/tasknote
|
||||
tags: |
|
||||
type=raw,value=${{ steps.version.outputs.tag }}
|
||||
type=raw,value=app-latest,enable={{is_default_branch}}
|
||||
|
||||
response=$(curl -X POST \
|
||||
"${DEPLOY_DOMAIN}/api/application.deploy" \
|
||||
--max-time 30 \
|
||||
-H "accept: application/json" \
|
||||
-H "x-api-key: ${API_KEY}" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "{\"applicationId\":\"${CLIENT_APPID}\"}" \
|
||||
-w "\n%{http_code}" \
|
||||
-s)
|
||||
- name: Build and push Docker image
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: ./app
|
||||
push: true
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
|
||||
status_code=$(echo "$response" | tail -n1)
|
||||
echo "Status code: $status_code"
|
||||
|
||||
if [ "$status_code" != "200" ]; then
|
||||
body=$(echo "$response" | sed '$d')
|
||||
|
||||
echo "Deployment failed with status code $status_code"
|
||||
echo -e "Response body: $body"
|
||||
exit 1
|
||||
else
|
||||
echo "Deployment succeeded!"
|
||||
fi
|
||||
|
||||
- name: Verifying post deployment
|
||||
- name: Create and push Git tag
|
||||
run: |
|
||||
# Wait for deployment to complete
|
||||
sleep 15
|
||||
|
||||
if ! curl -s -f "${{ vars.CLIENT_PROD_URL }}/" > /dev/null; then
|
||||
echo "Prod environment is not healthy"
|
||||
exit 1
|
||||
else
|
||||
echo "Prod environment is healthy"
|
||||
fi
|
||||
git config user.name "github-actions[bot]"
|
||||
git config user.email "github-actions[bot]@users.noreply.github.com"
|
||||
git tag -a ${{ steps.version.outputs.tag }} -m "Release ${{ steps.version.outputs.tag }}"
|
||||
git push origin ${{ steps.version.outputs.tag }}
|
||||
|
||||
@@ -1,149 +0,0 @@
|
||||
name: PR Tasknote-web
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
paths:
|
||||
- 'client/**'
|
||||
|
||||
concurrency:
|
||||
group: tasknote-web-${{ github.event.number }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
tasknote-web-code-checks:
|
||||
name: Tasknote-web Code Checks
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- uses: actions/setup-node@v6
|
||||
name: Set up Node
|
||||
with:
|
||||
node-version: '22'
|
||||
- name: Clean and Install
|
||||
run: cd client && npm ci
|
||||
- name: Build
|
||||
run: cd client && npm run build
|
||||
- name: Lint
|
||||
run: cd client && npm run lint
|
||||
- name: Unit tests
|
||||
run: cd client && npm run test:coverage
|
||||
- name: SonarCloud Scan
|
||||
uses: SonarSource/sonarqube-scan-action@v6.0.0
|
||||
with:
|
||||
projectBaseDir: client
|
||||
args: >
|
||||
-Dsonar.organization=ricardo-campos-org
|
||||
-Dsonar.projectKey=ricardo-campos-org_react-typescript-todolist_client
|
||||
-Dsonar.javascript.lcov.reportPaths=coverage/lcov.info
|
||||
-Dsonar.typescript.tsconfigPaths=tsconfig.json
|
||||
-Dsonar.sources=src/
|
||||
-Dsonar.exclusions=src/__test__/**
|
||||
-Dsonar.tests=src/__test__/
|
||||
-Dsonar.verbose=false
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
||||
|
||||
tasknote-web-docker-build:
|
||||
name: Build Tasknote-web Docker image
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
runs-on: ubuntu-latest
|
||||
needs: tasknote-web-code-checks
|
||||
env:
|
||||
VITE_BUILD: tasknote-web:${{ github.event.number }}
|
||||
VITE_BACKEND_SERVER: ${{ secrets.SERVER_ADDRESS }}/server
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- uses: docker/setup-buildx-action@v3
|
||||
name: Set up Docker Buildx
|
||||
|
||||
- uses: docker/login-action@v3
|
||||
name: Login to GitHub Container Registry
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Get current date
|
||||
id: date
|
||||
run: echo "date=$(date +'%Y-%m-%d-%H%M%S')" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
push: true
|
||||
context: ./client
|
||||
tags: ghcr.io/ricardo-campos-org/react-typescript-todolist/tasknote-web:candidate
|
||||
build-args: |
|
||||
VITE_BUILD=v${{ github.event.number }}-${{ steps.date.outputs.date }}
|
||||
SOURCE_PR=v${{ github.event.number }}-${{ github.run_id }}-${{ steps.date.outputs.date }}
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
|
||||
tasknote-web-stage-deployments:
|
||||
name: Deploy Changes to Stage
|
||||
runs-on: ubuntu-latest
|
||||
needs: tasknote-web-docker-build
|
||||
if: github.event.pull_request.user.login == 'rmcampos' && github.event_name == 'pull_request'
|
||||
env:
|
||||
DEPLOY_DOMAIN: ${{ vars.DEPLOY_DOMAIN }}
|
||||
API_KEY: ${{ secrets.DOKPLOY_API_KEY }}
|
||||
CLIENT_APPID: ${{ secrets.STAGE_WEB_CLIENT_ID }}
|
||||
steps:
|
||||
- name: Checking cURL version
|
||||
run: curl --version
|
||||
|
||||
- name: Pre-deployment check
|
||||
run: |
|
||||
if ! curl -s -f "${{ vars.CLIENT_STAGE_URL }}" > /dev/null; then
|
||||
echo "Stage environment is not healthy"
|
||||
else
|
||||
echo "Stage environment is healthy"
|
||||
fi
|
||||
|
||||
- name: Trigger Deployment
|
||||
uses: nick-fields/retry@v3.0.2
|
||||
with:
|
||||
timeout_minutes: 2
|
||||
max_attempts: 3
|
||||
command: |
|
||||
response=$(curl -X POST \
|
||||
"${DEPLOY_DOMAIN}/api/application.deploy" \
|
||||
--max-time 30 \
|
||||
-H "accept: application/json" \
|
||||
-H "x-api-key: ${API_KEY}" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "{\"applicationId\":\"${CLIENT_APPID}\"}" \
|
||||
-w "\n%{http_code}" \
|
||||
-s)
|
||||
|
||||
status_code=$(echo "$response" | tail -n1)
|
||||
echo "Status code: $status_code"
|
||||
|
||||
if [ "$status_code" != "200" ]; then
|
||||
body=$(echo "$response" | sed '$d')
|
||||
|
||||
echo "Deployment failed with status code $status_code"
|
||||
echo -e "Response body: $body"
|
||||
exit 1
|
||||
else
|
||||
echo "Deployment succeeded!"
|
||||
fi
|
||||
|
||||
- name: Verifying post deployment
|
||||
run: |
|
||||
# Wait for deployment to complete
|
||||
sleep 15
|
||||
|
||||
if ! curl -s -f "${{ vars.CLIENT_STAGE_URL }}" > /dev/null; then
|
||||
echo "Stage environment is not healthy"
|
||||
exit 1
|
||||
else
|
||||
echo "Stage environment is healthy"
|
||||
fi
|
||||
Reference in New Issue
Block a user