Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Add workflow for mingw-w64-gcc package testing #15

Draft
wants to merge 2 commits into
base: native-mingw-toolchain
Choose a base branch
from
Draft
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
37 changes: 23 additions & 14 deletions .github/scripts/build-package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,33 @@ PACKAGE_REPOSITORY=$1
CLEAN_BUILD=${CLEAN_BUILD:-0}
INSTALL_PACKAGE=${INSTALL_PACKAGE:-0}
NO_EXTRACT=${NO_EXTRACT:-0}
NO_CHECK=${NO_CHECK:-1}
NO_ARCHIVE=${NO_ARCHIVE:-0}

ARGUMENTS="--syncdeps \
--rmdeps \
--noconfirm \
--noprogressbar \
--nocheck \
--skippgpcheck \
--force \
$([ "$NO_EXTRACT" = 1 ] && echo "--noextract" || echo "") \
$([ "$CLEAN_BUILD" = 1 ] && echo "--cleanbuild" || echo "") \
$([ "$INSTALL_PACKAGE" = 1 ] && echo "--install" || echo "")"
--rmdeps \
--noconfirm \
--noprogressbar \
--skippgpcheck \
--force \
$([ "$NO_EXTRACT" = 1 ] && echo "--noextract" || echo "") \
$([ "$NO_CHECK" = 1 ] && echo "--nocheck " || echo "") \
$([ "$NO_ARCHIVE" = 1 ] && echo "--noarchive" || echo "") \
$([ "$CLEAN_BUILD" = 1 ] && echo "--cleanbuild" || echo "") \
$([ "$INSTALL_PACKAGE" = 1 ] && echo "--install" || echo "")"

ccache -svv || true
echo "::group::Ccache statistics before build"
ccache -svv || true
echo "::endgroup::"

if [[ "$PACKAGE_REPOSITORY" == *MINGW* ]]; then
echo "::group::Build package"
if [[ "$PACKAGE_REPOSITORY" == *MINGW* ]]; then
makepkg-mingw $ARGUMENTS
else
else
makepkg $ARGUMENTS
fi
fi
echo "::endgroup::"

ccache -svv || true
echo "::group::Ccache statistics after build"
ccache -svv || true
echo "::endgroup::"
30 changes: 30 additions & 0 deletions .github/scripts/check-package.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/bash

set -e # exit on error
set -x # echo on
set -o pipefail # fail of any command in pipeline is an error

PACKAGE_REPOSITORY=$1

INSTALL_PACKAGE=${INSTALL_PACKAGE:-0}
NO_EXTRACT=${NO_EXTRACT:-1}
NO_ARCHIVE=${NO_ARCHIVE:-1}

ARGUMENTS="--syncdeps \
--rmdeps \
--noconfirm \
--noprogressbar \
--skippgpcheck \
--recheck \
--force \
$([ "$NO_EXTRACT" = 1 ] && echo "--noextract" || echo "") \
$([ "$NO_ARCHIVE" = 1 ] && echo "--noarchive" || echo "") \
$([ "$INSTALL_PACKAGE" = 1 ] && echo "--install" || echo "")"

echo "::group::Check package"
if [[ "$PACKAGE_REPOSITORY" == *MINGW* ]]; then
makepkg-mingw $ARGUMENTS
else
makepkg $ARGUMENTS
fi
echo "::endgroup::"
19 changes: 19 additions & 0 deletions .github/scripts/create-repository.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash

set -e # exit on error
set -x # echo on
set -o pipefail # fail of any command in pipeline is an error

echo "::group::Create MSYS2 packages repository"
mkdir -p repository/msys/x86_64
mv -f mingw-w64-cross-*.pkg.* repository/msys/x86_64/
pushd repository/msys/x86_64
repo-add woarm64-cross.db.tar.gz *.pkg.*
popd

mkdir -p repository/mingw/aarch64
mv -f mingw-w64-aarch64-*.pkg.* repository/mingw/aarch64/
pushd repository/mingw/aarch64
repo-add woarm64-native.db.tar.gz *.pkg.*
popd
echo "::endgroup::"
10 changes: 6 additions & 4 deletions .github/scripts/download-artifacts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@ set -x # echo on
set -o pipefail # fail of any command in pipeline is an error

