Skip to content
This repository has been archived by the owner on Sep 2, 2023. It is now read-only.

Commit

Permalink
CI: Build for macOS too
Browse files Browse the repository at this point in the history
  • Loading branch information
mbitsnbites committed Nov 27, 2021
1 parent 77ae159 commit 91e5461
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 11 deletions.
75 changes: 65 additions & 10 deletions .github/workflows/build-toolchain.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,30 +10,70 @@ on:

jobs:
build:
runs-on: ubuntu-20.04
name: ${{ matrix.config.name }}
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: false
matrix:
config:
- {
name: "Ubuntu 20.04 AMD64",
os: ubuntu-20.04,
build_env: "docker",
cc: "gcc",
cxx: "g++",
artifact: "mrisc32-gnu-toolchain-linux-amd64.tar.gz",
archive_type: "tar",
}
- {
name: "macOS Latest",
os: macos-latest,
build_env: "native",
cc: "clang",
cxx: "clang++",
artifact: "mrisc32-gnu-toolchain-macos.zip",
archive_type: "zip"
}

steps:
- name: Checkout code
uses: actions/checkout@v2
with:
submodules: recursive

- name: Build Toolchain
- name: Build toolchain (with Docker)
if: ${{ matrix.config.build_env == 'docker' }}
run: |
./build-in-docker.sh
- name: Create archive
- name: Build toolchain (native)
if: ${{ matrix.config.build_env == 'native' }}
run: |
mkdir -p out/install
./build.sh --prefix=${PWD}/out/install --clean
- name: Prepare archive content
run: |
mv out/install mrisc32-gnu-toolchain
cp ext/binutils-mrisc32/COPYING* mrisc32-gnu-toolchain/
cp ext/newlib-mrisc32/COPYING* mrisc32-gnu-toolchain/
cp ext/gcc-mrisc32/COPYING* mrisc32-gnu-toolchain/
tar -cvzf mrisc32-gnu-toolchain-linux-amd64.tar.gz mrisc32-gnu-toolchain
- name: Pack tar archive
if: ${{ matrix.config.archive_type == 'tar' }}
run: |
tar -cvzf ${{ matrix.config.artifact }} mrisc32-gnu-toolchain
- name: Pack zip archive
if: ${{ matrix.config.archive_type == 'zip' }}
run: |
7z a -tzip -mx=9 ${{ matrix.config.artifact }} mrisc32-gnu-toolchain
- name: Upload
uses: actions/upload-artifact@v1
with:
path: mrisc32-gnu-toolchain-linux-amd64.tar.gz
name: mrisc32-gnu-toolchain-linux-amd64.tar.gz
path: ${{ matrix.config.artifact }}
name: ${{ matrix.config.artifact }}

release:
if: contains(github.ref, 'tags/v')
Expand Down Expand Up @@ -63,14 +103,29 @@ jobs:

publish:
if: contains(github.ref, 'tags/v')
name: ${{ matrix.config.name }}
runs-on: ubuntu-20.04
needs: release
strategy:
fail-fast: false
matrix:
config:
- {
name: "Ubuntu 20.04 AMD64",
artifact: "mrisc32-gnu-toolchain-linux-amd64.tar.gz",
artifact_content_type: "application/x-tar",
}
- {
name: "macOS Latest",
artifact: "mrisc32-gnu-toolchain-macos.zip",
artifact_content_type: "application/zip",
}

steps:
- name: Download artifact
uses: actions/download-artifact@v1
with:
name: mrisc32-gnu-toolchain-linux-amd64.tar.gz
name: ${{ matrix.config.artifact }}
path: ./

- name: Download URL
Expand All @@ -89,6 +144,6 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.set_upload_url.outputs.upload_url }}
asset_path: mrisc32-gnu-toolchain-linux-amd64.tar.gz
asset_name: mrisc32-gnu-toolchain-linux-amd64.tar.gz
asset_content_type: application/x-tar
asset_path: ${{ matrix.config.artifact }}
asset_name: ${{ matrix.config.artifact }}
asset_content_type: ${{ matrix.config.artifact_content_type }}
2 changes: 1 addition & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ cd "$SCRIPT_DIR"

# Determine number of parallel processes.
if [ -z "${NUM_PROCESSES}" ] ; then
NUM_PROCESSES=$(getconf -a | grep NPROCESSORS_ONLN | head -1 | awk '{print $2}')
NUM_PROCESSES=$(getconf _NPROCESSORS_ONLN 2>/dev/null || echo 8)
if [ -z "${NUM_PROCESSES}" ]; then
NUM_PROCESSES = 8
fi
Expand Down

0 comments on commit 91e5461

Please sign in to comment.