Skip to content
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
42 changes: 18 additions & 24 deletions .github/workflows/code-coverage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,37 +3,31 @@ name: code-coverage
on:
workflow_dispatch:
push:
branches: [ main ]
branches: [main]
pull_request:
branches: [ main ]
branches: [main]

permissions:
contents: read

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Use Node.js 24
uses: actions/setup-node@v4
with:
node-version: 24

- name: Install Dependencies
run: npm install pnpm -g && pnpm install

- name: Build
run: pnpm build

- name: Testing
run: pnpm test

- name: Code Coverage
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage/lcov.info

- uses: actions/checkout@v5
- uses: pnpm/action-setup@v4
with:
version: 10
- uses: actions/setup-node@v5
with:
node-version: 24
cache: 'pnpm'
- run: pnpm install --frozen-lockfile
- run: pnpm build
- run: pnpm test
- name: Code Coverage
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage/lcov.info
66 changes: 16 additions & 50 deletions .github/workflows/codeql.yaml
Original file line number Diff line number Diff line change
@@ -1,22 +1,10 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "codeql"
name: codeql

on:
push:
branches: [ "main" ]
branches: ["main"]
pull_request:
# The branches below must be a subset of the branches above
branches: [ "main" ]
branches: ["main"]

jobs:
analyze:
Expand All @@ -30,43 +18,21 @@ jobs:
strategy:
fail-fast: false
matrix:
language: [ 'javascript' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
language: ['javascript']

steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Checkout repository
uses: actions/checkout@v5

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}

# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality
- name: Autobuild
uses: github/codeql-action/autobuild@v3


# Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2

# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun

# If the Autobuild fails above, remove it and uncomment the following three lines.
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.

# - run: |
# echo "Run, Build Application using script"
# ./location_of_script_within_repo/buildscript.sh

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
with:
category: "/language:${{matrix.language}}"
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
with:
category: "/language:${{ matrix.language }}"
78 changes: 49 additions & 29 deletions .github/workflows/deploy-site.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: deploy-site
on:
workflow_dispatch:
release:
types: [ released ]
types: [released]

permissions:
contents: read
Expand All @@ -13,37 +13,64 @@ env:
SERVICE_NAME: mockhttp

jobs:
setup-build-deploy:
name: Setup and Deploy to Prod
test:
name: Test
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

# Setup Node
- name: Use Node.js
uses: actions/setup-node@v4
- uses: actions/checkout@v5
- uses: pnpm/action-setup@v4
with:
version: 10
- uses: actions/setup-node@v5
with:
node-version: 24
cache: 'pnpm'
- run: pnpm install --frozen-lockfile
- run: pnpm test:ci

# DO NOT USE pnpm here, it will cause issues with Docker build
- name: Install Dependencies
run: npm install -g pnpm && pnpm install
build:
name: Build
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: pnpm/action-setup@v4
with:
version: 10
- uses: actions/setup-node@v5
with:
node-version: 24
cache: 'pnpm'
- run: pnpm install --frozen-lockfile
- run: pnpm build
- uses: actions/upload-artifact@v4
with:
name: dist
path: dist/
if-no-files-found: error
retention-days: 1

deploy:
name: Deploy to Production
needs: build
runs-on: ubuntu-latest
environment: production
steps:
- uses: actions/checkout@v5

- name: Build
run: pnpm build
- uses: actions/download-artifact@v4
with:
name: dist
path: dist/

# Setup gcloud CLI
- name: Authenticate with Google Cloud
uses: 'google-github-actions/auth@v2'
uses: google-github-actions/auth@v3
with:
credentials_json: ${{ secrets.GCP_SA_KEY }}

- name: 'Set up Cloud SDK'
uses: 'google-github-actions/setup-gcloud@v2'
- name: Set up Cloud SDK
uses: google-github-actions/setup-gcloud@v3

# Build and push image to Google Container Registry
- name: Docker Auth
run: gcloud auth configure-docker