RUN_ID=$1
NEEDS=`echo "$2" | /mingw64/bin/jq 'keys|join(" ")' | sed 's/"//g'`

for NEED in $NEEDS; do
echo "Downloading $NEED artifact."
/mingw64/bin/gh run download $RUN_ID -n $NEED
for ARG in "${@:2}"; do
NEEDS=`echo "$ARG" | /mingw64/bin/jq 'keys|join(" ")' | sed 's/"//g'`
for NEED in $NEEDS; do
echo "Downloading $NEED artifact."
/mingw64/bin/gh run download $RUN_ID -n $NEED
done
done
17 changes: 16 additions & 1 deletion .github/scripts/enable-ccache.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,14 @@ set -o pipefail # fail of any command in pipeline is an error

DIR="`dirname ${BASH_SOURCE[0]}`/../.."
DIR=`realpath $DIR`
CCACHE_DIR=$DIR/ccache
if [[ -n "$GITHUB_WORKSPACE" ]]; then
echo "CCACHE_DIR=$DIR/ccache" >> "$GITHUB_ENV"
echo "CCACHE_DIR=$CCACHE_DIR" >> "$GITHUB_ENV"
echo timestamp=$(date -u --iso-8601=seconds) >> "$GITHUB_OUTPUT"
fi

mkdir -p $CCACHE_DIR

pushd /
echo "::group::/etc/makepkg.conf"
patch -p1 -b -i "$DIR/patches/ccache/0001-makepkg.patch"
Expand All @@ -22,3 +25,15 @@ pushd /
cat /etc/makepkg_mingw.conf
echo "::endgroup::"
popd

pacman -S --noconfirm ccache

pushd /usr/lib/ccache/bin
echo "::group::Add aarch64 toolchain to ccache"
export MSYS=winsymlinks
ln -sf /usr/bin/ccache aarch64-w64-mingw32-c++
ln -sf /usr/bin/ccache aarch64-w64-mingw32-g++
ln -sf /usr/bin/ccache aarch64-w64-mingw32-gcc
ln -sf /usr/bin/true makeinfo
echo "::endgroup::"
popd
32 changes: 32 additions & 0 deletions .github/scripts/pacman-workaround.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/bash

set -e # exit on error
set -x # echo on
set -o pipefail # fail of any command in pipeline is an error

if [ -z "$GITHUB_WORKSPACE" ]; then
DIR=`pwd`
else
DIR=`cygpath "$GITHUB_WORKSPACE"`
fi

echo "::group::Pacman hang workaround"
while ! timeout -k 15s 10s pacman -U --noconfirm "$DIR/patches/pacman/pacman-6.1.0-4-x86_64.pkg.tar.zst"
do
echo "Command failed, retrying..."
done
echo "::endgroup::"

echo "::group::Install patch"
pacman -S --noconfirm patch
echo "::endgroup::"

pushd /
echo "::group::Pin pacman packages"
patch -p1 -b -i "$DIR/patches/pacman/0001-pin-packages.patch"
echo "::endgroup::"

echo "::group::/etc/pacman.conf"
cat /etc/pacman.conf
echo "::endgroup::"
popd
18 changes: 18 additions & 0 deletions .github/scripts/patch-dejagnu.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash

set -e # exit on error
set -x # echo on
set -o pipefail # fail of any command in pipeline is an error

DIR="`dirname ${BASH_SOURCE[0]}`/../.."
DIR=`realpath $DIR`

echo "::group::Install patch"
pacman -S --noconfirm patch
echo "::endgroup::"

pushd /
echo "::group::Patch Dejagnu"
patch -p1 -b -i "$DIR/patches/dejagnu/0001-local-exec.patch"
echo "::endgroup::"
popd
21 changes: 21 additions & 0 deletions .github/scripts/patch-makepkg.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash

set -e # exit on error
set -x # echo on
set -o pipefail # fail of any command in pipeline is an error

if [ -z "$GITHUB_WORKSPACE" ]; then
DIR=`pwd`
else
DIR=`cygpath "$GITHUB_WORKSPACE"`
fi

echo "::group::Install patch"
pacman -S --noconfirm patch
echo "::endgroup::"

