From 35b6780debfd7785eaaeb178bba177d8cccf62e3 Mon Sep 17 00:00:00 2001 From: umarcor Date: Sat, 10 Oct 2020 16:00:11 +0200 Subject: [PATCH 1/5] use tar option '-C' --- build.sh | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/build.sh b/build.sh index 4118098..0c4ec29 100755 --- a/build.sh +++ b/build.sh @@ -77,8 +77,7 @@ case "${ARCH}" in # 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 + tar xvzf $input/wishbone-tool-${ARCH}.tar.gz -C $output/bin # Riscv Toolchain # Note that we want to strip the front part of the path. @@ -105,18 +104,15 @@ case "${ARCH}" in "macos") # Nextpnr wget -O $input/nextpnr-${ARCH}.tar.gz $mac_nextpnr_url - cd $output - tar xvzf $input/nextpnr-${ARCH}.tar.gz + tar xvzf $input/nextpnr-${ARCH}.tar.gz -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 + tar xvzf $input/yosys-${ARCH}.tar.gz -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 + tar xvzf $input/wishbone-tool-${ARCH}.tar.gz -C $output/bin # Riscv Toolchain # Note that we want to strip the front part of the path. @@ -138,18 +134,15 @@ case "${ARCH}" in "linux_x86_64") # Nextpnr wget -O $input/nextpnr-${ARCH}.tar.gz $linux_nextpnr_url - cd $output - tar xvzf $input/nextpnr-${ARCH}.tar.gz + tar xvzf $input/nextpnr-${ARCH}.tar.gz -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 + tar xvzf $input/yosys-${ARCH}.tar.gz -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 + tar xvzf $input/wishbone-tool-${ARCH}.tar.gz -C $output/bin # Riscv Toolchain # Note that we want to strip the front part of the path. @@ -163,7 +156,7 @@ 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 ;; From e74aecd4891982f3b4896bc2efccbd1d27bd9823 Mon Sep 17 00:00:00 2001 From: umarcor Date: Sat, 10 Oct 2020 16:57:16 +0200 Subject: [PATCH 2/5] use curl for tar.gz assets --- build.sh | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/build.sh b/build.sh index 0c4ec29..bac6daf 100755 --- a/build.sh +++ b/build.sh @@ -76,8 +76,7 @@ case "${ARCH}" in unzip -o $input/teraterm-${ARCH}.zip # Wishbone Tool - wget -O $input/wishbone-tool-${ARCH}.tar.gz $win_wishbone_tool_url - tar xvzf $input/wishbone-tool-${ARCH}.tar.gz -C $output/bin + 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. @@ -103,16 +102,13 @@ case "${ARCH}" in "macos") # Nextpnr - wget -O $input/nextpnr-${ARCH}.tar.gz $mac_nextpnr_url - tar xvzf $input/nextpnr-${ARCH}.tar.gz -C $output + curl -fsSL $mac_nextpnr_url | tar xvzf - -C $output # Yosys, icestorm, and dfu_util - wget -O $input/yosys-${ARCH}.tar.gz $mac_yosys_url - tar xvzf $input/yosys-${ARCH}.tar.gz -C $output + curl -fsSL $mac_yosys_url | tar xvzf - -C $output # Wishbone Tool - wget -O $input/wishbone-tool-${ARCH}.tar.gz $mac_wishbone_tool_url - tar xvzf $input/wishbone-tool-${ARCH}.tar.gz -C $output/bin + 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. @@ -133,16 +129,13 @@ case "${ARCH}" in "linux_x86_64") # Nextpnr - wget -O $input/nextpnr-${ARCH}.tar.gz $linux_nextpnr_url - tar xvzf $input/nextpnr-${ARCH}.tar.gz -C $output + curl -fsSL $linux_nextpnr_url | tar xvzf - -C $output # Yosys, icestorm, and dfu_util - wget -O $input/yosys-${ARCH}.tar.gz $linux_yosys_url - tar xvzf $input/yosys-${ARCH}.tar.gz -C $output + curl -fsSL $linux_yosys_url | tar xvzf - -C $output # Wishbone Tool - wget -O $input/wishbone-tool-${ARCH}.tar.gz $linux_wishbone_tool_url - tar xvzf $input/wishbone-tool-${ARCH}.tar.gz -C $output/bin + 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. From 1c441a2344825a57e257ba1e6a19957390eac130 Mon Sep 17 00:00:00 2001 From: umarcor Date: Sat, 10 Oct 2020 17:02:45 +0200 Subject: [PATCH 3/5] add 'extract_zip' --- build.sh | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/build.sh b/build.sh index bac6daf..eb4a8f2 100755 --- a/build.sh +++ b/build.sh @@ -51,29 +51,27 @@ checksum_output() { set -x } +extract_zip() { + wget -O "$2" "$1" + cd $output"$3" + unzip -o "$2" +} + case "${ARCH}" in "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 curl -fsSL $win_wishbone_tool_url | tar xvzf - -C $output/bin From a85a64a66b02e9077edb34857be8fcd297aada23 Mon Sep 17 00:00:00 2001 From: umarcor Date: Sat, 10 Oct 2020 13:21:49 +0200 Subject: [PATCH 4/5] ci: migrate from Travis CI to GitHub Actions --- .github/workflows/update.yml | 49 ++++++++++++++++++++++++++++++++++++ .travis.yml | 33 ------------------------ build.sh | 22 ++++++---------- 3 files changed, 56 insertions(+), 48 deletions(-) create mode 100644 .github/workflows/update.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/update.yml b/.github/workflows/update.yml new file mode 100644 index 0000000..86648cf --- /dev/null +++ b/.github/workflows/update.yml @@ -0,0 +1,49 @@ +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 + + release: + if: github.event_name != 'pull_request' && (github.ref == 'refs/heads/master' || contains(github.ref, 'refs/tags/')) + needs: [ run ] + runs-on: ubuntu-latest + steps: + + - uses: actions/download-artifact@v2 + + - uses: eine/tip@master + with: + token: ${{ github.token }} + tag: nightly + files: ./** diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index c619ba9..0000000 --- a/.travis.yml +++ /dev/null @@ -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+/ \ No newline at end of file diff --git a/build.sh b/build.sh index eb4a8f2..928149e 100755 --- a/build.sh +++ b/build.sh @@ -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" @@ -58,7 +50,7 @@ extract_zip() { } case "${ARCH}" in - "windows") + "Windows") # Python 3.7.3 (which matches the version in nextpnr) extract_zip $win_python_url $input/python-${ARCH}.zip "/bin" rm python37.zip # we already have this unzipped from nextpnr-ice40 @@ -98,7 +90,7 @@ case "${ARCH}" in checksum_output .zip ;; - "macos") + "macOS") # Nextpnr curl -fsSL $mac_nextpnr_url | tar xvzf - -C $output @@ -125,7 +117,7 @@ case "${ARCH}" in checksum_output .zip ;; - "linux_x86_64") + "Linux") # Nextpnr curl -fsSL $linux_nextpnr_url | tar xvzf - -C $output @@ -152,12 +144,12 @@ case "${ARCH}" in 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 From 11b0b3000ff35065acaef17f9db59a58322469ab Mon Sep 17 00:00:00 2001 From: umarcor Date: Sat, 10 Oct 2020 21:11:27 +0200 Subject: [PATCH 5/5] ci: test workshop before uploading assets --- .github/workflows/update.yml | 67 +++++++++++++++++++++++++++++++++++- 1 file changed, 66 insertions(+), 1 deletion(-) diff --git a/.github/workflows/update.yml b/.github/workflows/update.yml index 86648cf..49bfaae 100644 --- a/.github/workflows/update.yml +++ b/.github/workflows/update.yml @@ -34,9 +34,74 @@ jobs: 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: [ run ] + needs: [ test ] runs-on: ubuntu-latest steps: