|
| 1 | +name: Build toolchains |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - master |
| 7 | + tags: |
| 8 | + - "*" |
| 9 | + pull_request: |
| 10 | + branches: |
| 11 | + - master |
| 12 | + |
| 13 | +env: |
| 14 | + ARTIFACT_STAGING_DIR: artifact |
| 15 | + |
| 16 | +jobs: |
| 17 | + build: |
| 18 | + strategy: |
| 19 | + matrix: |
| 20 | + include: |
| 21 | + - name: rv32imcb |
| 22 | + display_name: Toolchains targeting Ibex with bit-manipulation extensions |
| 23 | + target: riscv32-unknown-elf |
| 24 | + output_dir: /tools/riscv |
| 25 | + march: rv32imc_zba_zbb_zbc_zbs |
| 26 | + mabi: ilp32 |
| 27 | + mcmodel: medany |
| 28 | + - name: rv64imac |
| 29 | + display_name: GCC and Clang/LLVM toolchains targeting RV64IMAC (Muntjac) |
| 30 | + target: riscv64-unknown-elf |
| 31 | + output_dir: /tools/riscv |
| 32 | + march: rv64imac |
| 33 | + mabi: lp64 |
| 34 | + mcmodel: medany |
| 35 | +# - name: multilib-baremetal |
| 36 | +# display_name: RV64 GCC (Multilib Baremetal) |
| 37 | +# target: riscv64-unknown-elf |
| 38 | +# output_dir: /opt/riscv-baremetal-toolchain |
| 39 | +# - name: multilib-linux |
| 40 | +# display_name: RV64 GCC (Multilib Linux) |
| 41 | +# target: riscv64-unknown-linux-gnu |
| 42 | +# output_dir: /opt/riscv-linux-toolchain |
| 43 | + |
| 44 | + name: ${{ matrix.display_name }} |
| 45 | + runs-on: ubuntu-20.04 |
| 46 | + timeout-minutes: 360 |
| 47 | + |
| 48 | + steps: |
| 49 | + - uses: actions/checkout@v4 |
| 50 | + |
| 51 | + - name: Setup environment |
| 52 | + run: | |
| 53 | + echo ::group::Install dependencies |
| 54 | + ./prepare-ubuntu-20.04.sh |
| 55 | + ./install-crosstool-ng.sh |
| 56 | + echo ::endgroup:: |
| 57 | +
|
| 58 | + echo Preparing toolchain destination directory... |
| 59 | + sudo mkdir -p /tools/riscv |
| 60 | + sudo chmod 0777 /tools/riscv |
| 61 | +
|
| 62 | + echo ::group::Set the release tag env var |
| 63 | + echo "RELEASE_TAG=$(./release_tag.sh)" >> "$GITHUB_ENV" |
| 64 | + echo ::endgroup:: |
| 65 | +
|
| 66 | + echo Creating artifact staging directory... |
| 67 | + mkdir "$ARTIFACT_STAGING_DIR" |
| 68 | +
|
| 69 | + - name: Build GCC toolchain |
| 70 | + run: | |
| 71 | + ./build-gcc-with-args.sh \ |
| 72 | + "lowrisc-toolchain-gcc-${{ matrix.name }}" \ |
| 73 | + "${{ matrix.target }}" \ |
| 74 | + "${{ matrix.output_dir }}" \ |
| 75 | + "${{ matrix.march }}" \ |
| 76 | + "${{ matrix.mabi}}" \ |
| 77 | + "${{ matrix.mcmodel }}" \ |
| 78 | + "${{ matrix.cflags }}" |
| 79 | +
|
| 80 | + - name: Build Clang toolchain |
| 81 | + run: | |
| 82 | + ./build-clang-with-args.sh \ |
| 83 | + "lowrisc-toolchain-${{ matrix.name }}" \ |
| 84 | + "${{ matrix.target }}" \ |
| 85 | + "${{ matrix.output_dir }}" \ |
| 86 | + "${{ matrix.march }}" \ |
| 87 | + "${{ matrix.mabi}}" \ |
| 88 | + "${{ matrix.mcmodel }}" \ |
| 89 | + "${{ matrix.cflags }}" |
| 90 | +
|
| 91 | + - uses: actions/upload-artifact@v3 |
| 92 | + with: |
| 93 | + name: ${{ matrix.name }}-toolchains |
| 94 | + path: ${{ env.ARTIFACT_STAGING_DIR }} |
| 95 | + |
| 96 | + - name: Check tarballs |
| 97 | + run: | |
| 98 | + set -e |
| 99 | + for f in "${ARTIFACT_STAGING_DIR}"/*.tar.xz; do |
| 100 | + ./check-tarball.sh "$f" |
| 101 | + done |
| 102 | +
|
| 103 | + - name: Release |
| 104 | + if: github.ref_type == 'tag' |
| 105 | + env: |
| 106 | + GH_TOKEN: ${{ github.token }} |
| 107 | + run: | |
| 108 | + # Create the release if it doesn't already exist. |
| 109 | + gh release create "$RELEASE_TAG" --prerelease || echo "release exists" |
| 110 | + # Upload this job's artifacts. |
| 111 | + gh release upload "$RELEASE_TAG" --clobber \ |
| 112 | + "${ARTIFACT_STAGING_DIR}/lowrisc-toolchain-${{ matrix.name }}-${RELEASE_TAG}.tar.xz" \ |
| 113 | + "${ARTIFACT_STAGING_DIR}/lowrisc-toolchain-gcc-${{ matrix.name }}-${RELEASE_TAG}.tar.xz" |
0 commit comments