feat: refactor into proper hexagonal structure #948
This file contains 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
name: Automated Tests and Linting | |
on: | |
push: | |
branches-ignore: | |
- "main" | |
- "develop" | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
name: "Test and Build" | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version-file: ".nvmrc" | |
cache: yarn | |
cache-dependency-path: "ui/yarn.lock" | |
- uses: actions/setup-go@v5 | |
with: | |
go-version: "stable" | |
- uses: ko-build/[email protected] | |
- name: Install packages | |
run: yarn install --immutable | |
working-directory: ui | |
- name: Run tests | |
run: yarn test | |
working-directory: ui | |
- name: Install Go dependencies | |
run: go mod download | |
- name: Run Go Generate to generate assets | |
run: go generate ./... | |
- name: Go Test | |
run: go test ./... | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ghcr.io/f-eld-ch/sitrep | |
tags: | | |
# set latest tag for default branch / ordered by priority | |
type=semver,pattern={{version}},prefix=v,priority=920 | |
type=raw,value=stable,enable=${{ github.ref == format('refs/heads/{0}', 'main') }},priority=910 | |
type=raw,value=develop,enable={{is_default_branch}},priority=905 | |
# priority 900 | |
type=semver,pattern={{major}}.{{minor}},prefix=v | |
type=semver,pattern={{major}},prefix=v | |
# priority 700 | |
type=edge,branch=develop | |
# priority 600 | |
type=ref,event=branch | |
type=ref,event=pr,prefix=pr-,enable=true | |
- name: Prepare Image Tags and Labels | |
id: image_tags_labels | |
run: | | |
# prepare tags | |
tags="" | |
separator="" | |
prefix=${KO_DOCKER_REPO} | |
IFS=$'\n' | |
for tag in ${DOCKER_METADATA_OUTPUT_TAGS}; do | |
tags="$tags${separator}${tag#${prefix}:}" | |
separator="," | |
done | |
echo "tags=$tags" >> $GITHUB_OUTPUT | |
# prepare labels | |
labels="" | |
IFS=$'\n' | |
separator="" | |
for label in ${DOCKER_METADATA_OUTPUT_LABELS}; do | |
labels="${labels}${separator}--image-label '$label'" | |
separator=" " | |
done | |
echo "labels=$labels" >> $GITHUB_OUTPUT | |
- name: Ko Build | |
env: | |
Version: ${{ steps.meta.outputs.verison }} | |
run: > | |
ko build --bare . --tags ${{ steps.image_tags_labels.outputs.tags }} ${{ steps.image_tags_labels.outputs.labels }} |