Expand All @@ -54,32 +81,25 @@ jobs:
run: docker push gcr.io/$PROJECT_ID/$SERVICE_NAME:$GITHUB_SHA

- name: Make deploy-region.sh executable
run: chmod +x ./scripts/deploy-region.sh
run: chmod +x ./scripts/deploy-region.sh

# Deploy image to Cloud Run
- name: Deploy to [us-central1]
run: ./scripts/deploy-region.sh us-central1

# Deploy image to Cloud Run
- name: Deploy to [us-west1]
run: ./scripts/deploy-region.sh us-west1

# Deploy image to Cloud Run
- name: Deploy to [us-east1]
run: ./scripts/deploy-region.sh us-east1

# Deploy image to Cloud Run
- name: Deploy to [europe-west1]
run: ./scripts/deploy-region.sh europe-west1

# Deploy image to Cloud Run
- name: Deploy to [europe-west3]
run: ./scripts/deploy-region.sh europe-west3

# Deploy image to Cloud Run
- name: Deploy to [asia-northeast1]
run: ./scripts/deploy-region.sh asia-northeast1

# Deploy image to Cloud Run
- name: Deploy to [asia-southeast1]
run: ./scripts/deploy-region.sh asia-southeast1
run: ./scripts/deploy-region.sh asia-southeast1
85 changes: 63 additions & 22 deletions .github/workflows/docker-publish.yaml
Original file line number Diff line number Diff line change
@@ -1,32 +1,74 @@
name: docker-publish

on:
workflow_dispatch:
release:
types: [released]
workflow_dispatch:
release:
types: [released]

permissions:
contents: read

jobs:
build-and-push:
test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: pnpm/action-setup@v4
with:
version: 10
- uses: actions/setup-node@v5
with:
node-version: 24
cache: 'pnpm'
- run: pnpm install --frozen-lockfile
- run: pnpm test:ci

build:
name: Build
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: pnpm/action-setup@v4
with:
version: 10
- uses: actions/setup-node@v5
with:
node-version: 24
cache: 'pnpm'
- run: pnpm install --frozen-lockfile
- run: pnpm build
- uses: actions/upload-artifact@v4
with:
name: dist
path: dist/
if-no-files-found: error
retention-days: 1

publish:
name: Publish to Docker Hub
needs: build
runs-on: ubuntu-latest
environment: docker
steps:
- name: Checkout repository
uses: actions/checkout@v4
- uses: actions/checkout@v5

- name: Install Node.js
uses: actions/setup-node@v4
- uses: pnpm/action-setup@v4
with:
node-version: 24
version: 10

- name: Install pnpm
run: npm install -g pnpm && pnpm install
- uses: actions/setup-node@v5
with:
node-version: 24
cache: 'pnpm'

- run: pnpm install --frozen-lockfile

- name: Build
run: pnpm build
- uses: actions/download-artifact@v4
with:
name: dist
path: dist/

- name: Set version variable
run: |
Expand All @@ -42,21 +84,20 @@ jobs:
- name: Build Docker Image
run: docker build -t jaredwray/mockhttp:${{ env.VERSION }} -t jaredwray/mockhttp:latest .

- name: Build and push Docker image as SHA
- name: Push Docker image (version)
run: docker push docker.io/jaredwray/mockhttp:${{ env.VERSION }}

- name: Build and push Docker image as Latest
- name: Push Docker image (latest)
run: docker push docker.io/jaredwray/mockhttp:latest

- name: Build Docker Markdown
run: pnpm docker:readme

# Update Docker Hub description
- name: Update Docker Hub description
uses: peter-evans/dockerhub-description@v2
uses: peter-evans/dockerhub-description@v4
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
repository: jaredwray/mockhttp
short-description: ${{ github.event.repository.description }}
readme-filepath: ./DOCKER.md
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
repository: jaredwray/mockhttp
short-description: ${{ github.event.repository.description }}
readme-filepath: ./DOCKER.md
Loading
Loading