Skip to content

Statically link to libxml2 when static_build tag is defined #41

Statically link to libxml2 when static_build tag is defined

Statically link to libxml2 when static_build tag is defined #41

Workflow file for this run

name: CI
on:
pull_request:
branches:
- master
jobs:
ubuntu:
runs-on: ubuntu-latest
strategy:
matrix:
go: [ '1.21' ]
link:
- type: dynamic
goflags: ""
- type: static
# On Ubuntu, libxml2 is compiled with GCC and is linked to libicu, which introduces a
# stealth dependency on libstdc++ at link-time
goflags: "-ldflags '-extldflags -lstdc++' -tags 'osusergo netgo static_build'"
name: "Test [ Go ${{ matrix.go }}, ${{ matrix.link.type }} linking ]"
env:

Check failure on line 21 in .github/workflows/ci.yml

View workflow run for this annotation

GitHub Actions / CI

Invalid workflow file

The workflow is not valid. .github/workflows/ci.yml (Line: 21, Col: 9): Unexpected value ''

Check failure on line 21 in .github/workflows/ci.yml

View workflow run for this annotation

GitHub Actions / CI

Invalid workflow file

The workflow is not valid. .github/workflows/ci.yml (Line: 21, Col: 9): Unexpected value ''
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Cache Go modules
uses: actions/cache@v3
with:
path: |
~/go/pkg/mod
~/.cache/go-build
~/.cache/bazel
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Install Go stable version
if: matrix.go != 'tip'
uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go }}
check-latest: true
- name: Run Go tests
run: go test ${{ matrix.link.goflags }} ./...
- name: Test linking capability
run: |
go build -o linktest ${{ matrix.link.goflags }} ./test/link
file linktest | grep '${{ matrix.link.type }}ally linked'
archlinux:
runs-on: ubuntu-latest
strategy:
matrix:
go: [ '1.21' ]
container:
image: archlinux:latest
name: "Test [ Arch Linux + Go ${{ matrix.go }} ]"
steps:
- uses: actions/checkout@v3
- name: Set Up Arch Linux
run: |
pacman -Syy --noconfirm
pacman -Syu --noconfirm
pacman -S --noconfirm base-devel
pacman -S --noconfirm libxml2=2.12.0
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go }}
- name: Test
run: go test ./...