Skip to content

Commit

Permalink
Ccache experiment
Browse files Browse the repository at this point in the history
  • Loading branch information
Blackhex committed May 22, 2024
1 parent 1eefe17 commit 3485d26
Show file tree
Hide file tree
Showing 3 changed files with 112 additions and 153 deletions.
7 changes: 7 additions & 0 deletions .github/scripts/enable-ccache.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

set -e # exit on error
set -x # echo on

sed -i 's/\(BUILDENV=(.*\)!ccache\(.*\)/\1ccache\2/g' /etc/makepkg.conf
cat /etc/makepkg.conf
80 changes: 80 additions & 0 deletions .github/workflows/build-package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: Build MSYS2 package

on:
workflow_call:
inputs:
package_name:
description: "Package name to build"
type: string
dependencies:
description: "Dependencies to install"
type: string
msys2_packages_branch:
description: "MSYS2-packages branch to build"
type: string
default: "woarm64"

defaults:
run:
shell: msys2 {0}

env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
MSYS2_REPO: Windows-on-ARM-Experiments/MSYS2-packages
MSYS2_BRANCH: ${{ inputs.msys2_packages_branch || 'woarm64' }}

jobs:
build:
runs-on: windows-latest

steps:
- uses: msys2/setup-msys2@v2
with:
msystem: MSYS
update: true
install: base-devel

- name: Test
run: echo "${{ toJson(jobs.mingw-w64-cross-headers.needs) }}"

- name: Checkout repository
uses: actions/checkout@v4

- name: Enable Ccache
run: |
`cygpath "${{ github.workspace }}"`/.github/scripts/enable-ccache.sh
- name: Ccache
id: cache-ccache
uses: actions/cache@v4
with:
path: ${{ github.workspace }}/ccache
key: main-ccache

- name: Checkout MSYS2 packages repository
uses: actions/checkout@v4
with:
repository: ${{ env.MSYS2_REPO }}
ref: ${{ env.MSYS2_BRANCH }}
path: ${{ github.workspace }}/MSYS2-packages

- name: Download artifacts
if: ${{ inputs.dependencies }}
shell: powershell
run: |
gh run download ${{ github.run_id }} -n ${{ inputs.dependencies }}
- name: Install artifacts
if: ${{ inputs.dependencies }}
run: pacman -U --noconfirm *.pkg.tar.zst

- name: Build ${{ inputs.package_name }}
working-directory: ${{ github.workspace }}/MSYS2-packages/${{ inputs.package_name }}
run: makepkg --syncdeps --rmdeps --cleanbuild --noconfirm --noprogressbar --nocheck --force

