Skip to content
This repository has been archived by the owner on Dec 16, 2022. It is now read-only.

Remove musl #37

Merged
merged 2 commits into from
Jul 31, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
114 changes: 0 additions & 114 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,121 +17,7 @@ permissions:
id-token: write # needed for keyless signing

jobs:
# changing this job name for some reason caused GitHub checks to
# hang at `Expected — Waiting for status to be reported`.
build:
runs-on: ubuntu-latest
env:
PLATFORMS: linux/amd64,linux/arm/v7,linux/arm64
services:
registry:
image: registry:2
ports:
- 5000:5000
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Unshallow
run: git fetch --prune --unshallow
- name: Setup Cosign
uses: sigstore/cosign-installer@main
- name: Set up QEMU
id: qemu
uses: docker/setup-qemu-action@v2
with:
image: tonistiigi/binfmt:latest
platforms: ${{ env.PLATFORMS }}
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
with:
config-inline: |
[worker.oci]
max-parallelism = 4
driver-opts: network=host
- name: Inspect builder
run: |
echo "Name: ${{ steps.buildx.outputs.name }}"
echo "Endpoint: ${{ steps.buildx.outputs.endpoint }}"
echo "Status: ${{ steps.buildx.outputs.status }}"
echo "Flags: ${{ steps.buildx.outputs.flags }}"
echo "Platforms: ${{ steps.buildx.outputs.platforms }}"
- name: Cache Docker layers
uses: actions/cache@v3
id: cache
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-ghcache-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-ghcache-
- run: cat ./hack/static.sh
- name: Build candidate image - libgit2 compiled with libssh2 and openssl
id: build_candidate_libgit2_all
uses: docker/build-push-action@v3
with:
context: .
file: Dockerfile
platforms: ${{ env.PLATFORMS }}
push: true
tags: localhost:5000/${{ github.repository_owner }}/golang-with-libgit2-all:latest
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max
- name: Inspect candidate images
run: |
docker buildx imagetools inspect localhost:5000/${{ github.repository_owner }}/golang-with-libgit2-all:latest
- name: Test candidate images
id: test_candidate
run: |
IMG=localhost:5000/${{ github.repository_owner }}/golang-with-libgit2-all make test
- # Temp fix
# https://github.com/docker/build-push-action/issues/252
# https://github.com/moby/buildkit/issues/1896
name: Move cache
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
- name: Login to GHCR
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Compose release candidate metadata - golang-with-libgit2-all
id: meta_libgit2_all
uses: docker/metadata-action@v3
if: github.event_name != 'pull_request'
with:
images: |
ghcr.io/${{ github.repository_owner }}/golang-with-libgit2-all
tags: |
type=semver,pattern=v{{version}}
type=sha
type=sha,format=long
- name: Release candidate image - golang-with-libgit2-all
id: release_candidate_libgit2_all
if: github.event_name != 'pull_request'
uses: docker/build-push-action@v3
with:
context: .
file: Dockerfile
platforms: ${{ env.PLATFORMS }}
push: true
tags: ${{ steps.meta_libgit2_all.outputs.tags }}
labels: ${{ steps.meta_libgit2_all.outputs.labels }}
cache-from: type=local,src=/tmp/.buildx-cache
- name: Sign images
env:
COSIGN_EXPERIMENTAL: 1
run: |
array=($(echo ${{ steps.meta_libgit2_all.outputs.tags }} | tr '\n' " "))
for image in "${array[@]}"
do
echo "Signing $image"
cosign sign $image
done

docker-build-libgit2-only:
runs-on: ubuntu-latest
env:
PLATFORMS: linux/amd64,linux/arm/v7,linux/arm64
Expand Down
117 changes: 6 additions & 111 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,30 +17,6 @@ permissions:
id-token: write # needed for keyless signing

jobs:
linux-x86_64-all-libs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Build static libraries - libgit2 compiled with libssh2 and openssl
run: |
TARGET_DIR=${GITHUB_WORKSPACE}/build/libgit2-linux-all-libs \
BUILD_ROOT_DIR=${GITHUB_WORKSPACE}/libgit2/build/amd \
./hack/static.sh all

