diff --git a/.github/actions/nimbus-build-system/action.yml b/.github/actions/nimbus-build-system/action.yml deleted file mode 100644 index e97cdec..0000000 --- a/.github/actions/nimbus-build-system/action.yml +++ /dev/null @@ -1,226 +0,0 @@ -# Adapted from: -# https://github.com/status-im/nimbus-eth2/blob/stable/.github/workflows/ci.yml - -name: Setup Nimbus Build System -inputs: - os: - description: "Operating system to build for" - required: true - cpu: - description: "CPU to build for" - default: "amd64" - nim_version: - description: "Nim version" - default: "v2.0.14" - rust_version: - description: "Rust version" - default: "1.79.0" - shell: - description: "Shell to run commands in" - default: "bash --noprofile --norc -e -o pipefail" - coverage: - description: "True if the process is used for coverage" - default: false -runs: - using: "composite" - steps: - - name: Rust (Linux) - if: inputs.os == 'ubuntu-latest' - shell: ${{ inputs.shell }} {0} - run: | - curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs/ | sh -s -- --default-toolchain=${{ inputs.rust_version }} -y - - - name: APT (Linux amd64/arm64) - if: inputs.os == 'ubuntu-latest' && (inputs.cpu == 'amd64' || inputs.cpu == 'arm64') - shell: ${{ inputs.shell }} {0} - run: | - sudo apt-get update -qq - sudo DEBIAN_FRONTEND='noninteractive' apt-get install \ - --no-install-recommends -yq lcov - - - name: APT (Linux i386) - if: inputs.os == 'ubuntu-latest' && inputs.cpu == 'i386' - shell: ${{ inputs.shell }} {0} - run: | - sudo dpkg --add-architecture i386 - sudo apt-get update -qq - sudo DEBIAN_FRONTEND='noninteractive' apt-get install \ - --no-install-recommends -yq gcc-multilib g++-multilib - - - name: Homebrew (macOS) - if: inputs.os == 'macos-latest' - shell: ${{ inputs.shell }} {0} - run: | - brew install libomp - - - name: MSYS2 (Windows amd64) - if: inputs.os == 'windows-latest' && inputs.cpu == 'amd64' - uses: msys2/setup-msys2@v2 - with: - path-type: inherit - msystem: UCRT64 - install: > - base-devel - git - mingw-w64-ucrt-x86_64-toolchain - mingw-w64-ucrt-x86_64-cmake - mingw-w64-ucrt-x86_64-ntldd-git - mingw-w64-ucrt-x86_64-rust - - - name: MSYS2 (Windows i386) - if: inputs.os == 'windows-latest' && inputs.cpu == 'i386' - uses: msys2/setup-msys2@v2 - with: - path-type: inherit - msystem: MINGW32 - install: > - base-devel - git - mingw-w64-i686-toolchain - mingw-w64-i686-cmake - mingw-w64-i686-ntldd-git - mingw-w64-i686-rust - - - name: Install gcc 14 on Linux - # We don't want to install gcc 14 for coverage (Ubuntu 20.04) - if : ${{ inputs.os == 'ubuntu-latest' && inputs.coverage != 'true' }} - shell: ${{ inputs.shell }} {0} - run: | - # Skip for older Ubuntu versions - if [[ $(lsb_release -r | awk -F '[^0-9]+' '{print $2}') -ge 24 ]]; then - # Install GCC-14 - sudo apt-get update -qq - sudo apt-get install -yq gcc-14 - # Add GCC-14 to alternatives - sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-14 14 - # Set GCC-14 as the default - sudo update-alternatives --set gcc /usr/bin/gcc-14 - fi - - - name: Install ccache on Linux/Mac - if: inputs.os == 'ubuntu-latest' || inputs.os == 'macos-latest' - uses: hendrikmuhs/ccache-action@v1.2 - with: - create-symlink: true - key: ${{ inputs.os }}-${{ inputs.builder }}-${{ inputs.cpu }}-${{ inputs.tests }}-${{ inputs.nim_version }} - evict-old-files: 7d - - - name: Install ccache on Windows - if: inputs.os == 'windows-latest' - uses: hendrikmuhs/ccache-action@v1.2 - with: - key: ${{ inputs.os }}-${{ inputs.builder }}-${{ inputs.cpu }}-${{ inputs.tests }}-${{ inputs.nim_version }} - evict-old-files: 7d - - - name: Enable ccache on Windows - if: inputs.os == 'windows-latest' - shell: ${{ inputs.shell }} {0} - run: | - CCACHE_DIR=$(dirname $(which ccache))/ccached - mkdir ${CCACHE_DIR} - ln -s $(which ccache) ${CCACHE_DIR}/gcc.exe - ln -s $(which ccache) ${CCACHE_DIR}/g++.exe - ln -s $(which ccache) ${CCACHE_DIR}/cc.exe - ln -s $(which ccache) ${CCACHE_DIR}/c++.exe - echo "export PATH=${CCACHE_DIR}:\$PATH" >> $HOME/.bash_profile # prefix path in MSYS2 - - - name: Derive environment variables - shell: ${{ inputs.shell }} {0} - run: | - quote () { - local quoted=${1//\'/\'\\\'\'}; - printf "'%s'" "$quoted" - } - - [[ '${{ inputs.cpu }}' == 'i386' ]] && echo "ARCH_OVERRIDE=ARCH_OVERRIDE=x86" >> ${GITHUB_ENV} - - # Stack usage on Linux amd64/arm64 - if [[ '${{ inputs.os }}' == 'ubuntu-latest' && ('${{ inputs.cpu }}' == 'amd64' || '${{ inputs.cpu }}' == 'arm64')]]; then - NIMFLAGS="${NIMFLAGS} -d:limitStackUsage" - echo "NIMFLAGS=${NIMFLAGS}" >> $GITHUB_ENV - fi - - # Disable ADX on Linux i386 - if [[ '${{ inputs.os }}' == 'ubuntu-latest' && '${{ inputs.cpu }}' == 'i386' ]]; then - CFLAGS="${CFLAGS} -m32 -mno-adx" - echo "CFLAGS=${CFLAGS}" >> ${GITHUB_ENV} - CXXFLAGS="${CXXFLAGS} -m32 -mno-adx" - echo "CXXFLAGS=${CXXFLAGS}" >> ${GITHUB_ENV} - mkdir -p external/bin - cat << EOF > external/bin/gcc - #!/bin/bash - exec $(which gcc) -m32 -mno-adx "\$@" - EOF - cat << EOF > external/bin/g++ - #!/bin/bash - exec $(which g++) -m32 -mno-adx "\$@" - EOF - chmod 755 external/bin/gcc external/bin/g++ - echo "$(pwd)/external/bin" >> ${GITHUB_PATH} - # --passC:'-m32 -mno-adx' is redundant but harmless, and can be - # helpful when reviewing build output with increased verbosity - NIMFLAGS="${NIMFLAGS} $(quote "--passC:'-m32 -mno-adx' -d:LeopardCmakeFlags='-DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=$(pwd)/external/bin/gcc -DCMAKE_CXX_COMPILER=$(pwd)/external/bin/g++'")" - echo "NIMFLAGS=${NIMFLAGS}" >> $GITHUB_ENV - fi - - # Disable ADX on Windows i386 - if [[ '${{ inputs.os }}' == 'windows-latest' && '${{ inputs.cpu }}' == 'i386' ]]; then - CFLAGS="${CFLAGS} -mno-adx" - echo "CFLAGS=${CFLAGS}" >> ${GITHUB_ENV} - CXXFLAGS="${CXXFLAGS} -mno-adx" - echo "CXXFLAGS=${CXXFLAGS}" >> ${GITHUB_ENV} - NIMFLAGS="${NIMFLAGS} --passC:-mno-adx" - echo "NIMFLAGS=${NIMFLAGS}" >> $GITHUB_ENV - fi - - # Enable OpenMP on macOS - if [[ '${{ inputs.os }}' == 'macos-latest' ]]; then - libomp_lib_dir="$(brew --prefix)/opt/libomp/lib" - # See https://github.com/actions/virtual-environments/pull/5819 - llvm_dir="$(ls -d $(brew --prefix)/opt/llvm* | tail -1)" - llvm_bin_dir="${llvm_dir}/bin" - llvm_lib_dir="${llvm_dir}/lib" - echo "${llvm_bin_dir}" >> ${GITHUB_PATH} - # Make sure ccache has precedence (GITHUB_PATH is appending before) - echo "$(brew --prefix)/opt/ccache/libexec" >> ${GITHUB_PATH} - echo $PATH - echo "LDFLAGS=${LDFLAGS} -L${libomp_lib_dir} -L${llvm_lib_dir} -Wl,-rpath,${llvm_lib_dir}" >> ${GITHUB_ENV} - NIMFLAGS="${NIMFLAGS} $(quote "-d:LeopardCmakeFlags='-DCMAKE_BUILD_TYPE=Release' -d:LeopardExtraCompilerFlags='-fopenmp' -d:LeopardExtraLinkerFlags='-fopenmp -L${libomp_lib_dir}'")" - echo "NIMFLAGS=${NIMFLAGS}" >> $GITHUB_ENV - fi - - # Use all available CPUs for build process - ncpu="" - case '${{ inputs.os }}' in - 'linux') ncpu=$(nproc) ;; - 'macos') ncpu=$(sysctl -n hw.ncpu) ;; - 'windows') ncpu=${NUMBER_OF_PROCESSORS} ;; - esac - [[ -z "$ncpu" || $ncpu -le 0 ]] && ncpu=1 - echo "ncpu=${ncpu}" >> ${GITHUB_ENV} - - - name: Restore Nim toolchain binaries from cache - id: nim-cache - uses: actions/cache@v4 - if : ${{ inputs.coverage != 'true' }} - with: - path: NimBinaries - key: ${{ inputs.os }}-${{ inputs.cpu }}-nim-${{ inputs.nim_version }}-cache-${{ env.cache_nonce }}-${{ github.run_id }} - restore-keys: ${{ inputs.os }}-${{ inputs.cpu }}-nim-${{ inputs.nim_version }}-cache-${{ env.cache_nonce }} - - - name: Set NIM_COMMIT - shell: ${{ inputs.shell }} {0} - run: echo "NIM_COMMIT=${{ inputs.nim_version }}" >> ${GITHUB_ENV} - - - name: MSYS2 (Windows All) - Disable git symbolic links (since miniupnp 2.2.5) - if: inputs.os == 'windows-latest' - shell: ${{ inputs.shell }} {0} - run: | - git config --global core.symlinks false - - - name: Build Nim and Codex dependencies - shell: ${{ inputs.shell }} {0} - run: | - which gcc - gcc --version - make -j${ncpu} CI_CACHE=NimBinaries ${ARCH_OVERRIDE} QUICK_AND_DIRTY_COMPILER=1 update \ No newline at end of file diff --git a/.github/workflows/artifacts.yml b/.github/workflows/artifacts.yml index a0e25a1..03467be 100644 --- a/.github/workflows/artifacts.yml +++ b/.github/workflows/artifacts.yml @@ -2,9 +2,9 @@ name: Artifacts on: push: + tags: + - "v*" workflow_dispatch: - # tags: - # - 'v*' jobs: build: @@ -87,15 +87,17 @@ jobs: vendor/nim-codex/library/libcodex.h if-no-files-found: error - # publish-release: - # needs: build - # runs-on: ubuntu-22.04 - # steps: - # - uses: actions/download-artifact@v4 - # with: - # path: dist - # - name: Create release draft - # uses: softprops/action-gh-release@v1 - # with: - # files: dist/**/codex-*.{tar.gz,zip} - # draft: true + publish-release: + needs: build + runs-on: ubuntu-latest + if: startsWith(github.ref, 'refs/tags/') + steps: + - uses: actions/download-artifact@v5 + with: + path: dist + - name: Create release + uses: softprops/action-gh-release@v2 + with: + body_path: ${{ github.workspace }}-RELEASE.md + files: dist/** + draft: true