- name: Upload ${{ inputs.package_name }}
uses: actions/upload-artifact@v4
with:
name: ${{ inputs.package_name }}
retention-days: 1
path: ${{ github.workspace }}/MSYS2-packages/${{ inputs.package_name }}/*.pkg.tar.zst
178 changes: 25 additions & 153 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,175 +13,50 @@ on:
required: false
default: "woarm64"

defaults:
run:
shell: msys2 {0}

env:
MSYS2_REPO: Windows-on-ARM-Experiments/MSYS2-packages
MSYS2_BRANCH: ${{ inputs.msys2_packages_branch || 'woarm64' }}
BUILDENV: ccache
CCACHE_PATH: ${{ github.workspace }}/ccache

jobs:
mingw-w64-cross-headers:
runs-on: windows-latest

steps:
- uses: msys2/setup-msys2@v2
with:
msystem: MSYS
location: ${{ github.workspace }}
release: true
update: true
cache: false
install: base-devel
- name: test
run: echo "${{ toJson(needs) }}"

- name: Checkout MSYS2 packages repository
uses: actions/checkout@v4
- name: test2
uses: ./.github/workflows/build-package.yml
with:
repository: ${{ env.MSYS2_REPO }}
ref: ${{ env.MSYS2_BRANCH }}
path: ${{ github.workspace }}/MSYS2-packages

- name: Build mingw-w64-cross-headers
working-directory: ${{ github.workspace }}/MSYS2-packages/mingw-w64-cross-headers
run: makepkg --syncdeps --rmdeps --cleanbuild --noconfirm --noprogressbar --force

- name: Upload mingw-w64-cross-headers
uses: actions/upload-artifact@v4
with:
name: mingw-w64-cross-headers
retention-days: 1
path: ${{ github.workspace }}/MSYS2-packages/mingw-w64-cross-headers/*.pkg.tar.zst
package_name: mingw-w64-cross-headers
msys2_packages_branch: ${{ github.event.inputs.msys2_packages_branch }}

mingw-w64-cross-binutils:
needs: [mingw-w64-cross-headers]
runs-on: windows-latest
needs: mingw-w64-cross-headers

steps:
- uses: msys2/setup-msys2@v2
with:
msystem: MSYS
location: ${{ github.workspace }}
release: true
update: true
cache: false
install: base-devel

- name: Checkout MSYS2 packages repository
uses: actions/checkout@v4
with:
repository: ${{ env.MSYS2_REPO }}
ref: ${{ env.MSYS2_BRANCH}}
path: ${{ github.workspace }}/MSYS2-packages

- name: Download mingw-w64-cross-headers
uses: actions/download-artifact@v4
with:
name: mingw-w64-cross-headers

- name: Install artifacts
run: pacman -U --noconfirm *.pkg.tar.zst

- name: Build mingw-w64-cross-binutils
working-directory: ${{ github.workspace }}/MSYS2-packages/mingw-w64-cross-binutils
run: makepkg --syncdeps --rmdeps --cleanbuild --noconfirm --noprogressbar --nocheck --force

- name: Upload mingw-w64-cross-binutils
uses: actions/upload-artifact@v4
with:
name: mingw-w64-cross-binutils
retention-days: 1
path: ${{ github.workspace }}/MSYS2-packages/mingw-w64-cross-binutils/*.pkg.tar.zst
uses: ./.github/workflows/build-package.yml
with:
package_name: mingw-w64-cross-binutils
dependencies: ${{ needs }}
msys2_packages_branch: ${{ github.event.inputs.msys2_packages_branch }}

mingw-w64-cross-gcc-stage1:
needs: [mingw-w64-cross-headers, mingw-w64-cross-binutils]
runs-on: windows-latest

steps:
- uses: msys2/setup-msys2@v2
with:
msystem: MSYS
location: ${{ github.workspace }}
release: true
update: true
cache: false
install: base-devel

- name: Checkout MSYS2 packages repository
uses: actions/checkout@v4
with:
repository: ${{ env.MSYS2_REPO }}
ref: ${{ env.MSYS2_BRANCH }}
path: ${{ github.workspace }}/MSYS2-packages

- name: Download mingw-w64-cross-headers
uses: actions/download-artifact@v4
with:
name: mingw-w64-cross-headers

- name: Download mingw-w64-cross-binutils
uses: actions/download-artifact@v4
with:
name: mingw-w64-cross-binutils

- name: Install artifacts
run: pacman -U --noconfirm *.pkg.tar.zst

- name: Build mingw-w64-cross-gcc-stage1
working-directory: ${{ github.workspace }}/MSYS2-packages/mingw-w64-cross-gcc-stage1
run: makepkg --syncdeps --rmdeps --cleanbuild --noconfirm --noprogressbar --force

- name: Upload mingw-w64-cross-gcc-stage1
uses: actions/upload-artifact@v4
with:
name: mingw-w64-cross-gcc-stage1
retention-days: 1
path: ${{ github.workspace }}/MSYS2-packages/mingw-w64-cross-gcc-stage1/*.pkg.tar.zst
uses: ./.github/workflows/build-package.yml
with:
package_name: mingw-w64-cross-gcc-stage1
dependencies: ${{ needs }}
msys2_packages_branch: ${{ github.event.inputs.msys2_packages_branch }}

mingw-w64-cross-windows-default-manifest:
needs: [mingw-w64-cross-binutils, mingw-w64-cross-gcc-stage1]
runs-on: windows-latest

steps:
- uses: msys2/setup-msys2@v2
with:
msystem: MSYS
location: ${{ github.workspace }}
release: true
update: true
cache: false
install: base-devel

- name: Checkout MSYS2 packages repository
uses: actions/checkout@v4
with:
repository: ${{ env.MSYS2_REPO }}
ref: ${{ env.MSYS2_BRANCH }}
path: ${{ github.workspace }}/MSYS2-packages

- name: Download mingw-w64-cross-binutils
uses: actions/download-artifact@v4
with:
name: mingw-w64-cross-binutils

- name: Download mingw-w64-cross-gcc-stage1
uses: actions/download-artifact@v4
with:
name: mingw-w64-cross-gcc-stage1

- name: Install artifacts
run: pacman -U --noconfirm *.pkg.tar.zst

- name: Build mingw-w64-cross-windows-default-manifest
working-directory: ${{ github.workspace }}/MSYS2-packages/mingw-w64-cross-windows-default-manifest
run: makepkg --syncdeps --rmdeps --cleanbuild --noconfirm --noprogressbar --force

- name: Upload mingw-w64-cross-windows-default-manifest
uses: actions/upload-artifact@v4
with:
name: mingw-w64-cross-windows-default-manifest
retention-days: 1
path: ${{ github.workspace }}/MSYS2-packages/mingw-w64-cross-windows-default-manifest/*.pkg.tar.zst
uses: ./.github/workflows/build-package.yml
with:
package_name: mingw-w64-cross-windows-default-manifest
dependencies: ${{ needs }}
msys2_packages_branch: ${{ github.event.inputs.msys2_packages_branch }}

mingw-w64-cross-crt:
needs:
Expand All @@ -199,7 +74,6 @@ jobs:
location: ${{ github.workspace }}
release: true
update: true
cache: false
install: >-
base-devel
mingw-w64-cross-winpthreads
Expand Down Expand Up @@ -263,7 +137,6 @@ jobs:
location: ${{ github.workspace }}
release: true
update: true
cache: false
install: base-devel

- name: Checkout MSYS2 packages repository
Expand Down Expand Up @@ -326,7 +199,6 @@ jobs:
location: ${{ github.workspace }}
release: true
update: true
cache: false
install: base-devel

- name: Checkout MSYS2 packages repository
Expand Down

0 comments on commit 3485d26

Please sign in to comment.