README: update & move docs to machengine.org/pkg/mach-dxcompiler #52
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
name: CI | |
on: | |
push: | |
branches: | |
- 'main' | |
jobs: | |
draft_release: | |
if: ${{ !contains(github.event.head_commit.message, 'update to latest binary release') }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Create draft | |
run: | | |
export RELEASE="$(date -u +%Y.%m.%d)+$(git rev-parse --short HEAD).${{ github.run_attempt }}" | |
gh release create "$RELEASE" --draft --title "$RELEASE" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Create draft | |
run: | | |
export RELEASE="$(date -u +%Y.%m.%d)+$(git rev-parse --short HEAD).${{ github.run_attempt }}" | |
gh release edit "$RELEASE" --draft=false | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
all: | |
needs: draft_release | |
strategy: | |
matrix: | |
target: [ | |
'x86_64-linux-gnu', | |
'x86_64-linux-musl', | |
'aarch64-linux-gnu', | |
'aarch64-linux-musl', | |
'x86_64-windows-gnu', | |
'aarch64-windows-gnu', | |
'x86_64-macos-none', | |
'aarch64-macos-none', | |
] | |
optimize: [Debug, ReleaseFast] | |
include: | |
- target: 'x86_64-linux-gnu' | |
cpu: '-Dcpu=x86_64_v2' | |
- target: 'x86_64-linux-musl' | |
cpu: '-Dcpu=x86_64_v2' | |
- target: 'x86_64-windows-gnu' | |
cpu: '-Dcpu=x86_64_v2' | |
- target: 'x86_64-macos-none' | |
cpu: '-Dcpu=x86_64_v2' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup Zig | |
run: | | |
sudo apt install xz-utils | |
sudo sh -c 'wget -c https://pkg.machengine.org/zig/zig-linux-x86_64-0.12.0-dev.2063+804cee3b9.tar.xz -O - | tar -xJ --strip-components=1 -C /usr/local/bin' | |
- name: build | |
run: zig build -Dfrom_source -Dtarget=${{ matrix.target }} -Doptimize=${{ matrix.optimize }} ${{ matrix.cpu }} install dxc | |
- name: upload | |
run: | | |
ZSTD_CLEVEL=19 tar -acf "${TARGET_OPT}_lib.tar.zst" -C zig-out/lib . | |
ZSTD_CLEVEL=19 tar -acf "${TARGET_OPT}_bin.tar.zst" -C zig-out/bin . | |
ZSTD_CLEVEL=19 tar -acf "${TARGET_OPT}_lib.tar.gz" -C zig-out/lib . | |
ZSTD_CLEVEL=19 tar -acf "${TARGET_OPT}_bin.tar.gz" -C zig-out/bin . | |
export RELEASE="$(date -u +%Y.%m.%d)+$(git rev-parse --short HEAD).${{ github.run_attempt }}" | |
gh release upload "$RELEASE" "${TARGET_OPT}_lib.tar.zst" | |
gh release upload "$RELEASE" "${TARGET_OPT}_bin.tar.zst" | |
gh release upload "$RELEASE" "${TARGET_OPT}_lib.tar.gz" | |
gh release upload "$RELEASE" "${TARGET_OPT}_bin.tar.gz" | |
env: | |
TARGET_OPT: ${{ matrix.target }}_${{ matrix.optimize }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
msvc: | |
# TODO: re-enable required MSVC builds | |
continue-on-error: true | |
needs: draft_release | |
strategy: | |
matrix: | |
target: [ | |
'x86_64-windows-msvc', | |
# TODO: 'machine type x64 conflicts with arm64' during linking (zig bug) | |
# 'aarch64-windows-msvc', | |
] | |
optimize: [Debug, ReleaseFast] | |
include: | |
- target: 'x86_64-windows-msvc' | |
cpu: '-Dcpu=x86_64_v2' | |
runs-on: windows-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup Zig | |
run: | | |
$ProgressPreference = 'SilentlyContinue' | |
Invoke-WebRequest -Uri "https://pkg.machengine.org/zig/zig-windows-x86_64-0.12.0-dev.2063+804cee3b9.zip" -OutFile "C:\zig.zip" | |
cd C:\ | |
7z x zig.zip | |
Add-Content $env:GITHUB_PATH "C:\zig-windows-x86_64-0.12.0-dev.2063+804cee3b9\" | |
- name: build | |
run: zig build -Dfrom_source -Dtarget=${{ matrix.target }} -Doptimize=${{ matrix.optimize }} ${{ matrix.cpu }} install dxc | |
- name: upload | |
run: | | |
ZSTD_CLEVEL=19 tar -acf "${TARGET_OPT}_lib.tar.zst" -C zig-out/lib . | |
ZSTD_CLEVEL=19 tar -acf "${TARGET_OPT}_bin.tar.zst" -C zig-out/bin . | |
ZSTD_CLEVEL=19 tar -acf "${TARGET_OPT}_lib.tar.gz" -C zig-out/lib . | |
ZSTD_CLEVEL=19 tar -acf "${TARGET_OPT}_bin.tar.gz" -C zig-out/bin . | |
export RELEASE="$(date -u +%Y.%m.%d)+$(git rev-parse --short HEAD).${{ github.run_attempt }}" | |
gh release upload "$RELEASE" "${TARGET_OPT}_lib.tar.zst" | |
gh release upload "$RELEASE" "${TARGET_OPT}_bin.tar.zst" | |
gh release upload "$RELEASE" "${TARGET_OPT}_lib.tar.gz" | |
gh release upload "$RELEASE" "${TARGET_OPT}_bin.tar.gz" | |
shell: bash | |
env: | |
WINDOWS: true | |
TARGET_OPT: ${{ matrix.target }}_${{ matrix.optimize }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
publish: | |
# TODO: re-enable required MSVC builds | |
# needs: [all, msvc] | |
needs: [all] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Publish release | |
run: | | |
export RELEASE="$(date -u +%Y.%m.%d)+$(git rev-parse --short HEAD).${{ github.run_attempt }}" | |
gh release edit "$RELEASE" --draft=false | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Record latest release version | |
id: recorded_release_version | |
# Note: we find the latest non-'update to latest binary release' commit here, which is not | |
# necessarily HEAD because another build could have succeeded before us and HEAD may now refer | |
# to 'update to latest binary release' instead of the commit we were building. | |
# By doing this, we ensure any update we push would refer to the absolute latest binary | |
# release even if *this* CI run is older. | |
run: echo "recorded_release_version=$(git log --oneline | grep -v 'update to latest binary release' | head -n1 | cut -d " " -f1)" >> $GITHUB_ENV | |
- name: Checkout hexops/mach-dxcompiler repo | |
uses: actions/checkout@v3 | |
with: | |
repository: hexops/mach-dxcompiler | |
token: ${{ secrets.HEXOPS_MACH_DXCOMPILER_PUSH }} | |
- name: 'update hard-coded binary release version' | |
env: | |
RELEASE_COMMIT: ${{env.recorded_release_version}} | |
run: | | |
export RELEASE="$(date -u +%Y.%m.%d)+$(git rev-parse --short HEAD).${{ github.run_attempt }}" | |
sed -i "/const latest_binary_release =/c\const latest_binary_release = \"$RELEASE\";" ./build.zig | |
git config user.name 'Release automation' | |
git config user.email '[email protected]' | |
git add . | |
git commit -m 'update to latest binary release' | |
git push -u origin HEAD |