Upgrade to Go 1.27 and enhance AxonHTA features (#118) #188
Workflow file for this run
This file contains hidden or 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
| # AxonASP Server - Docker Build & Publish to ghcr.io | |
| # | |
| # Copyright (C) 2026 G3pix Ltda. All rights reserved. | |
| # | |
| # Developed by Lucas Guimarães - G3pix Ltda | |
| # Contact: https://g3pix.com.br | |
| # Project URL: https://g3pix.com.br/axonasp | |
| # | |
| # This Source Code Form is subject to the terms of the Mozilla Public | |
| # License, v. 2.0. If a copy of the MPL was not distributed with this | |
| # file, You can obtain one at https://mozilla.org/MPL/2.0/. | |
| # | |
| # Attribution Notice: | |
| # If this software is used in other projects, the name "AxonASP Server" | |
| # must be cited in the documentation or "About" section. | |
| # | |
| # Contribution Policy: | |
| # Modifications to the core source code of AxonASP Server must be | |
| # made available under this same license terms. | |
| # This code was contributed by @antoniolago (https://github.com/antoniolago) | |
| # | |
| # Triggers: | |
| # - Push of v* tag → publishes :v1.2.3 + :1.2 + :1 | |
| name: Docker Build & Publish | |
| on: | |
| push: | |
| tags: | |
| - "v*.*.*" | |
| workflow_dispatch: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| env: | |
| REGISTRY: ghcr.io | |
| IMAGE_NAME: ${{ github.repository }} | |
| jobs: | |
| docker: | |
| name: Docker Build & Push | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v7 | |
| with: | |
| fetch-depth: 0 | |
| - name: Compute version string | |
| id: version | |
| run: | | |
| # Use tag name when triggered by a tag, otherwise use commit count + short sha | |
| if [[ "${GITHUB_REF_TYPE}" == "tag" ]]; then | |
| echo "value=${GITHUB_REF_NAME}" >> "$GITHUB_OUTPUT" | |
| else | |
| COUNT=$(git rev-list --count HEAD) | |
| SHORT=$(git rev-parse --short HEAD) | |
| echo "value=1.0.${COUNT}.${SHORT}" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: Set up QEMU (multi-arch support) | |
| uses: docker/setup-qemu-action@v4 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v4 | |
| - name: Log in to GitHub Container Registry | |
| if: github.event_name != 'pull_request' | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Extract Docker metadata (tags & labels) | |
| id: meta | |
| uses: docker/metadata-action@v6 | |
| with: | |
| images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
| tags: | | |
| # Branch/tag push → :latest and :sha-<short> | |
| type=raw,value=latest | |
| type=sha,prefix=sha-,format=short | |
| # Semver tags → :v1.2.3, :1.2, :1 | |
| type=semver,pattern={{version}} | |
| type=semver,pattern={{major}}.{{minor}} | |
| type=semver,pattern={{major}} | |
| # Branch name tag (e.g. :main) | |
| type=ref,event=branch | |
| # PR tag (not pushed, but useful for labeling) | |
| type=ref,event=pr | |
| - name: Build and push Docker image | |
| uses: docker/build-push-action@v7 | |
| with: | |
| context: . | |
| file: Dockerfile | |
| platforms: linux/amd64,linux/arm64 | |
| push: ${{ github.event_name != 'pull_request' }} | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| build-args: | | |
| VERSION=${{ steps.version.outputs.value }} | |
| # GitHub Actions cache for faster rebuilds | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| provenance: false | |
| # ─── Job 2: Build & Publish Caddy Docker image ──────────────────────────── | |
| docker-caddy: | |
| name: Docker Caddy Build & Push | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v7 | |
| with: | |
| fetch-depth: 0 | |
| - name: Compute version string | |
| id: version | |
| run: | | |
| if [[ "${GITHUB_REF_TYPE}" == "tag" ]]; then | |
| echo "value=${GITHUB_REF_NAME}" >> "$GITHUB_OUTPUT" | |
| else | |
| COUNT=$(git rev-list --count HEAD) | |
| SHORT=$(git rev-parse --short HEAD) | |
| echo "value=1.0.${COUNT}.${SHORT}" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: Set up QEMU (multi-arch support) | |
| uses: docker/setup-qemu-action@v4 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v4 | |
| - name: Log in to GitHub Container Registry | |
| if: github.event_name != 'pull_request' | |
| uses: docker/login-action@v4 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Extract Docker metadata (tags & labels) | |
| id: meta | |
| uses: docker/metadata-action@v6 | |
| with: | |
| images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
| tags: | | |
| type=raw,value=caddy | |
| type=sha,prefix=caddy-sha-,format=short | |
| type=semver,pattern=caddy-{{version}} | |
| type=semver,pattern=caddy-{{major}}.{{minor}} | |
| type=semver,pattern=caddy-{{major}} | |
| type=ref,event=branch,suffix=-caddy | |
| type=ref,event=pr,suffix=-caddy | |
| - name: Build and push Caddy Docker image | |
| uses: docker/build-push-action@v7 | |
| with: | |
| context: . | |
| file: docker/Dockerfile.caddy | |
| platforms: linux/amd64,linux/arm64 | |
| push: ${{ github.event_name != 'pull_request' }} | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| build-args: | | |
| VERSION=${{ steps.version.outputs.value }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| provenance: false | |
| # ─── Job 3: Docker Smoke Test (standard image) ───────────────────────────── | |
| docker-test: | |
| name: Docker Integration Tests | |
| runs-on: ubuntu-latest | |
| needs: docker | |
| if: github.event_name != 'pull_request' | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v7 | |
| - name: Set up Go | |
| uses: actions/setup-go@v7 | |
| with: | |
| go-version-file: go.mod | |
| cache: true | |
| - name: Start AxonASP container | |
| run: | | |
| docker run -d \ | |
| --name axonasp-test \ | |
| -p 8801:8801 \ | |
| ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest | |
| - name: Wait for server to be ready | |
| run: | | |
| echo "Waiting for AxonASP to start..." | |
| for i in $(seq 1 20); do | |
| if curl -sf http://localhost:8801/ > /dev/null 2>&1; then | |
| echo "Server is up after ${i} seconds" | |
| exit 0 | |
| fi | |
| sleep 1 | |
| done | |
| echo "Server did not start in time" | |
| docker logs axonasp-test | |
| exit 1 | |
| - name: Sanity check ASP test fixtures | |
| run: | | |
| for p in /tests/test_hello.asp /tests/test_simple.asp /tests/test_docker.asp; do | |
| code=$(curl -s -o /dev/null -w "%{http_code}" "http://localhost:8801$p") | |
| if [ "$code" != "200" ]; then | |
| echo "Missing or inaccessible fixture: $p (HTTP $code)" | |
| docker logs axonasp-test | |
| exit 1 | |
| fi | |
| done | |
| - name: Run Docker integration tests | |
| env: | |
| TEST_SERVER_URL: http://localhost:8801 | |
| run: go test ./docker/... -v -timeout 60s -run TestDocker | |
| - name: Print container logs on failure | |
| if: failure() | |
| run: docker logs axonasp-test | |
| - name: Stop and remove container | |
| if: always() | |
| run: docker rm -f axonasp-test || true | |
| # ─── Job 4: Caddy Docker Smoke Test ────────────────────────────────────── | |
| docker-caddy-test: | |
| name: Docker Caddy Integration Tests | |
| runs-on: ubuntu-latest | |
| needs: docker-caddy | |
| if: github.event_name != 'pull_request' | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v7 | |
| - name: Start AxonASP Caddy container | |
| run: | | |
| docker run -d \ | |
| --name axonasp-caddy-test \ | |
| -p 8802:8801 \ | |
| ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:caddy | |
| - name: Wait for Caddy server to be ready | |
| run: | | |
| echo "Waiting for AxonASP Caddy to start..." | |
| for i in $(seq 1 20); do | |
| if curl -sf http://localhost:8802/ > /dev/null 2>&1; then | |
| echo "Caddy server is up after ${i} seconds" | |
| exit 0 | |
| fi | |
| sleep 1 | |
| done | |
| echo "Caddy server did not start in time" | |
| docker logs axonasp-caddy-test | |
| exit 1 | |
| - name: Verify Caddy responds with default page | |
| run: | | |
| status=$(curl -s -o /dev/null -w "%{http_code}" http://localhost:8802/) | |
| if [ "$status" != "200" ]; then | |
| echo "Expected HTTP 200, got $status" | |
| docker logs axonasp-caddy-test | |
| exit 1 | |
| fi | |
| echo "Caddy server responded with HTTP $status" | |
| - name: Print container logs on failure | |
| if: failure() | |
| run: docker logs axonasp-caddy-test | |
| - name: Stop and remove container | |
| if: always() | |
| run: docker rm -f axonasp-caddy-test || true | |