Skip to content

ld

ld #256

Workflow file for this run

name: ld
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
schedule:
- cron: '0 8 */6 * *' # every 6 days
workflow_dispatch:
inputs:
release:
description: 'Create GitHub Release'
required: false
type: boolean
push:
branches:
- 'master'
tags:
- 'v*'
paths:
- '.github/workflows/ld.yml'
- 'src/ld/**'
- 'docker-bake.hcl'
pull_request:
paths:
- '.github/workflows/ld.yml'
- 'src/ld/**'
- 'docker-bake.hcl'
jobs:
binutils-targets:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.targets.outputs.matrix }}
steps:
-
name: Checkout
uses: actions/checkout@v4
-
name: Create targets matrix
id: targets
run: |
matrix=$(docker buildx bake binutils --print | jq -cr '.group.binutils.targets')
echo "matrix=${matrix}" >> ${GITHUB_OUTPUT}
-
name: Show matrix
run: |
echo ${{ steps.targets.outputs.matrix }}
binutils:
runs-on: ubuntu-latest
needs:
- binutils-targets
strategy:
fail-fast: false
matrix:
target: ${{ fromJson(needs.binutils-targets.outputs.matrix) }}
steps:
-
name: Checkout
uses: actions/checkout@v4
-
name: Set up QEMU
uses: docker/setup-qemu-action@v3
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
-
name: Build
uses: docker/bake-action@v5
with:
targets: ${{ matrix.target }}
set: |
*.cache-from=type=gha,scope=${{ matrix.target }}
*.cache-to=type=gha,scope=${{ matrix.target }}
ld64:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v4
-
name: Set up QEMU
uses: docker/setup-qemu-action@v3
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
-
name: Build
uses: docker/bake-action@v5
with:
targets: ld64-static-tgz
set: |
ld64-static-tgz.cache-from=type=gha,scope=ld64-static-tgz
ld64-static-tgz.cache-to=type=gha,scope=ld64-static-tgz
ld64-static-tgz.output=type=local,dest=./dist
-
name: Rename provenance
run: |
for pdir in ./dist/*/; do
(
cd "$pdir"
binname=$(find . -name '*.tar.gz')
filename=$(basename "${binname%.tar.gz}")
mv "provenance.json" "${filename}.provenance.json"
)
done
-
name: Move and list artifacts
run: |
mv ./dist/**/* ./dist/
tree -nh ./dist
-
name: Upload artifacts
if: ${{ inputs.release }}
uses: actions/upload-artifact@v4
with:
name: ld-ld64
path: ./dist/*
if-no-files-found: error
retention-days: 1
ld-targets:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.targets.outputs.matrix }}
steps:
-
name: Checkout
uses: actions/checkout@v4
-
name: Create targets matrix
id: targets
run: |
matrix=$(docker buildx bake ld-static-tgz --print | jq -cr '.group."ld-static-tgz".targets')
echo "matrix=${matrix}" >> ${GITHUB_OUTPUT}
-
name: Show matrix
run: |
echo ${{ steps.targets.outputs.matrix }}
ld:
runs-on: ubuntu-latest
needs:
- ld-targets
strategy:
fail-fast: false
matrix:
target: ${{ fromJson(needs.ld-targets.outputs.matrix) }}
steps:
-
name: Checkout
uses: actions/checkout@v4
-
name: Set up QEMU
uses: docker/setup-qemu-action@v3
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
-
name: Build
uses: docker/bake-action@v5
with:
targets: ${{ matrix.target }}
set: |
*.cache-from=type=gha,scope=${{ matrix.target }}
*.cache-to=type=gha,scope=${{ matrix.target }}
*.output=type=local,dest=./dist
-
name: Rename provenance
run: |
for pdir in ./dist/*/; do
(
cd "$pdir"
binname=$(find . -name '*.tar.gz')
filename=$(basename "${binname%.tar.gz}")
mv "provenance.json" "${filename}.provenance.json"
)
done
-
name: Move and list artifacts
run: |
mv ./dist/**/* ./dist/
tree -nh ./dist
-
name: Upload artifacts
if: ${{ inputs.release }}
uses: actions/upload-artifact@v4
with:
name: ld-${{ matrix.target }}
path: ./dist/*
if-no-files-found: error
retention-days: 1
utils-lipo:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v4
-
name: Set up QEMU
uses: docker/setup-qemu-action@v3
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
-
name: Build
uses: docker/bake-action@v5
with:
targets: lipo
set: |
lipo.cache-from=type=gha,scope=lipo
lipo.cache-to=type=gha,scope=lipo
utils-sigtool:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v4
-
name: Set up QEMU
uses: docker/setup-qemu-action@v3
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
-
name: Build
uses: docker/bake-action@v5
with:
targets: sigtool
set: |
sigtool.cache-from=type=gha,scope=sigtool
sigtool.cache-to=type=gha,scope=sigtool
release:
runs-on: ubuntu-latest
if: ${{ inputs.release }}
needs:
- ld
- ld64
steps:
-
name: Checkout
uses: actions/checkout@v4
-
name: Prepare
run: |
version=$(docker buildx bake ld-linux-amd64-static-tgz --print | jq -cr '.target."ld-linux-amd64-static-tgz".args."BINUTILS_VERSION"')
echo "VERSION=${version}" >> $GITHUB_ENV
-
name: Download artifacts
uses: actions/download-artifact@v4
with:
path: ./dist
pattern: ld-*
merge-multiple: true
-
name: GitHub Release
uses: softprops/action-gh-release@v2
with:
name: prebuilt/ld-${{ env.VERSION }}-${{ github.run_number }}
tag_name: prebuilt/ld-${{ env.VERSION }}-${{ github.run_number }}
prerelease: true
files: dist/*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
-
name: Generate src/xx-ld-shas
run: |
bash ./hack/generate-ld-shas
env:
DIST: ./dist
GITHUB_RELEASE_TAG: prebuilt/ld-${{ env.VERSION }}-${{ github.run_number }}
-
name: Create PR
uses: peter-evans/create-pull-request@d121e62763d8cc35b5fb1710e887d6e69a52d3a4 # v7.0.2
with:
base: master
branch: bot/generate-ld-shas
commit-message: "update src/xx-ld-shas"
add-paths: src/xx-ld-shas
signoff: true
delete-branch: true
title: "Update `src/xx-ld-shas`"
draft: false