Skip to content

build

build #16119

Workflow file for this run

name: 'build'
on:
workflow_dispatch:
inputs:
optional_deps:
description: 'optional_deps=pkg-A:optional-dep-B,pkg-C:optional-dep-D'
default: ''
required: false
type: string
context:
description: 'Extra information from invoker'
default: ''
required: false
type: string
schedule:
- cron: '0 0/3 * * *'
env:
PYTHONUNBUFFERED: 1
permissions:
contents: write
jobs:
schedule:
runs-on: ubuntu-22.04
concurrency: autobuild-maint
outputs:
build-plan: ${{ steps.check.outputs.build-plan }}
steps:
- name: Dump inputs
if: ${{ github.event_name == 'workflow_dispatch' }}
env:
CONTEXT: '${{ toJSON(github.event.inputs) }}'
run: |
echo "$CONTEXT"
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: 'pip'
cache-dependency-path: 'requirements.txt'
- name: Install deps
env:
PIP_DISABLE_PIP_VERSION_CHECK: 1
run: |
python -m pip install --user -r requirements.txt
- name: autobuild cache
uses: actions/cache@v4
with:
path: ${{ github.workspace }}/.autobuild_cache
key: autobuild_cache-${{ github.job }}-${{ github.run_id }}-${{ github.run_attempt }}
restore-keys: autobuild_cache-
- name: Check what we should run
id: check
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN_READONLY: ${{ secrets.GITHUBTOKENREADONLY }}
OPTIONAL_DEPS: ${{ github.event.inputs.optional_deps }}
run: |
python -m msys2_autobuild write-build-plan --optional-deps "$OPTIONAL_DEPS" build_plan.json
buildPlan="$(cat build_plan.json)"
echo "build-plan=$buildPlan" >> $GITHUB_OUTPUT
- name: Clean up assets
if: steps.check.outputs.build-plan != '[]'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN_READONLY: ${{ secrets.GITHUBTOKENREADONLY }}
run: |
python -m msys2_autobuild clean-assets
- name: Show build queue
if: steps.check.outputs.build-plan != '[]'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN_READONLY: ${{ secrets.GITHUBTOKENREADONLY }}
OPTIONAL_DEPS: ${{ github.event.inputs.optional_deps }}
run: |
python -m msys2_autobuild show --optional-deps "$OPTIONAL_DEPS"
build:
timeout-minutes: 4320
needs: schedule
concurrency: autobuild-build-${{ matrix.name }}
if: ${{ needs.schedule.outputs.build-plan != '[]' }}
strategy:
fail-fast: false
matrix:
include: ${{ fromJson(needs.schedule.outputs.build-plan) }}
name: ${{ matrix.name }}
runs-on: ${{ matrix.runner }}
steps:
- name: Configure Pagefile
if: ${{ runner.arch != 'ARM64' }}
# https://github.com/al-cheb/configure-pagefile-action/issues/16
continue-on-error: true
uses: al-cheb/configure-pagefile-action@a3b6ebd6b634da88790d9c58d4b37a7f4a7b8708
with:
minimum-size: 4GB
maximum-size: 16GB
disk-root: "C:"
- name: Runner details
run: |
Get-PSDrive -PSProvider FileSystem
Get-CIMInstance -Class Win32_Processor | Select-Object -Property Name
- uses: actions/checkout@v4
# Reverted from v5 to v4 due to actions/setup-python#819
- uses: actions/setup-python@v4
with:
python-version: '3.11'
cache: 'pip'
cache-dependency-path: 'requirements.txt'
# Note that ARM64 prior to Win11 requires x86, but this will install x64
architecture: 'x64'
- name: Install deps
env:
PIP_DISABLE_PIP_VERSION_CHECK: 1
run: |
python -m pip install --user -r requirements.txt
- name: autobuild cache
uses: actions/cache@v4
with:
path: ${{ github.workspace }}/.autobuild_cache
key: autobuild_cache-${{ github.job }}-${{ github.run_id }}-${{ github.run_attempt }}
restore-keys: autobuild_cache-
# Note that ARM64 prior to Win11 requires x86 msys, but this will install x64
- uses: msys2/setup-msys2@v2
with:
msystem: MSYS
update: true
install: ${{ matrix.packages }}
location: 'D:\A'
release: ${{ runner.arch == 'ARM64' && 'false' || 'true' }}
cache: ${{ runner.arch == 'ARM64' && 'false' || 'true' }}
- name: Switch to the main mirror
shell: msys2 {0}
run: |
echo 'Server = https://repo.msys2.org/mingw/$repo/' > /etc/pacman.d/mirrorlist.mingw
echo 'Server = https://repo.msys2.org/msys/$arch/' > /etc/pacman.d/mirrorlist.msys
pacman-conf.exe
- name: Update using the main mirror & Check install
run: |
msys2 -c 'pacman --noconfirm -Suuy'
msys2 -c 'pacman --noconfirm -Suu'
msys2 -c 'pacman -Qkq'
- name: Process build queue
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN_READONLY: ${{ secrets.GITHUBTOKENREADONLY }}
GITHUB_RUN_NAME: ${{ matrix.name }}
run: |
$env:VCPKG_ROOT=''
$BUILD_ROOT='C:\'
$MSYS2_ROOT=(msys2 -c 'cygpath -w /')
python -m msys2_autobuild build ${{ matrix.build-args }} "$MSYS2_ROOT" "$BUILD_ROOT"