Skip to content

chore: Added todos

chore: Added todos #43

Workflow file for this run

name: CI Pipeline
on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main, develop ]
workflow_dispatch:
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
defaults:
run:
shell: bash --noprofile --norc -eo pipefail {0}
jobs:
# Linting job using Docker Bake
lint:
name: Lint
runs-on: ubuntu-latest
permissions:
contents: read
packages: read
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Cache Docker layers - Lint
uses: actions/cache@v4
with:
path: .cache/lint
key: ${{ runner.os }}-docker-cache-lint-${{ hashFiles('**/Dockerfile', '**/docker-bake.hcl', 'go.mod', 'go.sum') }}
restore-keys: |
${{ runner.os }}-docker-cache-lint-
${{ runner.os }}-docker-cache-
- name: Run linting with Docker Bake
run: |
set -euo pipefail
docker buildx bake \
--set "*.cache-from=type=local,src=.cache/lint" \
--set "*.cache-to=type=local,dest=.cache/lint" \
lint
# Testing job using Docker Bake
test:
name: Test
runs-on: ubuntu-latest
permissions:
contents: read
packages: read
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Cache Docker layers - Test
uses: actions/cache@v4
with:
path: .cache/test
key: ${{ runner.os }}-docker-cache-test-${{ hashFiles('**/Dockerfile', '**/docker-bake.hcl', 'go.mod', 'go.sum') }}
restore-keys: |
${{ runner.os }}-docker-cache-test-
${{ runner.os }}-docker-cache-
- name: Run tests with Docker Bake
run: |
set -euo pipefail
docker buildx bake \
--set "*.cache-from=type=local,src=.cache/test" \
--set "*.cache-to=type=local,dest=.cache/test" \
test
- name: Upload coverage reports
uses: actions/upload-artifact@v4
if: always()
with:
name: coverage-reports
path: |
coverage.out
coverage.html
# Build job using Docker Bake
build:
name: Build
runs-on: ubuntu-latest
needs: [lint, test]
permissions:
contents: read
packages: read
env:
VERSION: ${{ github.sha }}
COMMIT: ${{ github.sha }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Cache Docker layers - Build
uses: actions/cache@v4
with:
path: .cache/build
key: ${{ runner.os }}-docker-cache-build-${{ hashFiles('**/Dockerfile', '**/docker-bake.hcl', 'go.mod', 'go.sum') }}
restore-keys: |
${{ runner.os }}-docker-cache-build-
${{ runner.os }}-docker-cache-
- name: Build with Docker Bake
run: |
set -euo pipefail
BUILD_TIME="$(date -u +%Y-%m-%dT%H:%M:%SZ)"
docker buildx bake \
--set "*.cache-from=type=local,src=.cache/build" \
--set "*.cache-to=type=local,dest=.cache/build" \
--set "*.args.VERSION=${VERSION}" \
--set "*.args.COMMIT=${COMMIT}" \
--set "*.args.BUILD_TIME=${BUILD_TIME}" \
build
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: binaries
path: bin/