Merge pull request #19 from umarcor/ci/test-toolchains

ci: test toolchains
This commit is contained in:
Sean Cross 2020-10-12 10:09:29 +08:00 committed by GitHub
commit a065098f5b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 139 additions and 82 deletions

114
.github/workflows/update.yml vendored Normal file
View File

@ -0,0 +1,114 @@
name: 'update'
on:
push:
pull_request:
jobs:
run:
strategy:
fail-fast: false
max-parallel: 3
matrix:
os: [ Linux, Windows, macOS ]
runs-on: ubuntu-latest
steps:
- run: git config --global core.autocrlf input
shell: bash
- uses: actions/checkout@v2
with:
fetch-depth: 0
- run: ARCH=${{ matrix.os }} ./build.sh
- uses: actions/upload-artifact@v2
with:
name: fomu-toolchain-${{ matrix.os }}
path: |
output/fomu-toolchain-${{ matrix.os }}*.tar.gz
output/fomu-toolchain-${{ matrix.os }}*.zip
output/fomu-toolchain-${{ matrix.os }}*.sha1
output/fomu-toolchain-${{ matrix.os }}*.sha256
output/fomu-toolchain-${{ matrix.os }}*.sha512
test:
needs: [ run ]
strategy:
fail-fast: false
max-parallel: 3
matrix:
os: [ ubuntu, windows, macos ]
runs-on: ${{ matrix.os }}-latest
defaults:
run:
shell: bash
steps:
- run: git config --global core.autocrlf input
shell: bash
- uses: actions/checkout@v2
with:
repository: im-tomu/fomu-workshop
submodules: true
fetch-depth: 0
- uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Set FOMU_TOOLCHAIN envvar
run: |
case '${{ matrix.os }}' in
ubuntu) ARCH=Linux;;
windows) ARCH=Windows;;
macos) ARCH=macOS;;
esac
echo "FOMU_TOOLCHAIN=fomu-toolchain-$ARCH" >> $GITHUB_ENV
- uses: actions/download-artifact@v2
with:
name: ${{ env.FOMU_TOOLCHAIN }}
- name: Install (Ubuntu)
if: matrix.os == 'ubuntu'
run: |
tar xzf ${{ env.FOMU_TOOLCHAIN }}.tar.gz
curl -L https://ziglang.org/download/0.6.0/zig-linux-x86_64-0.6.0.tar.xz | tar -xJf -
echo "$(pwd)/zig-linux-x86_64-0.6.0" >> $GITHUB_PATH
- name: Install (Windows)
if: matrix.os == 'windows'
run: |
unzip ${{ env.FOMU_TOOLCHAIN }}.zip
choco install zig --version 0.6.0
ln -s $(which python) /usr/bin/python3
- name: Install (Mac OS)
if: matrix.os == 'macos'
run: |
unzip ${{ env.FOMU_TOOLCHAIN }}.zip
brew install zig
- run: |
echo "$(pwd)/${{ env.FOMU_TOOLCHAIN }}/bin" >> $GITHUB_PATH
./.github/tests.sh
release:
if: github.event_name != 'pull_request' && (github.ref == 'refs/heads/master' || contains(github.ref, 'refs/tags/'))
needs: [ test ]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v2
- uses: eine/tip@master
with:
token: ${{ github.token }}
tag: nightly
files: ./**

View File

@ -1,33 +0,0 @@
language: minimal
matrix:
include:
- env: ARCH=windows
- env: ARCH=macos
- env: ARCH=linux_x86_64
addons:
apt:
packages:
- unzip
- zip
install: skip
script: ./build.sh
deploy:
provider: releases
api_key:
secure: "KFeNj4DOaqcSDLAMhfLfsz0X7DLKL82T8+FQ8VFt9PeUpcacAQ2B8YU/IFxcSNM9vR8IA4wvqNEuVaG9+/FIlV9Phwo9CpWiQ2urz1yENn7e7Wo1yL3A3/Fxf8hMq9vF8pUy1rcnsmi9LOdq+7W5y7pVCbdf6TL6SBkFXRPosJX0AE8CijQkA4q6ZcZ4yxwfx87sPGTCTSqZHbHTzPNJKWqJNHvt1js/rDDClnQEtsn/oLZv5xpOPoh3quAqaAhL2ZzJjJcjgwnXD76uKYXACfhiACAZILz/2Tf8/2pL7u52HPP34RpFNEv/imOh2R2ilY9zMv7MTf+FwjUmcuKGHFgaZhwXmYYgYJRiZMCuu6336H7eIH3N46/khElIPWnXWIwZHRy/24DnKKQNyfUzVLmfV0RAeSEupmmZCCOLTORRQ0CDWBjWU5q5/gvqt0+z8XA7uxdIUmUgpr49zgkTivC7JGxBeFwqbuspg/3aLrrGuRxtluWuQPt8O6cJIFYsLIs1DUzT8Rhyy/T4kInICzp28akzOk0SFc5jZdT2OhKBJJD3+ZaeFVtTiHMTxq67oxbvKXRKMwU7Zy2m5Hvmvo/laR35cNTlaEnacHsMdhxV554Hbh8FUoYFgjL50HsFo1THPlNW1opczLoGSBaV0eW1AepSvM9Jv2AfCF68Yr8="
file:
- output/*.tar.gz
- output/*.zip
- output/*.sha1
- output/*.sha256
- output/*.sha512
file_glob: true
skip_cleanup: true
on:
repo: im-tomu/fomu-toolchain
all_branches: true
tags: true
branches:
only:
# Release tags
- /^v\d+\.\d+/

View File

@ -20,7 +20,7 @@ linux_wishbone_tool_url="https://github.com/litex-hub/wishbone-utils/releases/do
linux_riscv_url="https://static.dev.sifive.com/dev-tools/riscv64-unknown-elf-gcc-8.3.0-2019.08.0-x86_64-linux-centos6.tar.gz"
base="$(pwd)"
output_name="fomu-toolchain-${ARCH}-${TRAVIS_TAG}"
output_name="fomu-toolchain-${ARCH}"
output="${base}/output/${output_name}"
input="${base}/input"
@ -28,14 +28,6 @@ mkdir -p $output
mkdir -p $input
mkdir -p $output/bin
if [ -z ${TRAVIS_TAG} ]
then
echo "This repository is designed to be run in the Travis CI system."
echo "Please download the prebuilt distribution for your platform at:"
echo "https://github.com/im-tomu/fomu-toolchain/releases/latest"
exit 1
fi
checksum_output() {
set +x
hashes="sha1 sha256 sha512"
@ -51,34 +43,30 @@ checksum_output() {
set -x
}
extract_zip() {
wget -O "$2" "$1"
cd $output"$3"
unzip -o "$2"
}
case "${ARCH}" in
"windows")
"Windows")
# Python 3.7.3 (which matches the version in nextpnr)
wget -O $input/python-${ARCH}.zip $win_python_url
cd $output/bin
unzip -o $input/python-${ARCH}.zip
extract_zip $win_python_url $input/python-${ARCH}.zip "/bin"
rm python37.zip # we already have this unzipped from nextpnr-ice40
rm -f python37._pth # If this file is present, PYTHONPATH is very broken
# Nextpnr
wget -O $input/nextpnr-${ARCH}.zip $win_nextpnr_url
cd $output/bin
unzip -o $input/nextpnr-${ARCH}.zip
extract_zip $win_nextpnr_url $input/nextpnr-${ARCH}.zip "/bin"
# Yosys, icestorm, and dfu_util
wget -O $input/yosys-${ARCH}.zip $win_yosys_url
cd $output
unzip -o $input/yosys-${ARCH}.zip
extract_zip $win_yosys_url $input/yosys-${ARCH}.zip
# Teraterm Terminal
wget -O $input/teraterm-${ARCH}.zip $win_teraterm_url
cd $output/bin
unzip -o $input/teraterm-${ARCH}.zip
extract_zip $win_teraterm_url $input/teraterm-${ARCH}.zip "/bin"
# Wishbone Tool
wget -O $input/wishbone-tool-${ARCH}.tar.gz $win_wishbone_tool_url
cd $output/bin
tar xvzf $input/wishbone-tool-${ARCH}.tar.gz
curl -fsSL $win_wishbone_tool_url | tar xvzf - -C $output/bin
# Riscv Toolchain
# Note that we want to strip the front part of the path.
@ -102,21 +90,15 @@ case "${ARCH}" in
checksum_output .zip
;;
"macos")
"macOS")
# Nextpnr
wget -O $input/nextpnr-${ARCH}.tar.gz $mac_nextpnr_url
cd $output
tar xvzf $input/nextpnr-${ARCH}.tar.gz
curl -fsSL $mac_nextpnr_url | tar xvzf - -C $output
# Yosys, icestorm, and dfu_util
wget -O $input/yosys-${ARCH}.tar.gz $mac_yosys_url
cd $output
tar xvzf $input/yosys-${ARCH}.tar.gz
curl -fsSL $mac_yosys_url | tar xvzf - -C $output
# Wishbone Tool
wget -O $input/wishbone-tool-${ARCH}.tar.gz $mac_wishbone_tool_url
cd $output/bin
tar xvzf $input/wishbone-tool-${ARCH}.tar.gz
curl -fsSL $mac_wishbone_tool_url | tar xvzf - -C $output/bin
# Riscv Toolchain
# Note that we want to strip the front part of the path.
@ -135,21 +117,15 @@ case "${ARCH}" in
checksum_output .zip
;;
"linux_x86_64")
"Linux")
# Nextpnr
wget -O $input/nextpnr-${ARCH}.tar.gz $linux_nextpnr_url
cd $output
tar xvzf $input/nextpnr-${ARCH}.tar.gz
curl -fsSL $linux_nextpnr_url | tar xvzf - -C $output
# Yosys, icestorm, and dfu_util
wget -O $input/yosys-${ARCH}.tar.gz $linux_yosys_url
cd $output
tar xvzf $input/yosys-${ARCH}.tar.gz
curl -fsSL $linux_yosys_url | tar xvzf - -C $output
# Wishbone Tool
wget -O $input/wishbone-tool-${ARCH}.tar.gz $linux_wishbone_tool_url
cd $output/bin
tar xvzf $input/wishbone-tool-${ARCH}.tar.gz
curl -fsSL $linux_wishbone_tool_url | tar xvzf - -C $output/bin
# Riscv Toolchain
# Note that we want to strip the front part of the path.
@ -163,17 +139,17 @@ case "${ARCH}" in
cd ..
rm -rf re
cd $base/output
cd $base/output/
tar cvzf $output_name.tar.gz $output_name
checksum_output .tar.gz
;;
*)
echo "Unrecognized architecture: ${ARCH}"
echo "Supported architectures: macos, windows, linux_x86_64"
echo "Unrecognized platform: ${ARCH}"
echo "Supported platforms: MacOS, Windows, Linux"
exit 1
;;
esac
echo "${TRAVIS_TAG}" > $output/VERSION
echo "${GITHUB_SHA}" > $output/VERSION
exit 0