mirror of
https://git.mills.io/prologic/zs.git
synced 2024-11-09 20:08:13 -05:00
Add CI workflows
This commit is contained in:
parent
f69d56187b
commit
929a899656
23
.gitea/workflows/build.yml
Normal file
23
.gitea/workflows/build.yml
Normal file
@ -0,0 +1,23 @@
|
||||
---
|
||||
|
||||
name: 🛠️ Build
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout Code
|
||||
uses: actions/checkout@v3
|
||||
- name: Setup Go
|
||||
uses: actions/setup-go@v4
|
||||
with:
|
||||
go-version-file: 'go.mod'
|
||||
- name: Install Build Dependencies
|
||||
run: make deps
|
||||
- name: Build Binary
|
||||
run: make build
|
62
.gitea/workflows/publish.yml
Normal file
62
.gitea/workflows/publish.yml
Normal file
@ -0,0 +1,62 @@
|
||||
---
|
||||
|
||||
name: 🚀 Publish
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
pull_request:
|
||||
|
||||
env:
|
||||
REGISTRY: r.mills.io
|
||||
IMAGE: prologic/zs
|
||||
TAG: latest
|
||||
|
||||
jobs:
|
||||
publish:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout Code
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Setup Docker Buildx
|
||||
uses: actions/setup-buildx@v2
|
||||
- name: Login to Registry
|
||||
uses: actions/docker-login@v2
|
||||
with:
|
||||
registry: ${{ env.REGISTRY }}
|
||||
username: ${{ secrets.REGISTRY_USER }}
|
||||
password: ${{ secrets.REGISTRY_PASS }}
|
||||
- name: Build Info
|
||||
id: build-info
|
||||
run: |
|
||||
{
|
||||
echo "VERSION=$(git describe --abbrev=0)"
|
||||
echo "COMMIT=$(git rev-parse --short HEAD)"
|
||||
echo "BUILD=$(git show -s --pretty=format:%cI)"
|
||||
} >> "$GITHUB_OUTPUT"
|
||||
- name: Build Image
|
||||
uses: actions/docker-build-push@v4
|
||||
with:
|
||||
context: .
|
||||
load: true
|
||||
tags: ${{ env.REGISTRY}}/${{ env.IMAGE }}:${{ env.TAG }}
|
||||
build-args: |
|
||||
VERSION=${{ steps.build-info.outputs.VERSION }}
|
||||
COMMIT=${{ steps.build-info.outputs.COMMIT }}
|
||||
BUILD=${{ steps.build-info.outputs.BUILD }}
|
||||
- name: Test Image
|
||||
run: |
|
||||
docker run --rm ${{ env.REGISTRY}}/${{ env.IMAGE }}:${{ env.TAG }} zs --version
|
||||
- name: Publish Image
|
||||
if: ${{ github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master' }}
|
||||
uses: actions/docker-build-push@v4
|
||||
with:
|
||||
context: .
|
||||
push: true
|
||||
tags: ${{ env.REGISTRY}}/${{ env.IMAGE }}:${{ env.TAG }}
|
||||
build-args: |
|
||||
VERSION=${{ steps.build-info.outputs.VERSION }}
|
||||
COMMIT=${{ steps.build-info.outputs.COMMIT }}
|
||||
BUILD=${{ steps.build-info.outputs.BUILD }}
|
26
.gitea/workflows/test.yml
Normal file
26
.gitea/workflows/test.yml
Normal file
@ -0,0 +1,26 @@
|
||||
---
|
||||
|
||||
name: 🧪 Test
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
services:
|
||||
tile38:
|
||||
image: tile38/tile38:1.32.2
|
||||
ports:
|
||||
- "9851:9851/tcp"
|
||||
steps:
|
||||
- name: Checkout Code
|
||||
uses: actions/checkout@v3
|
||||
- name: Setup Go
|
||||
uses: actions/setup-go@v4
|
||||
with:
|
||||
go-version-file: 'go.mod'
|
||||
- name: Run Tests
|
||||
run: make test
|
Loading…
Reference in New Issue
Block a user