Skip to content

Commit 8d00999

Browse files
authored
Merge pull request #1 from git-steb/feature/v1.2.6-optimizations
Feature/v1.2.6 optimizations
2 parents 3d861bc + 2f4512f commit 8d00999

26 files changed

Lines changed: 774 additions & 1772 deletions

.github/workflows/build.yml

Lines changed: 165 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,165 @@
1+
name: build-and-publish
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches: [main]
7+
8+
permissions:
9+
contents: read
10+
packages: write
11+
12+
jobs:
13+
docker:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v4
17+
18+
- name: Read version
19+
run: echo "VERSION=$(cat VERSION)" >> $GITHUB_ENV
20+
21+
- name: Validate VERSION
22+
run: |
23+
set -euo pipefail
24+
[[ -s VERSION ]] || { echo "VERSION empty"; exit 1; }
25+
grep -Eq '^[0-9]+(\.[0-9]+){1,2}$' VERSION || { echo "Bad VERSION format"; exit 1; }
26+
echo "✅ VERSION validation passed: $VERSION"
27+
28+
- uses: docker/setup-buildx-action@v3
29+
30+
- uses: docker/login-action@v3
31+
with:
32+
registry: ghcr.io
33+
username: ${{ github.actor }}
34+
password: ${{ secrets.GITHUB_TOKEN }}
35+
36+
# Build and push base layer
37+
- name: Build and push base layer
38+
uses: docker/build-push-action@v6
39+
with:
40+
context: .
41+
file: build_context/Dockerfile.base
42+
build-args: VERSION=${{ env.VERSION }}
43+
push: true
44+
tags: |
45+
ghcr.io/git-steb/haskell-tex-dev:base-${{ github.sha }}
46+
ghcr.io/git-steb/haskell-tex-dev:base-latest
47+
cache-from: type=gha
48+
cache-to: type=gha,mode=max
49+
provenance: true
50+
sbom: true
51+
52+
# Build and push haskell layer
53+
- name: Build and push haskell layer
54+
uses: docker/build-push-action@v6
55+
with:
56+
context: .
57+
file: build_context/Dockerfile.haskell
58+
build-args: |
59+
BASE_IMAGE=ghcr.io/git-steb/haskell-tex-dev:base-${{ github.sha }}
60+
VERSION=${{ env.VERSION }}
61+
push: true
62+
tags: |
63+
ghcr.io/git-steb/haskell-tex-dev:haskell-${{ github.sha }}
64+
ghcr.io/git-steb/haskell-tex-dev:haskell-latest
65+
cache-from: type=gha
66+
cache-to: type=gha,mode=max
67+
provenance: true
68+
sbom: true
69+
70+
# Build and push tex layer (full image)
71+
- id: tex
72+
name: Build and push tex layer
73+
uses: docker/build-push-action@v6
74+
with:
75+
context: .
76+
file: build_context/Dockerfile.tex
77+
build-args: |
78+
BASE_IMAGE=ghcr.io/git-steb/haskell-tex-dev:haskell-${{ github.sha }}
79+
VERSION=${{ env.VERSION }}
80+
push: true
81+
tags: |
82+
ghcr.io/git-steb/haskell-tex-dev:tex-${{ github.sha }}
83+
ghcr.io/git-steb/haskell-tex-dev:tex-latest
84+
ghcr.io/git-steb/haskell-tex-dev:latest
85+
ghcr.io/git-steb/haskell-tex-dev:v${{ env.VERSION }}
86+
cache-from: type=gha
87+
cache-to: type=gha,mode=max
88+
provenance: true
89+
sbom: true
90+
91+
- name: Test image functionality
92+
run: |
93+
set -euo pipefail
94+
echo "Testing image functionality..."
95+
echo "Version: $VERSION"
96+
97+
# Test that the base image has the required tools
98+
echo "Testing base image tools..."
99+
docker run --rm ghcr.io/git-steb/haskell-tex-dev:base-${{ github.sha }} jq --version
100+
docker run --rm ghcr.io/git-steb/haskell-tex-dev:base-${{ github.sha }} gh --version
101+
102+
# Test that the haskell image has the required tools
103+
echo "Testing haskell image tools..."
104+
docker run --rm ghcr.io/git-steb/haskell-tex-dev:haskell-${{ github.sha }} ghc --version
105+
docker run --rm ghcr.io/git-steb/haskell-tex-dev:haskell-${{ github.sha }} cabal --version
106+
107+
# Test that the tex image has the required tools
108+
echo "Testing tex image tools..."
109+
docker run --rm ghcr.io/git-steb/haskell-tex-dev:tex-${{ github.sha }} latexmk -v
110+
111+
echo "✅ All builds and tests passed!"
112+
113+
# Atomic tagging - only on main branch pushes (after tests pass)
114+
- name: Tag latest and version tags atomically
115+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
116+
run: |
117+
set -euo pipefail
118+
IMG="ghcr.io/git-steb/haskell-tex-dev"
119+
DIGEST="${{ steps.tex.outputs.digest }}"
120+
121+
echo "Creating atomic tags for version $VERSION using digest $DIGEST..."
122+
123+
# Tag base layer
124+
docker buildx imagetools create \
125+
-t "$IMG:base-latest" \
126+
"$IMG:base-${{ github.sha }}"
127+
128+
# Tag haskell layer
129+
docker buildx imagetools create \
130+
-t "$IMG:haskell-latest" \
131+
"$IMG:haskell-${{ github.sha }}"
132+
133+
# Tag tex layer (full image) with all tags using exact digest
134+
docker buildx imagetools create \
135+
-t "$IMG:tex-latest" \
136+
-t "$IMG:latest" \
137+
-t "$IMG:v$VERSION" \
138+
"$IMG@${DIGEST}"
139+
140+
echo "✅ Atomic tagging completed"
141+
142+
- name: Build summary
143+
if: always()
144+
run: |
145+
echo "## Build and Publish Results" >> $GITHUB_STEP_SUMMARY
146+
echo "" >> $GITHUB_STEP_SUMMARY
147+
echo "**Version**: v$VERSION" >> $GITHUB_STEP_SUMMARY
148+
echo "**Event**: ${{ github.event_name }}" >> $GITHUB_STEP_SUMMARY
149+
echo "**Branch**: ${{ github.ref }}" >> $GITHUB_STEP_SUMMARY
150+
echo "" >> $GITHUB_STEP_SUMMARY
151+
152+
if [[ "${{ job.status }}" == "success" ]]; then
153+
echo "✅ **Base layer**: Built successfully" >> $GITHUB_STEP_SUMMARY
154+
echo "✅ **Haskell layer**: Built successfully" >> $GITHUB_STEP_SUMMARY
155+
echo "✅ **TeX layer**: Built successfully" >> $GITHUB_STEP_SUMMARY
156+
echo "✅ **Tool verification**: All tools available" >> $GITHUB_STEP_SUMMARY
157+
if [[ "${{ github.event_name }}" == "push" && "${{ github.ref }}" == "refs/heads/main" ]]; then
158+
echo "✅ **Published tags**: latest, v$VERSION" >> $GITHUB_STEP_SUMMARY
159+
else
160+
echo "ℹ️ **Published**: No (PR build)" >> $GITHUB_STEP_SUMMARY
161+
fi
162+
else
163+
echo "❌ **Build failed**" >> $GITHUB_STEP_SUMMARY
164+
echo "Check the logs above for details." >> $GITHUB_STEP_SUMMARY
165+
fi

.github/workflows/docker-build.yml

Lines changed: 0 additions & 79 deletions
This file was deleted.

.github/workflows/docker-build.yml.original

Lines changed: 0 additions & 63 deletions
This file was deleted.

.github/workflows/ping.yml

Lines changed: 0 additions & 16 deletions
This file was deleted.

0 commit comments

Comments
 (0)