test #14
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: build | |
on: | |
workflow_dispatch: | |
push: | |
# branches: [main] | |
jobs: | |
build: | |
name: ${{ matrix.arch }} | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
# - arch: arm64 | |
# tool: aarch64-unknown-linux-musl | |
# - arch: arm | |
# tool: arm-unknown-linux-musleabi | |
# - arch: armhf | |
# tool: arm-unknown-linux-musleabihf | |
# - arch: armv7 | |
# tool: armv7-unknown-linux-musleabi | |
# - arch: armv7hf | |
# tool: armv7-unknown-linux-musleabihf | |
# - arch: loong64 | |
# tool: loongarch64-unknown-linux-musl | |
# - arch: m68k | |
# tool: m68k-unknown-linux-musl | |
# - arch: mips64el | |
# tool: mips64el-unknown-linux-musl | |
# - arch: mips64 | |
# tool: mips64-unknown-linux-musl | |
# - arch: mipsel | |
# tool: mipsel-unknown-linux-musl | |
# - arch: mipselsf | |
# tool: mipsel-unknown-linux-muslsf | |
# - arch: mips | |
# tool: mips-unknown-linux-musl | |
# - arch: mipssf | |
# tool: mips-unknown-linux-muslsf | |
# - arch: ppc64 | |
# tool: powerpc64-unknown-linux-musl | |
# - arch: ppc | |
# tool: powerpc-unknown-linux-musl | |
# - arch: riscv | |
# tool: riscv32-unknown-linux-musl | |
# - arch: riscv64 | |
# tool: riscv64-unknown-linux-musl | |
# - arch: s390x | |
# tool: s390x-ibm-linux-musl | |
# - arch: sh | |
# tool: sh-multilib-linux-musl | |
# - arch: x86 | |
# tool: x86_64-multilib-linux-musl | |
# env: | |
# CFLAGS: '-m32' | |
# LDFLAGS: '-m32' | |
- arch: x86-64 | |
tool: x86_64-multilib-linux-musl | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
ref: main | |
- name: Set up build tools | |
env: | |
REPO: 'spvkgn/musl-cross' | |
TOOL: ${{ matrix.tool }} | |
run: | | |
mkdir -p $HOME/tools | |
wget -qO- https://github.com/$REPO/releases/download/latest/$TOOL.tar.xz | tar -C $HOME/tools -xJ || exit 1 | |
[ -d "$HOME/tools/$TOOL/bin" ] && echo "$HOME/tools/$TOOL/bin" >> $GITHUB_PATH | |
- name: Build | |
id: build | |
env: | |
ARCH: ${{ matrix.arch }} | |
TOOL: ${{ matrix.tool }} | |
CFLAGS: ${{ matrix.env.CFLAGS }} | |
LDFLAGS: ${{ matrix.env.LDFLAGS }} | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
COMMIT_SHA=$(gh api repos/${{ github.repository }}/commits/main --jq '.sha[:7]') | |
sed -i 's/-O2/-Os/' Makefile | |
CC=$TOOL-gcc \ | |
LD=$TOOL-ld \ | |
AR=$TOOL-ar \ | |
NM=$TOOL-nm \ | |
STRIP=$TOOL-strip \ | |
CFLAGS="-static-libgcc -static $CFLAGS" \ | |
LDFLAGS="-static-libgcc -static $LDFLAGS" \ | |
make V=s -j$(nproc) || exit 1 | |
$TOOL-strip -s ciadpi | |
[ -x ciadpi ] && tar -cJvf byedpi-$COMMIT_SHA-$ARCH.tar.xz ciadpi | |
- name: Upload artifacts | |
if: steps.build.outcome == 'success' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: byedpi-${{ matrix.arch }} | |
path: ./**/byedpi-*.tar.xz | |
release: | |
if: false | |
needs: build | |
permissions: | |
contents: write | |
env: | |
tag_name: latest | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download artifacts | |
uses: actions/download-artifact@v4 | |
- name: GH | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
gh release delete ${{ env.tag_name }} --cleanup-tag -y -R ${{ github.repository }} || true | |
echo "DATE=$(gh api repos/${{ github.repository }}/commits/main --jq '.commit.committer.date' | date -f - +%Y%m%d)" >> $GITHUB_ENV | |
- name: Upload release assets | |
uses: softprops/action-gh-release@v2 | |
with: | |
fail_on_unmatched_files: true | |
prerelease: false | |
draft: false | |
tag_name: ${{ env.tag_name }} | |
name: ${{ env.DATE }} | |
target_commitish : main | |
files: | | |
./**/byedpi-*.tar.xz |