-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable gh actions to run on multiple platforms (#479)
* enable github actions * bring back azure pipelines * brang back codecov and nbc bump * disable bash tracing * wip * disable azure * re-enable windows * use GOPATH to determine go workspace
- Loading branch information
Showing
5 changed files
with
208 additions
and
186 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,207 @@ | ||
name: nim-libp2p CI | ||
on: [push, pull_request] | ||
|
||
jobs: | ||
build: | ||
strategy: | ||
fail-fast: false | ||
max-parallel: 20 | ||
matrix: | ||
branch: [v1.2.6] | ||
target: | ||
# Unit tests | ||
- os: linux | ||
cpu: amd64 | ||
TEST_KIND: unit-tests | ||
- os: linux | ||
cpu: i386 | ||
TEST_KIND: unit-tests | ||
- os: macos | ||
cpu: amd64 | ||
TEST_KIND: unit-tests | ||
- os: windows | ||
cpu: i386 | ||
TEST_KIND: unit-tests | ||
- os: windows | ||
cpu: amd64 | ||
TEST_KIND: unit-tests | ||
include: | ||
- target: | ||
os: linux | ||
builder: ubuntu-18.04 | ||
- target: | ||
os: macos | ||
builder: macos-10.15 | ||
- target: | ||
os: windows | ||
builder: windows-2019 | ||
name: '${{ matrix.target.os }}-${{ matrix.target.cpu }} (${{ matrix.branch }})' | ||
runs-on: ${{ matrix.builder }} | ||
steps: | ||
- name: Checkout nim-libp2p | ||
uses: actions/checkout@v2 | ||
with: | ||
path: nim-libp2p | ||
submodules: true | ||
- name: Install build dependencies (Linux i386) | ||
if: runner.os == 'Linux' && matrix.target.cpu == 'i386' | ||
run: | | ||
sudo dpkg --add-architecture i386 | ||
sudo apt-fast update -qq | ||
sudo DEBIAN_FRONTEND='noninteractive' apt-fast install \ | ||
--no-install-recommends -yq gcc-multilib g++-multilib \ | ||
libssl-dev:i386 | ||
mkdir -p external/bin | ||
cat << EOF > external/bin/gcc | ||
#!/bin/bash | ||
exec $(which gcc) -m32 "\$@" | ||
EOF | ||
cat << EOF > external/bin/g++ | ||
#!/bin/bash | ||
exec $(which g++) -m32 "\$@" | ||
EOF | ||
chmod 755 external/bin/gcc external/bin/g++ | ||
echo '${{ github.workspace }}/external/bin' >> $GITHUB_PATH | ||
- name: Install build dependencies (Windows) | ||
if: runner.os == 'Windows' | ||
shell: bash | ||
run: | | ||
mkdir external | ||
if [[ '${{ matrix.target.cpu }}' == 'amd64' ]]; then | ||
arch=64 | ||
else | ||
arch=32 | ||
fi | ||
curl -L "https://nim-lang.org/download/mingw$arch-6.3.0.7z" -o "external/mingw$arch.7z" | ||
curl -L "https://nim-lang.org/download/windeps.zip" -o external/windeps.zip | ||
7z x "external/mingw$arch.7z" -oexternal/ | ||
7z x external/windeps.zip -oexternal/dlls | ||
echo '${{ github.workspace }}'"/external/mingw$arch/bin" >> $GITHUB_PATH | ||
echo '${{ github.workspace }}'"/external/dlls" >> $GITHUB_PATH | ||
- name: Setup environment | ||
shell: bash | ||
run: echo '${{ github.workspace }}/nim/bin' >> $GITHUB_PATH | ||
|
||
- name: Get latest Nim commit hash | ||
id: versions | ||
shell: bash | ||
run: | | ||
getHash() { | ||
git ls-remote "https://github.com/$1" "${2:-HEAD}" | cut -f 1 | ||
} | ||
nimHash=$(getHash nim-lang/Nim '${{ matrix.branch }}') | ||
csourcesHash=$(getHash nim-lang/csources) | ||
echo "::set-output name=nim::$nimHash" | ||
echo "::set-output name=csources::$csourcesHash" | ||
- name: Restore prebuilt Nim from cache | ||
id: nim-cache | ||
uses: actions/cache@v1 | ||
with: | ||
path: nim | ||
key: "nim-${{ matrix.target.os }}-${{ matrix.target.cpu }}-${{ steps.versions.outputs.nim }}" | ||
|
||
- name: Restore prebuilt csources from cache | ||
if: steps.nim-cache.outputs.cache-hit != 'true' | ||
id: csources-cache | ||
uses: actions/cache@v1 | ||
with: | ||
path: csources/bin | ||
key: "csources-${{ matrix.target.os }}-${{ matrix.target.cpu }}-${{ steps.versions.outputs.csources }}" | ||
|
||
- name: Checkout Nim csources | ||
if: > | ||
steps.csources-cache.outputs.cache-hit != 'true' && | ||
steps.nim-cache.outputs.cache-hit != 'true' | ||
uses: actions/checkout@v2 | ||
with: | ||
repository: nim-lang/csources | ||
path: csources | ||
ref: ${{ steps.versions.outputs.csources }} | ||
|
||
- name: Checkout Nim | ||
if: steps.nim-cache.outputs.cache-hit != 'true' | ||
uses: actions/checkout@v2 | ||
with: | ||
repository: nim-lang/Nim | ||
path: nim | ||
ref: ${{ steps.versions.outputs.nim }} | ||
|
||
- name: Build Nim and associated tools | ||
if: steps.nim-cache.outputs.cache-hit != 'true' | ||
shell: bash | ||
run: | | ||
ncpu= | ||
ext= | ||
case '${{ runner.os }}' in | ||
'Linux') | ||
ncpu=$(nproc) | ||
;; | ||
'macOS') | ||
ncpu=$(sysctl -n hw.ncpu) | ||
;; | ||
'Windows') | ||
ncpu=$NUMBER_OF_PROCESSORS | ||
ext=.exe | ||
;; | ||
esac | ||
[[ -z "$ncpu" || $ncpu -le 0 ]] && ncpu=1 | ||
if [[ ! -e csources/bin/nim$ext ]]; then | ||
make -C csources -j $ncpu CC=gcc ucpu='${{ matrix.target.cpu }}' | ||
else | ||
echo 'Using prebuilt csources' | ||
fi | ||
cp -v csources/bin/nim$ext nim/bin | ||
cd nim | ||
nim c koch | ||
./koch boot -d:release | ||
./koch tools -d:release | ||
# clean up to save cache space | ||
rm koch | ||
rm -rf nimcache | ||
rm -rf dist | ||
rm -rf .git | ||
# - name: Install library dependencies (Linux amd64) | ||
# if: runner.os == 'Linux' && matrix.target.cpu == 'amd64' | ||
# run: | | ||
# sudo DEBIAN_FRONTEND='noninteractive' apt-fast install \ | ||
# --no-install-recommends -yq libgmp-dev | ||
# | ||
# - name: Install library dependencies (Linux i386) | ||
# if: runner.os == 'Linux' && matrix.target.cpu == 'i386' | ||
# run: | | ||
# sudo DEBIAN_FRONTEND='noninteractive' apt-fast install \ | ||
# libgmp-dev:i386 | ||
# | ||
# - name: Install library dependencies (macOS) | ||
# if: runner.os == 'macOS' | ||
# run: brew install gmp | ||
# | ||
# - name: Install library dependencies (Windows) | ||
# if: runner.os == 'Windows' | ||
# shell: bash | ||
# run: | | ||
# choco install msys2 | ||
# pacman -S mingw-w64-x86_64-gmp | ||
|
||
- name: Setup Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: '^1.15.5' | ||
|
||
- name: Install p2pd | ||
shell: bash | ||
run: | | ||
cd nim-libp2p | ||
V=1 bash scripts/build_p2pd.sh p2pdCache v0.3.0 | ||
- name: Run nim-libp2p tests | ||
shell: bash | ||
run: | | ||
export UCPU="$cpu" | ||
cd nim-libp2p | ||
nimble install -y --depsOnly | ||
nimble test |
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 |
---|---|---|
|
@@ -44,5 +44,3 @@ jobs: | |
path: nbc | ||
token: ${{ steps.generate-token.outputs.token }} | ||
title: nim-libp2p auto bump | ||
|
||
|
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.