chore: remove duplicate ci.yml workflow

build.yaml already handles CI/CD on self-hosted Forgejo runners
This commit is contained in:
Graham McIntire 2026-03-05 12:43:54 -06:00
parent ed4fce49a4
commit 9e6d006ff7
No known key found for this signature in database

View file

@ -1,230 +0,0 @@
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
env:
MIX_ENV: test
ELIXIR_VERSION: "1.19.5"
OTP_VERSION: "28.0"
jobs:
test:
runs-on: self-hosted
services:
postgres:
image: postgres:17-alpine
env:
POSTGRES_DB: towerops_test
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
container:
image: hexpm/elixir:1.19.5-erlang-28.0-debian-bookworm-20250113-slim
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Cache dependencies
uses: actions/cache@v4
with:
path: |
deps
_build
key: ${{ runner.os }}-mix-${{ hashFiles('**/mix.lock') }}
restore-keys: |
${{ runner.os }}-mix-
- name: Cache Hex packages
uses: actions/cache@v4
with:
path: |
~/.hex
~/.mix
key: ${{ runner.os }}-hex-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}
restore-keys: |
${{ runner.os }}-hex-
- name: Install system dependencies
run: |
apt-get update -qq
apt-get install -y -qq --no-install-recommends \
libsnmp-dev snmp-mibs-downloader build-essential git
- name: Install Hex and Rebar
run: |
mix local.hex --force
mix local.rebar --force
- name: Install dependencies
run: mix deps.get
- name: Compile (warnings as errors)
run: mix compile --warnings-as-errors
- name: Setup database
run: mix ecto.setup
env:
POSTGRES_HOST: postgres
- name: Run tests
run: mix test --warnings-as-errors --max-cases 8
env:
POSTGRES_HOST: postgres
- name: Generate coverage report
run: mix test --cover
env:
POSTGRES_HOST: postgres
quality:
runs-on: self-hosted
container:
image: hexpm/elixir:1.19.5-erlang-28.0-debian-bookworm-20250113-slim
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Cache dependencies
uses: actions/cache@v4
with:
path: |
deps
_build
key: ${{ runner.os }}-mix-${{ hashFiles('**/mix.lock') }}
restore-keys: |
${{ runner.os }}-mix-
- name: Cache Hex packages
uses: actions/cache@v4
with:
path: |
~/.hex
~/.mix
key: ${{ runner.os }}-hex-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}
restore-keys: |
${{ runner.os }}-hex-
- name: Cache Dialyzer PLT
uses: actions/cache@v4
with:
path: priv/plts
key: ${{ runner.os }}-plt-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ hashFiles('**/mix.lock') }}
restore-keys: |
${{ runner.os }}-plt-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-
- name: Install system dependencies
run: |
apt-get update -qq
apt-get install -y -qq --no-install-recommends \
libsnmp-dev snmp-mibs-downloader build-essential git
- name: Install Hex and Rebar
run: |
mix local.hex --force
mix local.rebar --force
- name: Install dependencies
run: mix deps.get
- name: Compile
run: mix compile --warnings-as-errors
- name: Check formatting
run: mix format --check-formatted
- name: Run Credo
run: mix credo --strict
- name: Run Dialyzer
run: mix dialyzer
continue-on-error: true
build:
runs-on: self-hosted
needs: test
if: github.ref == 'refs/heads/main'
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Container Registry
uses: docker/login-action@v3
with:
registry: ${{ secrets.REGISTRY_URL }}
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_PASSWORD }}
- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ secrets.REGISTRY_URL }}/graham/towerops-web
tags: |
type=ref,event=branch
type=sha,prefix={{branch}}-
type=raw,value=latest,enable={{is_default_branch}}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=registry,ref=${{ secrets.REGISTRY_URL }}/graham/towerops-web:latest
cache-to: type=inline
deploy:
runs-on: self-hosted
needs: build
if: github.ref == 'refs/heads/main'
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup kubectl
run: |
if ! command -v kubectl &> /dev/null; then
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
chmod +x kubectl
sudo mv kubectl /usr/local/bin/
fi
- name: Deploy to Kubernetes
run: |
kubectl config use-context towerops/towerops:home-cluster-agent
DEPLOY_TIMESTAMP=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
IMAGE_SHA=$(echo "${{ github.sha }}" | cut -c1-7)
IMAGE_TAG="${{ secrets.REGISTRY_URL }}/graham/towerops-web:main-${IMAGE_SHA}"
# Update both init container (migrate) and main container
kubectl set image deployment/towerops \
migrate=${IMAGE_TAG} \
towerops=${IMAGE_TAG} \
-n towerops
kubectl set env deployment/towerops \
DEPLOY_TIMESTAMP=${DEPLOY_TIMESTAMP} \
-n towerops
env:
KUBECONFIG: ${{ secrets.KUBECONFIG }}