Skip to content

feat(fc2): add panic in case a nil error is passed #188

feat(fc2): add panic in case a nil error is passed

feat(fc2): add panic in case a nil error is passed #188

Workflow file for this run

name: Go CI
on:
workflow_dispatch:
push:
tags:
- '*'
branches:
- 'main'
paths:
- '**.go'
- '**.c'
- '**.h'
- 'Dockerfile*'
- '.github/workflows/main.yaml'
pull_request:
branches:
- 'main'
jobs:
lint:
name: Lint fc2-live-dl-go
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Download build-essential
run: |
sudo apt update -y
sudo apt install -y build-essential libavformat-dev libavcodec-dev libavutil-dev
- uses: actions/setup-go@v4
with:
go-version-file: 'go.mod'
cache: true
cache-dependency-path: go.sum
- name: Download all Go modules
run: |
go mod download
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: latest
args: --timeout 5m
test:
name: Test fc2-live-dl-go
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Download build-essential
run: |
sudo apt update -y
sudo apt install -y build-essential libavformat-dev libavcodec-dev libavutil-dev
- uses: actions/setup-go@v4
with:
go-version-file: 'go.mod'
cache: true
cache-dependency-path: go.sum
- name: Download all Go modules
run: |
go mod download
- name: test
run: go test -v -race -covermode=atomic -tags=unit -timeout=30s ./...
build-export-static:
name: Build and export fc2-live-dl-go static Docker
runs-on: ubuntu-latest
needs: [lint, test]
steps:
- uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Context for Buildx
run: |
docker context create builders
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3
with:
version: latest
endpoint: builders
- name: Login to GitHub Container Registry
if: startsWith(github.ref, 'refs/tags')
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Get the oci compatible version
if: startsWith(github.ref, 'refs/tags')
id: get_version
run: |
echo "VERSION=$(echo ${GITHUB_REF#refs/*/})" >> $GITHUB_OUTPUT
echo "OCI_VERSION=$(echo ${GITHUB_REF#refs/*/} | sed 's/+/-/g' | sed -E 's/v(.*)/\1/g' )" >> $GITHUB_OUTPUT
- name: Build export
uses: docker/build-push-action@v5
if: ${{ ! startsWith(github.ref, 'refs/tags') }}
with:
file: Dockerfile.static
platforms: linux/amd64,linux/arm64,linux/riscv64
push: false
tags: darkness4/fc2-live-dl-go:latest
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Build and export
if: startsWith(github.ref, 'refs/tags')
uses: docker/build-push-action@v5
with:
file: Dockerfile.static
platforms: linux/amd64,linux/arm64,linux/riscv64
push: true
build-args: |
VERSION=${{ steps.get_version.outputs.VERSION }}
tags: |
ghcr.io/darkness4/fc2-live-dl-go:latest
ghcr.io/darkness4/fc2-live-dl-go:dev
ghcr.io/darkness4/fc2-live-dl-go:${{ steps.get_version.outputs.OCI_VERSION }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Build and export dev
if: github.event_name == 'workflow_dispatch'
uses: docker/build-push-action@v5
with:
file: Dockerfile.static
platforms: linux/amd64,linux/arm64,linux/riscv64
push: true
build-args: |
VERSION=dev
tags: |
ghcr.io/darkness4/fc2-live-dl-go:dev
cache-from: type=gha
cache-to: type=gha,mode=max
build-windows:
name: Test Build fc2-live-dl-go static windows binaries
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Docker Context for Buildx
run: |
docker context create builders
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3
with:
version: latest
endpoint: builders
- name: Build
uses: docker/build-push-action@v5
with:
file: Dockerfile.static-windows
platforms: linux/amd64
push: false
tags: darkness4/fc2-live-dl-go:latest
cache-from: type=gha
cache-to: type=gha,mode=max
build-darwin:
name: Test Build fc2-live-dl-go darwin binaries
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Context for Buildx
run: |
docker context create builders
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3
with:
version: latest
endpoint: builders
- name: Build Darwin
uses: docker/build-push-action@v5
with:
file: Dockerfile.darwin
platforms: linux/amd64,linux/arm64
push: false
tags: darkness4/fc2-live-dl-go:latest
cache-from: type=gha
cache-to: type=gha,mode=max
target: busybox
- name: Build Darwin
uses: docker/build-push-action@v5
with:
file: Dockerfile.darwin
platforms: linux/amd64
push: false
tags: darkness4/fc2-live-dl-go:amd64
cache-from: type=gha
cache-to: type=gha,mode=max
target: busybox
load: true
- name: Extract binaries
run: |
mkdir -p /tmp/out
docker run --rm \
-v /tmp/out:/out \
--platform linux/amd64 \
--entrypoint sh \
darkness4/fc2-live-dl-go:amd64 \
-c "mv /fc2-live-dl-go /out/fc2-live-dl-go-darwin-amd64"
- name: Upload binaries
uses: actions/upload-artifact@v3
with:
name: os-x-binaries
path: /tmp/out
if-no-files-found: error
retention-days: 1
test-darwin:
name: Test running darwin to see any linking errors
strategy:
fail-fast: true
matrix:
os: [macos-11, macos-12, macos-13]
runs-on: ${{ matrix.os }}
needs: [build-darwin]
steps:
- uses: actions/download-artifact@v3
with:
name: os-x-binaries
- name: Execute binaries
run: |
chmod +x ./fc2-live-dl-go-darwin-amd64
./fc2-live-dl-go-darwin-amd64 --help