Skip to content

Commit

Permalink
Add workflow for mingw-w64-gcc package testing
Browse files Browse the repository at this point in the history
  • Loading branch information
Blackhex committed Sep 3, 2024
1 parent 3cb0c8b commit e23135a
Show file tree
Hide file tree
Showing 5 changed files with 307 additions and 16 deletions.
5 changes: 4 additions & 1 deletion .github/scripts/build-package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,18 @@ 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 "") \
$([ "$NO_CHECK" = 1 ] && echo "--nocheck " || echo "") \
$([ "$NO_ARCHIVE" = 1 ] && echo "--noarchive" || echo "") \
$([ "$CLEAN_BUILD" = 1 ] && echo "--cleanbuild" || echo "") \
$([ "$INSTALL_PACKAGE" = 1 ] && echo "--install" || echo "")"

Expand Down
14 changes: 14 additions & 0 deletions .github/scripts/patch-dejagnu.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/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`

pushd /
echo "::group::Patch Dejagnu"
patch -p1 -b -i "$DIR/patches/dejagnu/0001-local-exec.patch"
echo "::endgroup::"
popd
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:
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 to build for'
required: false
default: 'x86_64'
tag:
description: 'Tag to use for the artifact'
required: true
gcc_module:
description: 'GCC module to test'
required: false
default: ''
gcc_test_filter:
description: 'GCC test filter'
required: false
default: ''
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' }}
arch: ${{ inputs.arch || 'x86_64' }}
check: true
check_module: ${{ inputs.gcc_module || 'gcc-c' }}
check_filter: ${{ inputs.gcc_test_filter || 'compile.exp=103818.c' }}

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
ref: fix-create-summary

- 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
67 changes: 52 additions & 15 deletions .github/workflows/build-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,33 +6,54 @@ on:
package_name:
description: "Package name to build"
type: string
packages_repository:
description: "MSYS2 packages repository to build from"
type: string
default: "Windows-on-ARM-Experiments/MSYS2-packages"
packages_branch:
description: "MSYS2 packages branch to build from"
type: string
default: "woarm64"
arch:
description: "Architecture to build for"
type: string
default: "aarch64"
needs:
description: "Parent workflow job dependencies"
type: string
dependencies:
description: "Install additional dependencies"
type: string
default: ""
packages_repository:
description: "MSYS2 packages repository to build from"
check:
description: "Enable check step after the package is built"
type: boolean
default: false
check_module:
description: "Module to test"
type: string
default: "Windows-on-ARM-Experiments/MSYS2-packages"
packages_branch:
description: "MSYS2 packages branch to build from"
default: ""
check_filter:
description: "Test filter"
type: string
default: "woarm64"
default: ""

defaults:
run:
shell: msys2 {0}

env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NO_CHECK: ${{ inputs.check && '0' || '1' }}
NO_ARCHIVE: ${{ inputs.check && '1' || '0' }}
MODULE: ${{ inputs.check_module }}
FILTER: ${{ inputs.check_filter }}

jobs:
build:
name: Build ${{ inputs.package_name }}
runs-on: windows-latest
timeout-minutes: 720

steps:
- uses: msys2/setup-msys2@v2
Expand All @@ -42,14 +63,24 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4

- name: Checkout ${{ inputs.packages_repository }} repository
uses: actions/checkout@v4
with:
repository: ${{ inputs.packages_repository }}
ref: ${{ inputs.packages_branch }}
sparse-checkout: ${{ inputs.package_name }}
path: ${{ github.workspace }}/packages

- name: Install dependencies
run: |
pacman -S --noconfirm \
git \
mingw-w64-x86_64-github-cli \
mingw-w64-x86_64-jq \
base-devel \
${{ contains(inputs.packages_repository, 'MINGW') && 'mingw-w64-cross-gcc mingw-w64-x86_64-ccache' || ' ccache' }} \
ccache \
${{ contains(inputs.packages_repository, 'MINGW') && format('{0}-{1}-{2}', 'mingw-w64', inputs.arch, 'gcc')|| '' }} \
${{ inputs.check && 'dejagnu' || '' }} \
${{ inputs.dependencies }}
- name: Download artifacts
Expand All @@ -67,13 +98,10 @@ jobs:
run: |
`cygpath "${{ github.workspace }}"`/.github/scripts/pthread-headers-hack-before.sh
- name: Checkout ${{ inputs.packages_repository }} repository
uses: actions/checkout@v4
with:
repository: ${{ inputs.packages_repository }}
ref: ${{ inputs.packages_branch }}
sparse-checkout: ${{ inputs.package_name }}
path: ${{ github.workspace }}/packages
- name: Patch Dejagnu
if: ${{ inputs.check }}
run: |
`cygpath "${{ github.workspace }}"`/.github/scripts/patch-dejagnu.sh
- name: Enable Ccache
id: enable-ccache
Expand All @@ -87,7 +115,7 @@ jobs:
key: main-ccache-${{ steps.enable-ccache.outputs.timestamp }}
restore-keys: main-ccache-

- name: Build ${{ inputs.package_name }}
- name: Build ${{ inputs.check && 'and test' || '' }} ${{ inputs.package_name }}
working-directory: ${{ github.workspace }}/packages/${{ inputs.package_name }}
run: |
ccache -svv || true
Expand All @@ -102,12 +130,21 @@ jobs:
key: main-ccache-${{ steps.enable-ccache.outputs.timestamp }}

- name: Upload ${{ inputs.package_name }}
if: ${{ !inputs.check }}
uses: actions/upload-artifact@v4
with:
name: ${{ inputs.package_name }}
retention-days: 1
path: ${{ github.workspace }}/packages/${{ inputs.package_name }}/*.pkg.tar.zst

- name: Upload ${{ inputs.package_name }} test results
if: ${{ inputs.check }}
uses: actions/upload-artifact@v4
with:
name: ${{ inputs.package_name }}-test-results
retention-days: 14
path: ${{ github.workspace }}/packages/${{ inputs.package_name }}/src/test-results

- name: Upload build folder
if: failure()
uses: actions/upload-artifact@v4
Expand Down
Loading

0 comments on commit e23135a

Please sign in to comment.