This repository has been archived by the owner on Jan 2, 2024. It is now read-only.
chore: deprecation notice (#21) #10
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
name: Master | |
on: | |
push: | |
branches: | |
- master | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }} | |
jobs: | |
ci: | |
name: CI | |
runs-on: ubuntu-latest | |
timeout-minutes: 10 | |
services: | |
postgres: | |
image: postgres:15 | |
ports: | |
- 5432:5432 | |
env: | |
POSTGRES_PASSWORD: password | |
POSTGRES_USER: captcha | |
POSTGRES_DB: captcha | |
options: >- | |
--health-cmd "pg_isready -U captcha -d captcha" | |
--health-interval 15s | |
--health-timeout 10s | |
--health-retries 5 | |
mysql: | |
image: mysql:8 | |
ports: | |
- 3306:3306 | |
env: | |
MYSQL_USER: captcha | |
MYSQL_PASSWORD: password | |
MYSQL_DATABASE: captcha | |
MYSQL_ROOT_PASSWORD: password | |
options: >- | |
--health-cmd "mysqladmin ping -h localhost -u captcha --password=password" | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 10 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: TruffleHog OSS | |
uses: trufflesecurity/trufflehog@main | |
with: | |
path: ./ | |
base: ${{ github.event.repository.default_branch }} | |
head: HEAD | |
extra_args: --debug --only-verified | |
- uses: actions/setup-go@v3 | |
with: | |
go-version: '>=1.20.0' | |
- name: Build | |
run: go build -buildvcs=false . | |
- name: Run test & coverage | |
run: go test -v -coverprofile=coverage.out -covermode=atomic ./... | |
env: | |
POSTGRES_URL: postgres://captcha:password@localhost:5432/captcha?sslmode=disable | |
MYSQL_URL: captcha:password@tcp(localhost:3306)/captcha?parseTime=true | |
ENVIRONMENT: development | |
TZ: UTC | |
- name: Initialize CodeQL | |
uses: github/codeql-action/init@v1 | |
with: | |
languages: go | |
- name: Perform CodeQL Analysis | |
uses: github/codeql-action/analyze@v1 | |
- uses: codecov/codecov-action@v3 | |
cd-debian: | |
name: CD - Debian | |
needs: | |
- ci | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Log in to the Container registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
flavor: | | |
latest=false | |
tags: | | |
type=edge | |
type=sha | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v3 | |
with: | |
context: . | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
cd-alpine: | |
name: CD - Alpine | |
needs: | |
- ci | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Log in to the Container registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-alpine | |
flavor: | | |
latest=false | |
tags: | | |
type=edge | |
type=sha | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v3 | |
with: | |
context: . | |
file: ./Dockerfile.alpine | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} |