Skip to content

build

build #282

Workflow file for this run

name: build
on:
push:
pull_request:
schedule:
- cron: '0 0 1 * *' # monthly
jobs:
build-native:
runs-on: windows-2022
strategy:
matrix:
target: [mingw64, mingw32]
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 1
submodules: recursive
- name: Cache Downloads
id: cache-downloads
uses: actions/cache@v3
with:
path: |
downloads/*.7z
downloads/*.zip
key: ${{ runner.os }}-${{ hashFiles('ci/dependencies.ps1') }}
- run: Get-Host | Select-Object Version
- run: python -m pip install gcovr
- name: Build
run: .\ci\build.ps1 -target ${{ matrix.target }} -coverage
- name: codecov
uses: codecov/codecov-action@v3
if: "!(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/'))"
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: cobertura.xml
functionalities: search
fail_ci_if_error: true
verbose: false
- name: Upload artifact
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
uses: actions/upload-artifact@v3
with:
name: drmingw-${{ matrix.target }}
path: build/mingw??/drmingw-*.7z
if-no-files-found: error
build-cross-gcc:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 1
submodules: recursive
- run: sudo dpkg --add-architecture i386
# Workaround https://github.com/actions/virtual-environments/issues/4589
- run: |
sudo rm -f /etc/apt/sources.list.d/microsoft-prod.list
sudo apt-get update -qq
sudo apt-get install -yqq --allow-downgrades libgd3/jammy libpcre2-8-0/jammy libpcre2-16-0/jammy libpcre2-32-0/jammy libpcre2-posix3/jammy
sudo apt-get purge -yqq libmono* moby* mono* php* libgdiplus libzip4
- run: sudo apt-get install -yqq --install-recommends mingw-w64 ninja-build cmake xinit xvfb wine wine64 wine32:i386
- run: ci/build.sh
build-cross-clang:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 1
submodules: recursive
- name: Cache Downloads
id: cache-downloads
uses: actions/cache@v3
with:
path: downloads/*.xz
key: ${{ runner.os }}-${{ hashFiles('ci/dependencies-clang.sh') }}
- run: sudo dpkg --add-architecture i386
# Workaround https://github.com/actions/virtual-environments/issues/4589
- run: |
sudo rm -f /etc/apt/sources.list.d/microsoft-prod.list
sudo apt-get update -qq
sudo apt-get install -yqq --allow-downgrades libgd3/jammy libpcre2-8-0/jammy libpcre2-16-0/jammy libpcre2-32-0/jammy libpcre2-posix3/jammy
sudo apt-get purge -yqq libmono* moby* mono* php* libgdiplus libzip4
- run: sudo apt-get install -yqq --install-recommends ninja-build cmake xinit xvfb wine wine64 wine32:i386
- run: ci/build-clang.sh
- name: Upload artifact
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
uses: actions/upload-artifact@v3
with:
name: drmingw-clang
path: build/*-clang/drmingw-*.7z
if-no-files-found: error
# See https://github.com/actions/upload-release-asset
release:
# https://github.community/t/trigger-job-on-tag-push-only/18076/2
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
needs: [build-native, build-cross-clang]
runs-on: windows-2022
steps:
- uses: actions/download-artifact@v3
id: download
with:
path: artifacts
- run: Get-ChildItem -Recurse "${{ steps.download.outputs.download-path }}"
- name: Asset names
id: assets
run: |
$asset32 = Get-Item "${{ steps.download.outputs.download-path }}\drmingw-mingw32\mingw32\*.7z"
$asset64 = Get-Item "${{ steps.download.outputs.download-path }}\drmingw-mingw64\mingw64\*.7z"
"mingw32-path=$($asset32.FullName)" >> $Env:GITHUB_OUTPUT
"mingw64-path=$($asset64.FullName)" >> $Env:GITHUB_OUTPUT
"mingw32-name=$($asset32.Name)" >> $Env:GITHUB_OUTPUT
"mingw64-name=$($asset64.Name)" >> $Env:GITHUB_OUTPUT
$asset64arm = Get-Item "${{ steps.download.outputs.download-path }}\drmingw-clang\aarch64-w64-mingw32-clang\*.7z"
"mingw64-arm-path=$($asset64arm.FullName)" >> $Env:GITHUB_OUTPUT
"mingw64-arm-name=$($asset64arm.Name)" >> $Env:GITHUB_OUTPUT
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
draft: true
prerelease: false
- name: Upload Release Asset (32bits)
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ steps.assets.outputs.mingw32-path }}
asset_name: ${{ steps.assets.outputs.mingw32-name }}
asset_content_type: application/x-7z-compressed
- name: Upload Release Asset (64bits)
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ steps.assets.outputs.mingw64-path }}
asset_name: ${{ steps.assets.outputs.mingw64-name }}
asset_content_type: application/x-7z-compressed
- name: Upload Release Asset (64bits Arm)
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ steps.assets.outputs.mingw64-arm-path }}
asset_name: ${{ steps.assets.outputs.mingw64-arm-name }}
asset_content_type: application/x-7z-compressed