mirror of
https://github.com/skeeto/w64devkit.git
synced 2026-10-24 17:39:18 +03:00
I rarely care about the status of the x86 builds, so this commit only runs them if the x64 builds succeed. If the x64 build is successful but the x86 build is not, the cache for the x64 build should kick in and the x86 build should follow shortly after, if it's necessary to iterate on it. Updated the GitHub Actions workflow so x86 only runs after x64 succeeds. Changed: - Split the old matrix job into two explicit jobs: build-x64 and build-x86. - Added needs: build-x64 on the x86 job, which enforces the dependency.
125 lines
3.6 KiB
YAML
125 lines
3.6 KiB
YAML
name: Build and test
|
|
|
|
concurrency:
|
|
group: w64devkit-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
on:
|
|
push:
|
|
pull_request:
|
|
branches: [ "master" ]
|
|
|
|
# Must set Settings -> Actions -> General -> Workflow permissions to
|
|
# "Read and write permissions"
|
|
permissions:
|
|
contents: write
|
|
|
|
jobs:
|
|
build-x64:
|
|
runs-on: ubuntu-latest
|
|
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
|
|
env:
|
|
ARCH: x64
|
|
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v4
|
|
|
|
- name: Generate archive name and version string
|
|
id: filename
|
|
run: |
|
|
GIT_VERSION="$(git describe --tags --always)"
|
|
echo "version=${GIT_VERSION:1}" >> $GITHUB_OUTPUT
|
|
echo "archive=w64devkit-$ARCH-${GIT_VERSION:1}" >> $GITHUB_OUTPUT
|
|
|
|
- name: Build image
|
|
uses: docker/build-push-action@v7
|
|
with:
|
|
context: .
|
|
tags: w64devkit:${{ env.ARCH }}
|
|
load: true
|
|
cache-from: type=gha,scope=w64devkit-${{ env.ARCH }}
|
|
cache-to: type=gha,scope=w64devkit-${{ env.ARCH }},mode=max
|
|
|
|
- name: Extract artifact
|
|
run: |
|
|
docker run --rm w64devkit:${{ env.ARCH }} > w64devkit.exe
|
|
|
|
- name: Rename artifact
|
|
run: |
|
|
mv w64devkit.exe ${{ steps.filename.outputs.archive }}.exe
|
|
ls -lh ${{ steps.filename.outputs.archive }}.exe
|
|
|
|
- name: Upload artifact
|
|
uses: actions/upload-artifact@v7
|
|
with:
|
|
name: ${{ steps.filename.outputs.archive }}.exe
|
|
path: ${{ steps.filename.outputs.archive }}.exe
|
|
archive: false
|
|
|
|
- name: Create Release
|
|
if: startsWith(github.ref, 'refs/tags/')
|
|
uses: softprops/action-gh-release@v2
|
|
with:
|
|
name: ${{ steps.filename.outputs.version }}
|
|
files: w64devkit-*.exe
|
|
draft: true
|
|
|
|
build-x86:
|
|
runs-on: ubuntu-latest
|
|
needs: build-x64
|
|
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
|
|
env:
|
|
ARCH: x86
|
|
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v4
|
|
|
|
- name: Apply x86 patch
|
|
run: patch -p1 -i src/variant-x86.patch
|
|
|
|
- name: Generate archive name and version string
|
|
id: filename
|
|
run: |
|
|
GIT_VERSION="$(git describe --tags --always)"
|
|
echo "version=${GIT_VERSION:1}" >> $GITHUB_OUTPUT
|
|
echo "archive=w64devkit-$ARCH-${GIT_VERSION:1}" >> $GITHUB_OUTPUT
|
|
|
|
- name: Build image
|
|
uses: docker/build-push-action@v7
|
|
with:
|
|
context: .
|
|
tags: w64devkit:${{ env.ARCH }}
|
|
load: true
|
|
cache-from: type=gha,scope=w64devkit-${{ env.ARCH }}
|
|
cache-to: type=gha,scope=w64devkit-${{ env.ARCH }},mode=max
|
|
|
|
- name: Extract artifact
|
|
run: |
|
|
docker run --rm w64devkit:${{ env.ARCH }} > w64devkit.exe
|
|
|
|
- name: Rename artifact
|
|
run: |
|
|
mv w64devkit.exe ${{ steps.filename.outputs.archive }}.exe
|
|
ls -lh ${{ steps.filename.outputs.archive }}.exe
|
|
|
|
- name: Upload artifact
|
|
uses: actions/upload-artifact@v7
|
|
with:
|
|
name: ${{ steps.filename.outputs.archive }}.exe
|
|
path: ${{ steps.filename.outputs.archive }}.exe
|
|
archive: false
|
|
|
|
- name: Create Release
|
|
if: startsWith(github.ref, 'refs/tags/')
|
|
uses: softprops/action-gh-release@v2
|
|
with:
|
|
name: ${{ steps.filename.outputs.version }}
|
|
files: w64devkit-*.exe
|
|
draft: true
|