-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 9d6e41f
Showing
20 changed files
with
1,109 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
--- | ||
name: Create Toolchain | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
runner_labels_json: { type: string, required: true } | ||
crosstool_host_os: { type: string, required: true } | ||
build_host: { type: string, required: true } | ||
target_host: { type: string, required: true } | ||
build_script: { type: string, required: true } | ||
canadian_build: { type: boolean, required: false, default: false } | ||
|
||
jobs: | ||
# Split up the build as compiling newlib/libstdc++ targeting ARM takes so damn long. | ||
phase1: | ||
name: Build toolchain (phase 1) | ||
uses: ./.github/workflows/invoke_crosstool.yaml | ||
with: | ||
runner_labels_json: ${{ inputs.runner_labels_json }} | ||
crosstool_host_os: ${{ inputs.crosstool_host_os }} | ||
build_host: ${{ inputs.build_host }} | ||
target_host: ${{ inputs.target_host }} | ||
build_script: ${{ inputs.build_script }} | ||
canadian_build: ${{ inputs.canadian_build }} | ||
crosstool_args: 'build STOP=cc_for_build' | ||
restore_state: false | ||
phase_number: 1 | ||
|
||
phase2: | ||
name: Build toolchain (phase 2) | ||
needs: [phase1] | ||
uses: ./.github/workflows/invoke_crosstool.yaml | ||
with: | ||
runner_labels_json: ${{ inputs.runner_labels_json }} | ||
crosstool_host_os: ${{ inputs.crosstool_host_os }} | ||
build_host: ${{ inputs.build_host }} | ||
target_host: ${{ inputs.target_host }} | ||
build_script: ${{ inputs.build_script }} | ||
canadian_build: ${{ inputs.canadian_build }} | ||
crosstool_args: 'build RESTART=cc_for_host STOP=libc_post_cc' | ||
phase_number: 2 | ||
|
||
phase3: | ||
name: Build toolchain (phase 3) | ||
needs: [phase2] | ||
uses: ./.github/workflows/invoke_crosstool.yaml | ||
with: | ||
runner_labels_json: ${{ inputs.runner_labels_json }} | ||
crosstool_host_os: ${{ inputs.crosstool_host_os }} | ||
build_host: ${{ inputs.build_host }} | ||
target_host: ${{ inputs.target_host }} | ||
build_script: ${{ inputs.build_script }} | ||
canadian_build: ${{ inputs.canadian_build }} | ||
crosstool_args: 'build RESTART=companion_libs_for_target STOP=companion_libs_for_target' | ||
phase_number: 3 | ||
|
||
phase4: | ||
name: Build toolchain (phase 4) | ||
needs: [phase3] | ||
uses: ./.github/workflows/invoke_crosstool.yaml | ||
with: | ||
runner_labels_json: ${{ inputs.runner_labels_json }} | ||
crosstool_host_os: ${{ inputs.crosstool_host_os }} | ||
build_host: ${{ inputs.build_host }} | ||
target_host: ${{ inputs.target_host }} | ||
build_script: ${{ inputs.build_script }} | ||
canadian_build: ${{ inputs.canadian_build }} | ||
crosstool_args: 'build RESTART=binutils_for_target' | ||
save_state: false | ||
toolchain_tarball: true | ||
phase_number: 4 | ||
|
||
phase5: | ||
name: Build toolchain (phase 5) | ||
needs: [phase4] | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Delete build state | ||
uses: geekyeggo/delete-artifact@v4 | ||
with: | ||
name: state-host_${{ inputs.build_host }}-target_${{ inputs.target_host }}.tar |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,244 @@ | ||
--- | ||
name: Create Toolchains | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
workflow_dispatch: | ||
|
||
jobs: | ||
crosstool: | ||
name: "Build crosstool-ng" | ||
runs-on: ${{ fromJSON(matrix.host_labels) }} | ||
strategy: | ||
matrix: | ||
runner: [linuxX64, macosX64, macosARM64] | ||
include: | ||
- runner: linuxX64 | ||
host_labels: '["ubuntu-22.04"]' | ||
- runner: macosX64 | ||
host_labels: '["macos-12"]' | ||
- runner: macosARM64 | ||
host_labels: '["self-hosted", "macOS", "ARM64"]' | ||
|
||
steps: | ||
- name: "Clone crosstool-ng repo" | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: crosstool-ng/crosstool-ng | ||
ref: master | ||
|
||
- name: "Prerequisites (Linux)" | ||
if: ${{ runner.os == 'Linux' }} | ||
run: | | ||
sudo apt-get install -y gperf help2man libtool-bin meson ninja-build | ||
- name: "Prerequisites (macOS)" | ||
if: ${{ runner.os == 'macOS' }} | ||
run: | | ||
brew install autoconf automake bash binutils coreutils gawk gnu-sed help2man make meson ncurses pkg-config python3 | ||
- name: "Build crosstool-ng" | ||
run: | | ||
if [ "$RUNNER_OS" == "macOS" ]; then | ||
export PATH="$PATH:/usr/local/opt/binutils/bin:/usr/local/opt/coreutils/bin:/usr/local/opt/libtool/libexec/gnubin" | ||
export CPPFLAGS="-I/usr/local/opt/ncurses/include -I/usr/local/opt/gettext/include" | ||
export LDFLAGS="-L/usr/local/opt/ncurses/lib -L/usr/local/opt/gettext/lib" | ||
export PATH="$PATH:/opt/homebrew/opt/binutils/bin:/opt/homebrew/opt/coreutils/bin:/opt/homebrew/opt/libtool/libexec/gnubin" | ||
export CPPFLAGS="$CPPFLAGS -I/opt/homebrew/opt/ncurses/include -I/opt/homebrew/opt/gettext/include" | ||
export LDFLAGS="$LDFLAGS -L/opt/homebrew/opt/ncurses/lib -L/opt/homebrew/opt/gettext/lib" | ||
fi | ||
./bootstrap | ||
./configure --prefix=$PWD/.local/ | ||
make | ||
make install | ||
tar cf ct-ng.tar .local/ | ||
- name: "Upload crosstool-ng" | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: crosstool.${{ matrix.runner }} | ||
path: ct-ng.tar | ||
|
||
tarballs: | ||
name: "Download required tarballs" | ||
needs: crosstool | ||
runs-on: ubuntu-22.04 | ||
|
||
steps: | ||
- name: "Clone toolchains repo" | ||
uses: actions/checkout@v4 | ||
|
||
- name: "Download copy of crosstool-ng" | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: crosstool.linuxX64 | ||
|
||
- name: "Extract copy of crosstool-ng" | ||
run: | | ||
tar xf ct-ng.tar | ||
- name: "Prerequisites (Linux)" | ||
if: ${{ runner.os == 'Linux' }} | ||
run: | | ||
sudo apt-get install -y gperf help2man libtool-bin | ||
echo "$GITHUB_WORKSPACE/.local/bin" >> $GITHUB_PATH | ||
- name: "Gather source tarballs" | ||
run: | | ||
./all.sh source | ||
tar cvf tarballs.tar tarballs | ||
- name: "Upload source tarballs" | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: tarballs.tar | ||
path: tarballs.tar | ||
|
||
canadian-host-toolchains: | ||
name: "Build canadian host toolchains" | ||
needs: [crosstool, tarballs] | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
target_host: [linuxARM64, windowsX64] | ||
include: | ||
- target_host: linuxARM64 | ||
build_script: aarch64linux-native.sh | ||
- target_host: windowsX64 | ||
build_script: win64-native.sh | ||
uses: ./.github/workflows/create_one_toolchain.yaml | ||
with: | ||
runner_labels_json: '["ubuntu-22.04"]' | ||
crosstool_host_os: linuxX64 | ||
build_host: linuxX64 | ||
target_host: ${{ matrix.target_host }} | ||
build_script: ${{ matrix.build_script }} | ||
|
||
native-toolchains: | ||
name: "Build native toolchains" | ||
needs: [crosstool, tarballs] | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
build_host: [linuxX64, macosX64, macosARM64] | ||
target_host: [baremetalARM, baremetalAVR, baremetalRV32] | ||
include: | ||
- build_host: linuxX64 | ||
runner_labels_json: '["ubuntu-22.04"]' | ||
- build_host: macosX64 | ||
runner_labels_json: '["macos-12"]' | ||
- build_host: macosARM64 | ||
runner_labels_json: '["self-hosted", "macOS", "ARM64"]' | ||
- target_host: baremetalARM | ||
build_script: arm-native.sh | ||
- target_host: baremetalAVR | ||
build_script: avr-native.sh | ||
- target_host: baremetalRV32 | ||
build_script: riscv32-native.sh | ||
uses: ./.github/workflows/create_one_toolchain.yaml | ||
with: | ||
runner_labels_json: ${{ matrix.runner_labels_json }} | ||
crosstool_host_os: ${{ matrix.build_host }} | ||
build_host: ${{ matrix.build_host }} | ||
target_host: ${{ matrix.target_host }} | ||
build_script: ${{ matrix.build_script }} | ||
|
||
canadian-toolchains: | ||
name: "Build canadian toolchains" | ||
needs: [crosstool, tarballs, canadian-host-toolchains] | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
build_host: [linuxARM64, windowsX64] | ||
target_host: [baremetalARM, baremetalAVR, baremetalRV32] | ||
include: | ||
- build_host: linuxARM64 | ||
script_suffix: "-aarch64linux-canadian.sh" | ||
- build_host: windowsX64 | ||
script_suffix: "-win64-canadian.sh" | ||
- target_host: baremetalARM | ||
script_prefix: arm | ||
- target_host: baremetalAVR | ||
script_prefix: avr | ||
- target_host: baremetalRV32 | ||
script_prefix: riscv32 | ||
uses: ./.github/workflows/create_one_toolchain.yaml | ||
with: | ||
runner_labels_json: '["ubuntu-22.04"]' | ||
crosstool_host_os: linuxX64 | ||
canadian_build: true | ||
build_host: ${{ matrix.build_host }} | ||
target_host: ${{ matrix.target_host }} | ||
build_script: ${{ matrix.script_prefix }}${{ matrix.script_suffix }} | ||
|
||
native-linuxX64-toolchain: | ||
name: "Build native linuxX64 toolchain" | ||
needs: [crosstool, tarballs] | ||
uses: ./.github/workflows/create_one_toolchain.yaml | ||
with: | ||
runner_labels_json: '["ubuntu-22.04"]' | ||
crosstool_host_os: linuxX64 | ||
build_host: linuxX64 | ||
target_host: linuxX64 | ||
build_script: x64linux-native.sh | ||
|
||
canadian-windowsX64-toolchain: | ||
name: "Build native windowsX64 toolchain" | ||
needs: [crosstool, tarballs, canadian-toolchains] | ||
uses: ./.github/workflows/create_one_toolchain.yaml | ||
with: | ||
runner_labels_json: '["ubuntu-22.04"]' | ||
crosstool_host_os: linuxX64 | ||
canadian_build: true | ||
build_host: windowsX64 | ||
target_host: windowsX64 | ||
build_script: win64-win64-canadian.sh | ||
|
||
canadian-linuxARM64-toolchain: | ||
name: "Build native linuxARM64 toolchain" | ||
needs: [crosstool, tarballs, canadian-toolchains] | ||
uses: ./.github/workflows/create_one_toolchain.yaml | ||
with: | ||
runner_labels_json: '["ubuntu-22.04"]' | ||
crosstool_host_os: linuxX64 | ||
canadian_build: true | ||
build_host: linuxARM64 | ||
target_host: linuxARM64 | ||
build_script: aarch64linux-aarch64linux-canadian.sh | ||
|
||
publish: | ||
name: Publish toolchains | ||
needs: [native-toolchains, canadian-toolchains, native-linuxX64-toolchain, canadian-windowsX64-toolchain, canadian-linuxARM64-toolchain] | ||
if: always() && !cancelled() | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Download toolchains | ||
if: always() && !cancelled() | ||
uses: actions/download-artifact@v4 | ||
with: | ||
pattern: toolchain-* | ||
path: . | ||
merge-multiple: true | ||
|
||
- name: Generate pre-release... release | ||
uses: marvinpinto/action-automatic-releases@latest | ||
if: always() && !cancelled() && github.ref == 'refs/heads/main' | ||
with: | ||
repo_token: "${{ secrets.GITHUB_TOKEN }}" | ||
automatic_release_tag: latest | ||
prerelease: true | ||
title: Development Build | ||
files: | | ||
qmk_toolchain* | ||
- name: Generate release | ||
uses: marvinpinto/action-automatic-releases@latest | ||
if: always() && !cancelled() && startsWith(github.ref, 'refs/tags/v') | ||
with: | ||
repo_token: "${{ secrets.GITHUB_TOKEN }}" | ||
prerelease: false | ||
files: | | ||
qmk_toolchain* |
Oops, something went wrong.