pushd /
echo "::group::Patch MSYS2 environment"
patch -p1 -b -i "$DIR/patches/makepkg/0004-add-recheck-option.patch"
echo "::endgroup::"
popd
39 changes: 39 additions & 0 deletions .github/scripts/setup-mingwarm64.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/bin/bash

set -e # exit on error
set -x # echo on
set -o pipefail # fail of any command in pipeline is an error

if [ -z "$GITHUB_WORKSPACE" ]; then
DIR=`pwd`
else
DIR=`cygpath "$GITHUB_WORKSPACE"`
fi

echo "::group::Install patch"
pacman -S --noconfirm patch
echo "::endgroup::"

pushd /
echo "::group::Patch MSYS2 environment"
patch -p1 -b -i "$DIR/patches/makepkg/0001-mingwarm64.patch"
if [[ "$CROSS_BUILD" = "1" ]]; then
patch -p1 -b -i "$DIR/patches/makepkg/0002-mingwarm64-cross-build.patch"
fi
if [[ "$DEBUG_BUILD" = "1" ]]; then
patch -p1 -b -i "$DIR/patches/makepkg/0003-enable-debug.patch"
fi
echo "::endgroup::"

echo "::group::/etc/makepkg_mingw.conf"
cat /etc/makepkg_mingw.conf
echo "::endgroup::"

echo "::group::/etc/profile"
cat /etc/profile
echo "::endgroup::"

echo "::group::/usr/share/makepkg/tidy/strip.sh"
cat /usr/share/makepkg/tidy/strip.sh
echo "::endgroup::"
popd
2 changes: 1 addition & 1 deletion .github/scripts/setup-repository.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pushd /
echo "::endgroup::"

echo "::group::Add WoArm64 repository"
patch -p1 -b -i "$DIR/patches/pacman/0001-add-woarm64-repository.patch"
patch -p1 -b -i "$DIR/patches/pacman/0002-add-woarm64-repositories.patch"
echo "::endgroup::"

echo "::group::Update packages database"
Expand Down
78 changes: 78 additions & 0 deletions .github/workflows/build-and-test-mingw-w64-gcc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: Build and test mingw-w64-gcc

on:
pull_request:
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shall be removed before merge.

workflow_dispatch:
inputs:
packages_repository:
description: "MSYS2 packages repository to build from"
type: string
default: "Windows-on-ARM-Experiments/MINGW-packages"
packages_branch:
description: "MSYS2 packages branch to build from"
type: string
default: "woarm64"
arch:
description: 'Architecture that should be built and tested'
required: false
default: 'aarch64'
tag:
description: 'Tag to use for the artifact'
required: true
gcc_module:
description: 'GCC module to test'
required: false
default: 'gcc-c'
gcc_test_filter:
description: 'GCC test filter'
required: false
default: 'compile.exp=103818.c'
workflow_call:
inputs:
packages_repository:
type: string
packages_branch:
type: string
arch:
type: string
tag:
type: string
gcc_module:
type: string
gcc_test_filter:
type: string

jobs:
build-and-test-mingw-w64-gcc:
name: Build and test mingw-w64-gcc
uses: ./.github/workflows/build-package.yml
with:
package_name: mingw-w64-gcc
packages_repository: ${{ inputs.packages_repository || 'Windows-on-ARM-Experiments/MINGW-packages' }}
packages_branch: ${{ inputs.packages_branch || 'woarm64' }}
runner_arch: ${{ inputs.arch || 'aarch64' }}
cross_build: false
check: true
check_module: ${{ inputs.gcc_module || 'gcc-c' }}
check_filter: ${{ inputs.gcc_test_filter || '' }}

create-summary:
needs: build-and-test-mingw-w64-gcc
name: Create summary
runs-on: ubuntu-latest

steps:
- name: Checkout mingw-woarm64-build repository
uses: actions/checkout@v4
with:
repository: Windows-on-ARM-Experiments/mingw-woarm64-build

- name: Download test results artifacts
uses: actions/download-artifact@v4
with:
name: mingw-w64-gcc-test-results
path: ${{ github.workspace }}/test-results

- name: Create summary
run: |
.github/scripts/toolchain/create-gcc-summary.sh ${{ github.workspace }}/test-results >> $GITHUB_STEP_SUMMARY
Loading
Loading