From 9bc9c04b55b14a9e7b47800176868404469fc753 Mon Sep 17 00:00:00 2001 From: Timothee Cour Date: Fri, 30 Apr 2021 02:04:02 -0700 Subject: [PATCH] undo temporary CI removal --- .github/workflows/ci_docs.yml | 100 ++++++++++++++++ .github/workflows/ci_packages.yml | 68 +++++++++++ azure-pipelines.yml | 183 ++++++++++++++++++++++++++++++ 3 files changed, 351 insertions(+) create mode 100644 .github/workflows/ci_docs.yml create mode 100644 .github/workflows/ci_packages.yml create mode 100644 azure-pipelines.yml diff --git a/.github/workflows/ci_docs.yml b/.github/workflows/ci_docs.yml new file mode 100644 index 0000000000000..1459d6a317be9 --- /dev/null +++ b/.github/workflows/ci_docs.yml @@ -0,0 +1,100 @@ +name: Nim Docs CI +on: + push: + paths: + - 'compiler/docgen.nim' + - 'compiler/renderverbatim.nim' + - 'config/nimdoc.cfg' + - 'doc/**.rst' + - 'doc/nimdoc.css' + - 'lib/**.nim' + - 'nimdoc/testproject/expected/testproject.html' + - 'tools/dochack/dochack.nim' + - 'tools/kochdocs.nim' + - '.github/workflows/ci_docs.yml' + - 'koch.nim' + pull_request: + # Run only on changes on these files. + paths: + - 'compiler/docgen.nim' + - 'compiler/renderverbatim.nim' + - 'config/nimdoc.cfg' + - 'doc/**.rst' + - 'doc/nimdoc.css' + - 'lib/**.nim' + - 'nimdoc/testproject/expected/testproject.html' + - 'tools/dochack/dochack.nim' + - 'tools/kochdocs.nim' + - '.github/workflows/ci_docs.yml' + - 'koch.nim' + +jobs: + build: + strategy: + fail-fast: false + matrix: + target: [linux, windows, osx] + include: + - target: linux + os: ubuntu-18.04 + - target: windows + os: windows-2019 + - target: osx + os: macos-10.15 + + name: ${{ matrix.target }} + runs-on: ${{ matrix.os }} + + steps: + - name: 'Checkout' + uses: actions/checkout@v2 + with: + fetch-depth: 2 + + - name: 'Install build dependencies (macOS)' + if: runner.os == 'macOS' + run: brew install make + + - name: 'Install build dependencies (Windows)' + if: runner.os == 'Windows' + shell: bash + run: | + mkdir dist + curl -L https://nim-lang.org/download/mingw64.7z -o dist/mingw64.7z + curl -L https://nim-lang.org/download/dlls.zip -o dist/dlls.zip + 7z x dist/mingw64.7z -odist + 7z x dist/dlls.zip -obin + echo "${{ github.workspace }}/dist/mingw64/bin" >> "${GITHUB_PATH}" + + - name: 'Add build binaries to PATH' + shell: bash + run: echo "${{ github.workspace }}/bin" >> "${GITHUB_PATH}" + + - name: 'Build csourcesAny' + shell: bash + run: . ci/funs.sh && nimBuildCsourcesIfNeeded CC=gcc + # was previously using caching via `actions/cache@v1` but this wasn't + # used in other CI pipelines and it's unclear the added complexity + # was worth the saving; can be revisited if needed. + + - name: 'Build koch' + shell: bash + run: nim c koch + + - name: 'Build the real compiler' + shell: bash + run: ./koch boot -d:release + + - name: 'Build documentation' + shell: bash + run: ./koch doc --git.commit:devel + + - name: 'Publish documentation to Github Pages' + if: | + github.event_name == 'push' && github.ref == 'refs/heads/devel' && + matrix.target == 'linux' + uses: crazy-max/ghaction-github-pages@v1 + with: + build_dir: doc/html + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/ci_packages.yml b/.github/workflows/ci_packages.yml new file mode 100644 index 0000000000000..c6355bbcbd157 --- /dev/null +++ b/.github/workflows/ci_packages.yml @@ -0,0 +1,68 @@ +name: Packages CI +on: [push, pull_request] + +jobs: + build: + strategy: + fail-fast: false + matrix: + os: [ubuntu-18.04, macos-10.15] + cpu: [amd64] + batch: ["allowed_failures", "0_3", "1_3", "2_3"] # list of `index_num` + name: '${{ matrix.os }} (batch: ${{ matrix.batch }})' + runs-on: ${{ matrix.os }} + env: + NIM_TEST_PACKAGES: "1" + NIM_TESTAMENT_BATCH: ${{ matrix.batch }} + steps: + - name: 'Checkout' + uses: actions/checkout@v2 + with: + fetch-depth: 2 + + - name: 'Install node.js 12.x' + uses: actions/setup-node@v1 + with: + node-version: '12.x' + + - name: 'Install dependencies (Linux amd64)' + if: runner.os == 'Linux' && matrix.cpu == 'amd64' + run: | + sudo apt-fast update -qq + DEBIAN_FRONTEND='noninteractive' \ + sudo apt-fast install --no-install-recommends -yq \ + libcurl4-openssl-dev libgc-dev libsdl1.2-dev libsfml-dev \ + valgrind libc6-dbg libblas-dev xorg-dev + - name: 'Install dependencies (macOS)' + if: runner.os == 'macOS' + run: brew install boehmgc make sfml gtk+3 + - name: 'Install dependencies (Windows)' + if: runner.os == 'Windows' + shell: bash + run: | + mkdir dist + curl -L https://nim-lang.org/download/mingw64.7z -o dist/mingw64.7z + curl -L https://nim-lang.org/download/dlls.zip -o dist/dlls.zip + 7z x dist/mingw64.7z -odist + 7z x dist/dlls.zip -obin + echo "${{ github.workspace }}/dist/mingw64/bin" >> "${GITHUB_PATH}" + + - name: 'Add build binaries to PATH' + shell: bash + run: echo "${{ github.workspace }}/bin" >> "${GITHUB_PATH}" + + - name: 'Build csourcesAny' + shell: bash + run: . ci/funs.sh && nimBuildCsourcesIfNeeded CC=gcc ucpu='${{ matrix.cpu }}' + + - name: 'Build koch' + shell: bash + run: nim c koch + - name: 'Run CI' + shell: bash + run: ./koch runCI + + - name: 'Show failed tests' + if: failure() + shell: bash + run: nim c -r tools/ci_testresults.nim diff --git a/azure-pipelines.yml b/azure-pipelines.yml new file mode 100644 index 0000000000000..8cf69f52804d1 --- /dev/null +++ b/azure-pipelines.yml @@ -0,0 +1,183 @@ +trigger: + branches: + include: + - '*' +pr: + branches: + include: + - '*' + +variables: +- name: skipci + value: false + +jobs: +- job: packages + + timeoutInMinutes: 90 # default `60` led to lots of cancelled jobs; use 0 for unlimited (may be undesirable) + + strategy: + matrix: + Linux_amd64: + vmImage: 'ubuntu-16.04' + CPU: amd64 + Linux_i386: + # bug #17325: fails on 'ubuntu-16.04' because it now errors with: + # g++-multilib : Depends: gcc-multilib (>= 4:5.3.1-1ubuntu1) but it is not going to be installed + vmImage: 'ubuntu-18.04' + CPU: i386 + OSX_amd64: + vmImage: 'macOS-10.15' + CPU: amd64 + OSX_amd64_cpp: + vmImage: 'macOS-10.15' + CPU: amd64 + NIM_COMPILE_TO_CPP: true + Windows_amd64_batch0_3: + vmImage: 'windows-2019' + CPU: amd64 + # see also: `NIM_TEST_PACKAGES` + NIM_TESTAMENT_BATCH: "0_3" + Windows_amd64_batch1_3: + vmImage: 'windows-2019' + CPU: amd64 + NIM_TESTAMENT_BATCH: "1_3" + Windows_amd64_batch2_3: + vmImage: 'windows-2019' + CPU: amd64 + NIM_TESTAMENT_BATCH: "2_3" + + pool: + vmImage: $(vmImage) + + workspace: + clean: all + + steps: + - bash: git config --global core.autocrlf false + displayName: 'Disable auto conversion to CRLF by git (Windows-only)' + condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT')) + + - checkout: self + fetchDepth: 2 # see D20210329T004830 + + - bash: | + set -e + . ci/funs.sh + if nimIsCiSkip; then + echo '##vso[task.setvariable variable=skipci]true' + fi + displayName: 'Check whether to skip CI' + + - task: NodeTool@0 + inputs: + versionSpec: '12.x' + displayName: 'Install node.js 12.x' + condition: and(succeeded(), eq(variables['skipci'], 'false')) + + - bash: | + set -e + . ci/funs.sh + echo_run sudo apt-fast update -qq + DEBIAN_FRONTEND='noninteractive' \ + echo_run sudo apt-fast install --no-install-recommends -yq \ + libcurl4-openssl-dev libgc-dev libsdl1.2-dev libsfml-dev valgrind libc6-dbg + displayName: 'Install dependencies (amd64 Linux)' + condition: and(succeeded(), eq(variables['skipci'], 'false'), eq(variables['Agent.OS'], 'Linux'), eq(variables['CPU'], 'amd64')) + + - bash: | + set -e + . ci/funs.sh + echo_run sudo dpkg --add-architecture i386 + # Downgrade llvm: + # - llvm has to be downgraded to have 32bit version installed for sfml. + + cat << EOF | sudo tee /etc/apt/preferences.d/pin-to-rel + Package: libllvm6.0 + Pin: origin "azure.archive.ubuntu.com" + Pin-Priority: 1001 + EOF + + # echo_run sudo apt-fast update -qq + echo_run sudo apt-fast update -qq || echo "failed, see bug #17343" + # `:i386` (e.g. in `libffi-dev:i386`) is needed otherwise you may get: + # `could not load: libffi.so` during dynamic loading. + DEBIAN_FRONTEND='noninteractive' \ + echo_run sudo apt-fast install --no-install-recommends --allow-downgrades -yq \ + g++-multilib gcc-multilib libcurl4-openssl-dev:i386 libgc-dev:i386 \ + libsdl1.2-dev:i386 libsfml-dev:i386 libglib2.0-dev:i386 libffi-dev:i386 + + cat << EOF > bin/gcc + #!/bin/bash + + exec $(which gcc) -m32 "\$@" + EOF + + cat << EOF > bin/g++ + #!/bin/bash + + exec $(which g++) -m32 "\$@" + EOF + + echo_run chmod 755 bin/gcc + echo_run chmod 755 bin/g++ + + displayName: 'Install dependencies (i386 Linux)' + condition: and(succeeded(), eq(variables['skipci'], 'false'), eq(variables['Agent.OS'], 'Linux'), eq(variables['CPU'], 'i386')) + + - bash: brew install boehmgc make sfml + displayName: 'Install dependencies (OSX)' + condition: and(succeeded(), eq(variables['skipci'], 'false'), eq(variables['Agent.OS'], 'Darwin')) + + - bash: | + set -e + . ci/funs.sh + echo_run mkdir dist + echo_run curl -L https://nim-lang.org/download/mingw64.7z -o dist/mingw64.7z + echo_run curl -L https://nim-lang.org/download/dlls.zip -o dist/dlls.zip + echo_run 7z x dist/mingw64.7z -odist + echo_run 7z x dist/dlls.zip -obin + echo_run echo '##vso[task.prependpath]$(System.DefaultWorkingDirectory)/dist/mingw64/bin' + + displayName: 'Install dependencies (Windows)' + condition: and(succeeded(), eq(variables['skipci'], 'false'), eq(variables['Agent.OS'], 'Windows_NT')) + + - bash: echo '##vso[task.prependpath]$(System.DefaultWorkingDirectory)/bin' + condition: and(succeeded(), eq(variables['skipci'], 'false')) + displayName: 'Add build binaries to PATH' + + - bash: | + set -e + . ci/funs.sh + echo_run echo 'PATH:' "$PATH" + echo_run echo '##[section]gcc version' + echo_run gcc -v + echo_run echo '##[section]nodejs version' + echo_run node -v + echo_run echo '##[section]make version' + echo_run make -v + condition: and(succeeded(), eq(variables['skipci'], 'false')) + displayName: 'System information' + + - bash: . ci/funs.sh && nimBuildCsourcesIfNeeded CC=gcc ucpu=$(CPU) + condition: and(succeeded(), eq(variables['skipci'], 'false')) + displayName: 'Build csourcesAny' + + # this could be revived if performance justifies it (needs a few updates) + # - task: Cache@2 + # inputs: + # key: 'csourcesAny | "$(Agent.OS)" | $(CPU) | $(csources_version)' + # path: $(nim_csources) + # condition: and(succeeded(), eq(variables['skipci'], 'false')) + # displayName: 'Restore built csourcesAny' + + - bash: nim c koch + condition: and(succeeded(), eq(variables['skipci'], 'false')) + displayName: 'Build koch' + + # set result to omit the "bash exited with error code '1'" message + - bash: ./koch runCI || echo '##vso[task.complete result=Failed]' + condition: and(succeeded(), eq(variables['skipci'], 'false')) + displayName: 'Run CI' + env: + SYSTEM_ACCESSTOKEN: $(System.AccessToken)