-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci, gha: Add Windows jobs based on Linux image
- Loading branch information
Showing
3 changed files
with
267 additions
and
0 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
on: | ||
workflow_call: | ||
inputs: | ||
dockerfile: | ||
description: 'Dockerfile that defines an image' | ||
required: true | ||
type: string | ||
tag: | ||
description: 'Tag of an image' | ||
default: ci-image | ||
required: false | ||
type: string | ||
common_env_vars: | ||
description: 'Environment variables provided by a caller workflow as a JSON object' | ||
required: false | ||
type: string | ||
matrix_env_vars: | ||
description: 'Environment variables provided by a matrix as a JSON object' | ||
required: false | ||
type: string | ||
|
||
jobs: | ||
container: | ||
runs-on: ubuntu-latest | ||
env: ${{ fromJSON(inputs.common_env_vars) }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set environment variables | ||
run: | | ||
for var in "$(echo '${{ inputs.matrix_env_vars }}' | jq -r 'to_entries | .[] | "\(.key)=\(.value)"')"; do | ||
echo "$var" >> "$GITHUB_ENV" | ||
done | ||
echo "MAKEFLAGS=-j$(($(nproc) + 1))" >> "$GITHUB_ENV" | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
|
||
- name: Build container | ||
uses: docker/build-push-action@v4 | ||
with: | ||
context: . | ||
file: ${{ inputs.dockerfile }} | ||
tags: ${{ inputs.tag }} | ||
push: false | ||
load: true | ||
cache-from: type=gha | ||
|
||
- name: CI script | ||
run: > | ||
docker run \ | ||
$(echo '${{ toJSON(env) }}' | jq -r 'keys[] | "-e \(.)"' | paste -sd " ") \ | ||
--volume ${{ github.workspace }}:${{ github.workspace }} \ | ||
--workdir ${{ github.workspace }} \ | ||
${{ inputs.tag }} bash -c " \ | ||
git config --global --add safe.directory ${{ github.workspace }} && \ | ||
./ci/cirrus.sh \ | ||
" | ||
- name: tests.log | ||
run: | | ||
cat tests.log || true | ||
if: ${{ always() }} | ||
|
||
- name: noverify_tests.log | ||
run: | | ||
cat noverify_tests.log || true | ||
if: ${{ always() }} | ||
|
||
- name: exhaustive_tests.log | ||
run: | | ||
cat exhaustive_tests.log || true | ||
if: ${{ always() }} | ||
|
||
- name: ctime_tests.log | ||
run: | | ||
cat ctime_tests.log || true | ||
if: ${{ always() }} | ||
|
||
- name: bench.log | ||
run: | | ||
cat bench.log || true | ||
if: ${{ always() }} | ||
|
||
- name: config.log | ||
run: | | ||
cat config.log || true | ||
if: ${{ always() }} | ||
|
||
- name: test_env.log | ||
run: | | ||
cat test_env.log || true | ||
if: ${{ always() }} | ||
|
||
- name: CI env | ||
run: env | ||
if: ${{ always() }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
FROM debian:stable-slim | ||
|
||
SHELL ["/bin/bash", "-c"] | ||
|
||
WORKDIR /root | ||
|
||
# The "wine" package provides a convenience wrapper that we need | ||
RUN dpkg --add-architecture i386 && apt-get update && apt-get install --no-install-recommends -y \ | ||
autoconf automake libtool make \ | ||
gcc-mingw-w64-x86-64-win32 \ | ||
gcc-mingw-w64-i686-win32 \ | ||
git ca-certificates wine64 wine32:i386 wine python3-simplejson python3-six msitools winbind procps && \ | ||
# Workaround for `wine` package failure to employ the Debian alternatives system properly. | ||
ln -s /usr/lib/wine/wine64 /usr/bin/wine64 && \ | ||
# Set of tools for using MSVC on Linux. | ||
git clone https://github.com/mstorsjo/msvc-wine && \ | ||
mkdir /opt/msvc && \ | ||
python3 msvc-wine/vsdownload.py --accept-license --dest /opt/msvc Microsoft.VisualStudio.Workload.VCTools && \ | ||
# Since commit 2146cbfaf037e21de56c7157ec40bb6372860f51, the | ||
# msvc-wine effectively initializes the wine prefix when running | ||
# the install.sh script. | ||
msvc-wine/install.sh /opt/msvc && \ | ||
# Wait until the wineserver process has exited before closing the session, | ||
# to avoid corrupting the wine prefix. | ||
while (ps -A | grep wineserver) > /dev/null; do sleep 1; done |