mkdir -p ./libgit2-linux-all-libs/
mv ${GITHUB_WORKSPACE}/build/libgit2-linux-all-libs/include ./libgit2-linux-all-libs/
mv ${GITHUB_WORKSPACE}/build/libgit2-linux-all-libs/share ./libgit2-linux-all-libs/
mv ${GITHUB_WORKSPACE}/build/libgit2-linux-all-libs/lib ./libgit2-linux-all-libs/
mv ${GITHUB_WORKSPACE}/build/libgit2-linux-all-libs/lib64 ./libgit2-linux-all-libs/

tar -zcvf linux-x86_64-all-libs.tar.gz libgit2-linux-all-libs
rm -rf ${GITHUB_WORKSPACE}/build ${GITHUB_WORKSPACE}/libgit2
- uses: actions/upload-artifact@v3
with:
name: release-artifact
path: "*.tar.gz"
if-no-files-found: error

linux-x86_64-libgit2-only:
runs-on: ubuntu-latest
Expand All @@ -65,88 +41,6 @@ jobs:
path: "*.tar.gz"
if-no-files-found: error

darwin-all-libs:
# This job builds and releases "universal libraries" that are
# supported by both darwin-amd64 and darwin-arm64.
#
# First builds in amd64, then cross-compile in arm64. Later combining
# both outcomes onto a single binary for each static library.
#
# `macos-11` has been picked as support for arm64 was only added on Xcode 12.
# Although some minor versions of Catalina 10.15 can support it, at the time
# of testing, GitHub's macos-10.15 did not seem to.
# Cross-compiling to arm64 on that runner consistently failed.
runs-on: macos-11
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Build universal static libraries for Darwin - libgit2 compiled with libssh2 and openssl
run: |
# The amd64 is used as base, using the target dir name (darwin-all-libs)
# instead of the platform specific one, removes the need of replacing the
# path in the .pc files.
TARGET_DIR=${GITHUB_WORKSPACE}/build/darwin-all-libs \
BUILD_ROOT_DIR=${GITHUB_WORKSPACE}/libgit2/build/amd \
./hack/static.sh all

TARGET_DIR=${GITHUB_WORKSPACE}/build/libgit2-darwin-arm64 \
BUILD_ROOT_DIR=${GITHUB_WORKSPACE}/libgit2/build/arm \
TARGET_ARCH=arm64 \
CMAKE_APPLE_SILICON_PROCESSOR=arm64 \
./hack/static.sh all


LIBGIT2_SED="s;-L/Applications/Xcode.* ;;g"
LIBGIT2PC="${GITHUB_WORKSPACE}/build/darwin-all-libs/lib/pkgconfig/libgit2.pc"

# pkgconfig includes absolute paths that are specific to the runner machine.
# We need to remove the absolute path for iconv, so when the libgit2 library
# is consumed pkgconfig will automatically try to find it through the default
# search paths on the target machine.
if command -v gsed &> /dev/null; then
gsed -i "${LIBGIT2_SED}" "${LIBGIT2PC}"
else
sed -i "" "${LIBGIT2_SED}" "${LIBGIT2PC}"
fi

mkdir -p ./darwin-all-libs/lib
mv ${GITHUB_WORKSPACE}/build/darwin-all-libs/include ./darwin-all-libs/
mv ${GITHUB_WORKSPACE}/build/darwin-all-libs/share ./darwin-all-libs/
mv ${GITHUB_WORKSPACE}/build/darwin-all-libs/lib/cmake ./darwin-all-libs/lib/
mv ${GITHUB_WORKSPACE}/build/darwin-all-libs/lib/engines-3 ./darwin-all-libs/lib/
mv ${GITHUB_WORKSPACE}/build/darwin-all-libs/lib/ossl-modules ./darwin-all-libs/lib/
mv ${GITHUB_WORKSPACE}/build/darwin-all-libs/lib/pkgconfig ./darwin-all-libs/lib/

libtool -static -o ./darwin-all-libs/lib/libcrypto.a \
${GITHUB_WORKSPACE}/build/darwin-all-libs/lib/libcrypto.a \
${GITHUB_WORKSPACE}/build/libgit2-darwin-arm64/lib/libcrypto.a

libtool -static -o ./darwin-all-libs/lib/libgit2.a \
${GITHUB_WORKSPACE}/build/darwin-all-libs/lib/libgit2.a \
${GITHUB_WORKSPACE}/build/libgit2-darwin-arm64/lib/libgit2.a

