feat: Initialized Project
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 562 KiB |
@@ -0,0 +1,49 @@
|
||||
name: docker image update
|
||||
|
||||
on:
|
||||
workflow_run:
|
||||
workflows: [Build]
|
||||
branches: [v**]
|
||||
types: [completed]
|
||||
|
||||
jobs:
|
||||
main:
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
max-parallel: 3
|
||||
matrix:
|
||||
os: [ubuntu-latest, windows-2022]
|
||||
include:
|
||||
- os: ubuntu-latest
|
||||
platforms: linux/amd64,linux/arm/v7,linux/arm64
|
||||
file: linux.Dockerfile
|
||||
buildArgs: VERSION=${{ github.event.workflow_run.head_branch }}
|
||||
tags: latest, ${{ github.event.workflow_run.head_branch }}
|
||||
multiPlatform: true
|
||||
|
||||
- os: windows-2022
|
||||
platforms: windows/amd64
|
||||
file: windows.Dockerfile
|
||||
buildArgs: VERSION=${{ github.event.workflow_run.head_branch }}
|
||||
tags: windows-latest, windows-${{ github.event.workflow_run.head_branch }}
|
||||
multiPlatform: false
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Build and push
|
||||
id: docker_build
|
||||
uses: mr-smithers-excellent/docker-build-push@v6
|
||||
with:
|
||||
multiPlatform: ${{ matrix.multiPlatform }}
|
||||
registry: docker.io
|
||||
|
||||
dockerfile: ${{ matrix.file }}
|
||||
image: biosmarcel/scribble.rs
|
||||
buildArgs: ${{ matrix.buildArgs }}
|
||||
platform: ${{ matrix.platforms }}
|
||||
tags: ${{ matrix.tags }}
|
||||
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
@@ -0,0 +1,44 @@
|
||||
name: Publish release
|
||||
|
||||
on:
|
||||
workflow_run:
|
||||
workflows: [Build]
|
||||
branches: [v**]
|
||||
types: [completed]
|
||||
|
||||
jobs:
|
||||
publish-release:
|
||||
runs-on: ubuntu-latest
|
||||
# Kinda bad since it might release on any branch starting with v, but it'll do for now.
|
||||
# Tag filtering in "on:" doesn't work, since the inital build trigger gets lost.
|
||||
# github.ref is therefore also being reset to "refs/head/master".
|
||||
if: ${{ github.event.workflow_run.conclusion == 'success' }}
|
||||
|
||||
steps:
|
||||
- name: Download linux artifact
|
||||
uses: dawidd6/action-download-artifact@v6
|
||||
with:
|
||||
workflow: test-and-build.yml
|
||||
name: scribblers-linux-x64
|
||||
|
||||
- name: Download macos artifact
|
||||
uses: dawidd6/action-download-artifact@v6
|
||||
with:
|
||||
workflow: test-and-build.yml
|
||||
name: scribblers-macos-x64
|
||||
|
||||
- name: Download windows artifact
|
||||
uses: dawidd6/action-download-artifact@v6
|
||||
with:
|
||||
workflow: test-and-build.yml
|
||||
name: scribblers-x64.exe
|
||||
|
||||
- name: Create release
|
||||
uses: softprops/action-gh-release@v1
|
||||
with:
|
||||
name: ${{ github.event.workflow_run.head_branch }}
|
||||
tag_name: ${{ github.event.workflow_run.head_branch }}
|
||||
files: |
|
||||
scribblers-linux-x64
|
||||
scribblers-macos-x64
|
||||
scribblers-x64.exe
|
||||
@@ -0,0 +1,50 @@
|
||||
name: Build
|
||||
|
||||
on: push
|
||||
|
||||
jobs:
|
||||
test-and-build:
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- platform: windows-latest
|
||||
binary_name: scribblers-x64.exe
|
||||
- platform: ubuntu-latest
|
||||
binary_name: scribblers-linux-x64
|
||||
- platform: macos-latest
|
||||
binary_name: scribblers-macos-x64
|
||||
|
||||
runs-on: ${{ matrix.platform }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
# Workaround to get tags, getting git describe to work.
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Install Go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: 1.25.5
|
||||
|
||||
- name: Run tests
|
||||
shell: bash
|
||||
run: |
|
||||
go test -v -race ./...
|
||||
|
||||
- name: Build artifact
|
||||
shell: bash
|
||||
env:
|
||||
# Disable CGO to get "more static" binaries. They aren't really static ...
|
||||
# since it can still happen that part of the stdlib access certain libs, but
|
||||
# whatever, this will probs do for our usecase. (Can't quite remember
|
||||
# anymore, but I have had issues with this in the past) :D
|
||||
CGO_ENABLED: 0
|
||||
run: |
|
||||
go build -trimpath -ldflags "-w -s -X 'github.com/scribble-rs/scribble.rs/internal/version.Version=$(git describe --tags --dirty)'" -o ${{ matrix.binary_name }} ./cmd/scribblers
|
||||
|
||||
- name: Upload build artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ matrix.binary_name }}
|
||||
path: ./${{ matrix.binary_name }}
|
||||
@@ -0,0 +1,24 @@
|
||||
name: Run tests
|
||||
|
||||
on: pull_request
|
||||
|
||||
jobs:
|
||||
run-tests:
|
||||
strategy:
|
||||
matrix:
|
||||
go-version: [1.25.5]
|
||||
platform: [ubuntu-latest, macos-latest, windows-latest]
|
||||
|
||||
runs-on: ${{ matrix.platform }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Install Go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: ${{ matrix.go-version }}
|
||||
|
||||
- name: Run tests
|
||||
run: |
|
||||
go test -v -race -count=3 ./...
|
||||
Reference in New Issue
Block a user