58 lines
1.4 KiB
YAML
58 lines
1.4 KiB
YAML
name: test
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
pull_request:
|
|
branches:
|
|
- master
|
|
|
|
jobs:
|
|
test:
|
|
name: Docker Test
|
|
runs-on: ubuntu-24.04
|
|
steps:
|
|
- name: Check out code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Build test image
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
context: .
|
|
target: builder
|
|
tags: imagorvideo-test
|
|
load: true
|
|
cache-from: type=gha
|
|
cache-to: type=gha,mode=max
|
|
|
|
- name: Run tests in Docker
|
|
run: |
|
|
docker run --rm \
|
|
-v ${{ github.workspace }}:/workspace \
|
|
-w /workspace \
|
|
imagorvideo-test \
|
|
go test ./... -v
|
|
|
|
- name: Commit golden files
|
|
if: github.event_name == 'pull_request'
|
|
uses: stefanzweifel/git-auto-commit-action@v5
|
|
with:
|
|
commit_message: "test: update golden files"
|
|
file_pattern: "testdata/golden"
|
|
|
|
- name: Run coverage in Docker
|
|
run: |
|
|
docker run --rm \
|
|
-v ${{ github.workspace }}:/workspace \
|
|
-w /workspace \
|
|
imagorvideo-test \
|
|
sh -c "rm -rf examples cmd && go test -coverprofile=profile.cov ./..."
|
|
|
|
- name: Coveralls
|
|
uses: shogo82148/actions-goveralls@v1
|
|
with:
|
|
path-to-profile: profile.cov
|