libtool -static -o ./darwin-all-libs/lib/libssh2.a \
${GITHUB_WORKSPACE}/build/darwin-all-libs/lib/libssh2.a \
${GITHUB_WORKSPACE}/build/libgit2-darwin-arm64/lib/libssh2.a

libtool -static -o ./darwin-all-libs/lib/libssl.a \
${GITHUB_WORKSPACE}/build/darwin-all-libs/lib/libssl.a \
${GITHUB_WORKSPACE}/build/libgit2-darwin-arm64/lib/libssl.a

libtool -static -o ./darwin-all-libs/lib/libz.a \
${GITHUB_WORKSPACE}/build/darwin-all-libs/lib/libz.a \
${GITHUB_WORKSPACE}/build/libgit2-darwin-arm64/lib/libz.a

tar -zcvf darwin-all-libs.tar.gz darwin-all-libs
rm -rf ${GITHUB_WORKSPACE}/build ${GITHUB_WORKSPACE}/libgit2
env:
MACOSX_DEPLOYMENT_TARGET: 10.15
- uses: actions/upload-artifact@v3
with:
name: release-artifact
path: "*.tar.gz"
if-no-files-found: error

# similar to darwin-all-libs, but only compiles libgit2.
darwin-libgit2-only:
runs-on: macos-11
Expand All @@ -165,17 +59,20 @@ jobs:
CMAKE_APPLE_SILICON_PROCESSOR=arm64 \
./hack/static.sh build_libgit2_only

LIBGIT2_SED="s;-L/Applications/Xcode.* ;;g"
LIBGIT2_WORKDIR_SED="s;${GITHUB_WORKSPACE}/build/libgit2-darwin-amd64;${GITHUB_WORKSPACE}/build/darwin-libgit2-only;g"
LIBGIT2_XCODE_SED="s;-L/Applications/Xcode.* ;;g"
LIBGIT2PC="${GITHUB_WORKSPACE}/build/libgit2-darwin-amd64/lib/pkgconfig/libgit2.pc"

# pkgconfig includes absolute paths that are specific to the runner machine.
# We need to remove the absolute path for iconv, so when the libgit2 library
# is consumed pkgconfig will automatically try to find it through the default
# search paths on the target machine.
if command -v gsed &> /dev/null; then
gsed -i "${LIBGIT2_SED}" "${LIBGIT2PC}"
gsed -i "${LIBGIT2_WORKDIR_SED}" "${LIBGIT2PC}"
gsed -i "${LIBGIT2_XCODE_SED}" "${LIBGIT2PC}"
else
sed -i "" "${LIBGIT2_SED}" "${LIBGIT2PC}"
sed -i "" "${LIBGIT2_WORKDIR_SED}" "${LIBGIT2PC}"
sed -i "" "${LIBGIT2_XCODE_SED}" "${LIBGIT2PC}"
fi

mkdir ./darwin-libgit2-only
Expand All @@ -200,9 +97,7 @@ jobs:
runs-on: ubuntu-latest
needs:
[
linux-x86_64-all-libs,
linux-x86_64-libgit2-only,
darwin-all-libs,
darwin-libgit2-only,
]
if: ${{ always() && contains(join(needs.*.result, ','), 'success') }}
Expand Down
9 changes: 0 additions & 9 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@ permissions: {}

jobs:
darwin-dev-test:
strategy:
matrix:
libgit_only: [true, false]
runs-on: macos-11
steps:
- name: Checkout
Expand All @@ -26,13 +23,9 @@ jobs:
rm -rf ${GITHUB_WORKSPACE}/build
make dev-test
env:
LIBGIT2_ONLY: ${{ matrix.libgit_only }}
MACOSX_DEPLOYMENT_TARGET: 10.15

linux-dev-test:
strategy:
matrix:
libgit_only: [true, false]
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand All @@ -41,5 +34,3 @@ jobs:
run: |
rm -rf ${GITHUB_WORKSPACE}/build
make dev-test
env:
LIBGIT2_ONLY: ${{ matrix.libgit_only }}
83 changes: 0 additions & 83 deletions Dockerfile

This file was deleted.

Loading