Skip to content

Commit 11196fe

Browse files
authored
Merge pull request #13 from mutablelogic/ffmpeg61
Added workflow handlers
2 parents bd06e71 + fec27b3 commit 11196fe

File tree

5 files changed

+155
-7
lines changed

5 files changed

+155
-7
lines changed

.github/workflows/on_publish.yaml

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
name: Build docker container on publish
2+
on:
3+
release:
4+
types: [ created, edited ]
5+
workflow_dispatch:
6+
inputs:
7+
tag:
8+
description: 'tag'
9+
required: true
10+
default: 'latest'
11+
type: string
12+
jobs:
13+
var:
14+
name: Set variables
15+
runs-on: ubuntu-latest
16+
outputs:
17+
image: "ghcr.io/${{ github.repository }}"
18+
tag: ${{ steps.var.outputs.tag }}
19+
steps:
20+
- name: Checkout
21+
uses: actions/checkout@v4
22+
with:
23+
fetch-depth: 0
24+
- name: Set variables
25+
id: var
26+
run: |
27+
if [ "${{ github.event_name }}" != "release" ] && [ "${{ inputs.tag }}" != "latest" ]; then
28+
TAG="${{ inputs.tag }}" && echo "tag=${TAG#v}" >> $GITHUB_OUTPUT
29+
else
30+
TAG="$(git describe --tags)" && echo "tag=${TAG#v}" >> $GITHUB_OUTPUT
31+
fi
32+
build:
33+
name: Build
34+
needs: var
35+
strategy:
36+
matrix:
37+
arch: [ amd64, arm64 ]
38+
runs-on: ${{ matrix.arch == 'amd64' && 'ubuntu-latest' || matrix.arch }}
39+
env:
40+
ARCH: ${{ matrix.arch }}
41+
OS: linux
42+
DOCKER_REGISTRY: ghcr.io/mutablelogic
43+
steps:
44+
- name: Install git
45+
run: |
46+
sudo apt -y update
47+
sudo apt -y install build-essential git
48+
git config --global advice.detachedHead false
49+
- name: Checkout
50+
uses: actions/checkout@v4
51+
with:
52+
fetch-depth: 0
53+
- name: Login
54+
uses: docker/login-action@v3
55+
with:
56+
registry: ghcr.io
57+
username: ${{ github.repository_owner }}
58+
password: ${{ secrets.GITHUB_TOKEN }}
59+
- name: Build and Push
60+
id: build
61+
run: |
62+
git checkout v${{ needs.var.outputs.tag }}
63+
make docker && make docker-push
64+
manifest:
65+
name: Manifest
66+
needs:
67+
- var
68+
- build
69+
strategy:
70+
matrix:
71+
include:
72+
- tag: ${{ needs.var.outputs.tag }}
73+
- tag: latest # TODO: Skip this if the event calling is not publishing a release
74+
runs-on: ubuntu-latest
75+
steps:
76+
- name: Login
77+
uses: docker/login-action@v3
78+
with:
79+
registry: ghcr.io
80+
username: ${{ github.repository_owner }}
81+
password: ${{ secrets.GITHUB_TOKEN }}
82+
- name: Create
83+
run: |
84+
docker manifest create ${{ needs.var.outputs.image }}:${{ matrix.tag }} \
85+
--amend ${{ needs.var.outputs.image }}-linux-amd64:${{ needs.var.outputs.tag }} \
86+
--amend ${{ needs.var.outputs.image }}-linux-arm64:${{ needs.var.outputs.tag }}
87+
- name: Annotate
88+
run: |
89+
docker manifest annotate --arch arm64 --os linux \
90+
${{ needs.var.outputs.image }}:${{ matrix.tag }} \
91+
${{ needs.var.outputs.image }}-linux-arm64:${{ needs.var.outputs.tag }}
92+
docker manifest annotate --arch amd64 --os linux \
93+
${{ needs.var.outputs.image }}:${{ matrix.tag }} \
94+
${{ needs.var.outputs.image }}-linux-amd64:${{ needs.var.outputs.tag }}
95+
docker manifest push ${{ needs.var.outputs.image }}:${{ matrix.tag }}
96+
- name: Push
97+
run: |
98+
docker manifest push ${{ needs.var.outputs.image }}:${{ matrix.tag }}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
2+
name: "Run tests on merge to main"
3+
on:
4+
pull_request:
5+
branches: [ main ]
6+
jobs:
7+
analyze:
8+
name: Analyze
9+
runs-on: ubuntu-latest
10+
permissions:
11+
actions: read
12+
contents: read
13+
security-events: write
14+
strategy:
15+
fail-fast: false
16+
matrix:
17+
language: [ 'go' ]
18+
steps:
19+
- name: Checkout repository
20+
uses: actions/checkout@v4
21+
- name: Initialize CodeQL
22+
uses: github/codeql-action/init@v3
23+
with:
24+
languages: ${{ matrix.language }}
25+
- name: Autobuild
26+
uses: github/codeql-action/autobuild@v3
27+
- name: Perform CodeQL Analysis
28+
uses: github/codeql-action/analyze@v3
29+
test:
30+
name: Test
31+
runs-on: ubuntu-latest
32+
strategy:
33+
matrix:
34+
go-version: [ '1.21', '1.22' ]
35+
steps:
36+
- name: Checkout repository
37+
uses: actions/checkout@v4
38+
- name: Setup Go ${{ matrix.go-version }}
39+
uses: actions/setup-go@v5
40+
with:
41+
go-version: ${{ matrix.go-version }}
42+
- name: Run tests
43+
run: make test

cmd/decode/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"os"
77

88
// Packages
9-
ffmpeg "github.com/mutablelogic/go-media/pkg/ffmpeg"
9+
ffmpeg "github.com/mutablelogic/go-media"
1010
)
1111

1212
var (

cmd/server/handle_metadata.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55
"net/http"
66

77
// Packages
8-
ffmpeg "github.com/mutablelogic/go-media/pkg/ffmpeg"
8+
ffmpeg "github.com/mutablelogic/go-media"
99
ff "github.com/mutablelogic/go-media/sys/ffmpeg61"
1010
)
1111

go.mod

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,25 @@
11
module github.com/mutablelogic/go-media
22

3-
go 1.18
3+
go 1.22
4+
5+
toolchain go1.22.4
46

57
require (
6-
github.com/djthorpe/go-errors v1.0.2
8+
github.com/alecthomas/kong v0.9.0
9+
github.com/djthorpe/go-errors v1.0.3
10+
github.com/djthorpe/go-tablewriter v0.0.7
711
github.com/hashicorp/go-multierror v1.1.1
8-
github.com/stretchr/testify v1.8.1
9-
golang.org/x/exp v0.0.0-20221212164502-fae10dda9338
12+
github.com/mutablelogic/go-client v1.0.8
13+
github.com/stretchr/testify v1.9.0
1014
)
1115

1216
require (
13-
github.com/alecthomas/kong v0.9.0 // indirect
1417
github.com/davecgh/go-spew v1.1.1 // indirect
1518
github.com/hashicorp/errwrap v1.0.0 // indirect
19+
github.com/mattn/go-runewidth v0.0.15 // indirect
1620
github.com/pmezard/go-difflib v1.0.0 // indirect
21+
github.com/rivo/uniseg v0.4.7 // indirect
22+
golang.org/x/sys v0.20.0 // indirect
23+
golang.org/x/term v0.20.0 // indirect
1724
gopkg.in/yaml.v3 v3.0.1 // indirect
1825
)

0 commit comments

Comments
 (0)