Skip to content

build: go version

build: go version #3

Workflow file for this run

name: Development Build
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
test:
name: Test and Build
runs-on: ubuntu-latest
strategy:
matrix:
go-version: ["1.24.1"]
arch: [amd64, arm64]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
- name: Download dependencies
run: go mod download
- name: Download rustic binaries
run: make download-rustic
- name: Run tests
if: matrix.arch == 'amd64'
env:
CGO_ENABLED: 0
run: go test $(go list ./...)
- name: Run race tests
if: matrix.arch == 'amd64'
env:
CGO_ENABLED: 1
run: go test -race $(go list ./...)
- name: Build binary
env:
GOOS: linux
GOARCH: ${{ matrix.arch }}
CGO_ENABLED: 0
run: |
go build \
-o dist/elytra_${{ matrix.arch }} \
-v -trimpath \
-ldflags="-s -w -X github.com/pyrohost/elytra/src/system.Version=dev-${GITHUB_SHA:0:7}" \
./src/cmd/elytra
- name: Upload artifacts
uses: actions/upload-artifact@v4
if: matrix.go-version == '1.24.1'
with:
name: elytra-dev-${{ matrix.arch }}
path: dist/elytra_${{ matrix.arch }}
retention-days: 30
docker-dev:
name: Build Development Docker Image
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
permissions:
contents: read
packages: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/pyrohost/elytra
tags: |
type=ref,event=branch,suffix=-dev
type=sha,prefix={{branch}}-dev-,format=short
type=raw,value=dev,enable={{is_default_branch}}
- name: Download rustic binaries
run: make download-rustic
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
VERSION=dev-${{ github.sha }}
cache-from: type=gha
cache-to: type=gha,mode=max