From 47a2fbedce06481855071897c89c5c272b38256c Mon Sep 17 00:00:00 2001 From: meowsbits <45600330+meowsbits@users.noreply.github.com> Date: Tue, 12 May 2020 17:00:18 -0500 Subject: [PATCH 01/17] init Github Actions CI to build and archive llc binary --- .github/workflows/ci.yml | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000000000..999cc506b97b1 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,30 @@ +name: C/C++ CI + +on: + push: + branches: [ master ] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + with: + ref: EVM + - name: Build + run: | + mkdir build && cd build + cmake -DLLVM_TARGETS_TO_BUILD=EVM -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=EVM .. + make -j8 + cd - + - name: Archive + run: | + zip -j evm-llvm-llc-$GITHUB_SHA.zip build/bin/llc + shasum -a 256 evm-llvm-llc-$GITHUB_SHA.zip > evm-llvm-llc-$GITHUB_SHA.zip.sha256 + - name: Upload + uses: actions/upload-artifact@v2 + with: + name: llc-archive + path: evm-llvm-llc-*zip* From 6447b31cd7bfa01d0ae3b9da111ae354284e87c1 Mon Sep 17 00:00:00 2001 From: meowsbits <45600330+meowsbits@users.noreply.github.com> Date: Tue, 12 May 2020 17:00:58 -0500 Subject: [PATCH 02/17] fix CI Build branch to EVM (not master) --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 999cc506b97b1..2dbca87ac1ec2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,7 +2,7 @@ name: C/C++ CI on: push: - branches: [ master ] + branches: [ EVM ] jobs: build: From cecacc7ef52c592e31450b5c1ed436e8330519ec Mon Sep 17 00:00:00 2001 From: meows Date: Tue, 12 May 2020 20:09:12 -0500 Subject: [PATCH 03/17] .github/workflows/ci.yml: use proc number instead of 8 for make -j Make was killed with signal 9, meaning system ran out of RAM most likely. This is an attempt to fix that. https://github.com/meowsbits/evm_llvm/runs/668739545?check_suite_focus=true#step:3:2561 Signed-off-by: meows --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2dbca87ac1ec2..8d5f70d267086 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,7 +17,7 @@ jobs: run: | mkdir build && cd build cmake -DLLVM_TARGETS_TO_BUILD=EVM -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=EVM .. - make -j8 + make -j$(nproc) cd - - name: Archive run: | From ee23ca2bfc426467e6921e2bf6bbf4e7f181661d Mon Sep 17 00:00:00 2001 From: meowsbits <45600330+meowsbits@users.noreply.github.com> Date: Wed, 13 May 2020 06:40:08 -0500 Subject: [PATCH 04/17] Set up CI with Azure Pipelines [skip ci] --- azure-pipelines.yml | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 azure-pipelines.yml diff --git a/azure-pipelines.yml b/azure-pipelines.yml new file mode 100644 index 0000000000000..b379da8be89bd --- /dev/null +++ b/azure-pipelines.yml @@ -0,0 +1,31 @@ +# C/C++ with GCC +# Build your C/C++ project with GCC using make. +# Add steps that publish test results, save build artifacts, deploy, and more: +# https://docs.microsoft.com/azure/devops/pipelines/apps/c-cpp/gcc + +trigger: +- master +- EVM +- refs/tags/* + +pool: + vmImage: 'ubuntu-latest' + +steps: +- script: | + mkdir build && cd build + cmake -DLLVM_TARGETS_TO_BUILD=EVM -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=EVM .. + echo nproc: $(nproc) + echo ">>> make -j8" + make -j8 + cd .. + displayName: 'Build artifacts' +- task: ArchiveFiles@2 + inputs: + rootFolderOrFile: 'build/bin/llc' + includeRootFolder: false + archiveType: 'zip' + archiveFile: '$(Build.ArtifactStagingDirectory)/evm_llvm-llc.zip' +- script: | + shasum -a 256 $(Build.ArtifactStagingDirectory)/evm_llvm-llc.zip > $(Build.ArtifactStagingDirectory)/evm_llvm-llc.zip.sha256 + displayName: 'Finalize artifacts' \ No newline at end of file From 2d6774dadacbd301c1cf0f9f88d5d851c38d4411 Mon Sep 17 00:00:00 2001 From: meows Date: Wed, 13 May 2020 06:48:17 -0500 Subject: [PATCH 05/17] azure-pipelines.yml: fix: add step to publish artifacts Signed-off-by: meows --- azure-pipelines.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index b379da8be89bd..9acf5fed9941d 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -28,4 +28,5 @@ steps: archiveFile: '$(Build.ArtifactStagingDirectory)/evm_llvm-llc.zip' - script: | shasum -a 256 $(Build.ArtifactStagingDirectory)/evm_llvm-llc.zip > $(Build.ArtifactStagingDirectory)/evm_llvm-llc.zip.sha256 - displayName: 'Finalize artifacts' \ No newline at end of file + displayName: 'Finalize artifacts' +- task: PublishBuildArtifacts@1 \ No newline at end of file From 839804debd76ddb4ddd39871adc12b88cf07b119 Mon Sep 17 00:00:00 2001 From: meows Date: Wed, 13 May 2020 06:48:38 -0500 Subject: [PATCH 06/17] echo that make step is starting Signed-off-by: meows --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8d5f70d267086..bd6c6ebd2d2d9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,6 +17,7 @@ jobs: run: | mkdir build && cd build cmake -DLLVM_TARGETS_TO_BUILD=EVM -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=EVM .. + echo ">>> make -j$(nproc)" make -j$(nproc) cd - - name: Archive From e9214fe0b391537f42b13cd8f8bebd8f68de4722 Mon Sep 17 00:00:00 2001 From: meows Date: Wed, 13 May 2020 06:49:40 -0500 Subject: [PATCH 07/17] make -j(nproc) failed, try -j6 Log nproc Signed-off-by: meows --- .github/workflows/ci.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bd6c6ebd2d2d9..e011a13fb952c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,8 +17,9 @@ jobs: run: | mkdir build && cd build cmake -DLLVM_TARGETS_TO_BUILD=EVM -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=EVM .. - echo ">>> make -j$(nproc)" - make -j$(nproc) + echo "nproc: $(nproc)" + echo ">>> make -j6" + make -j6 cd - - name: Archive run: | From 31c2b1d3cbc6450b7c39a0222c364f975cb0e825 Mon Sep 17 00:00:00 2001 From: meows Date: Wed, 13 May 2020 06:53:44 -0500 Subject: [PATCH 08/17] use fetchDepth option to speed git fetch up Signed-off-by: meows --- azure-pipelines.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 9acf5fed9941d..176d7b92ed259 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -12,6 +12,8 @@ pool: vmImage: 'ubuntu-latest' steps: +- checkout: self + fetchDepth: 1 - script: | mkdir build && cd build cmake -DLLVM_TARGETS_TO_BUILD=EVM -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=EVM .. From 11d9390cadb2a02784301a1c63bd6da383f89ebc Mon Sep 17 00:00:00 2001 From: meows Date: Wed, 13 May 2020 08:17:05 -0500 Subject: [PATCH 09/17] problem: build failing because oom solution?: use CMAKE_BUILD_TYPE=Release to limit memory requirements Signed-off-by: meows --- .github/workflows/ci.yml | 2 +- azure-pipelines.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e011a13fb952c..3bbf2e21aaf6c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,7 +16,7 @@ jobs: - name: Build run: | mkdir build && cd build - cmake -DLLVM_TARGETS_TO_BUILD=EVM -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=EVM .. + cmake -DCMAKE_BUILD_TYPE=Release -DLLVM_TARGETS_TO_BUILD=EVM -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=EVM .. echo "nproc: $(nproc)" echo ">>> make -j6" make -j6 diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 176d7b92ed259..61c50d9617e0b 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -16,7 +16,7 @@ steps: fetchDepth: 1 - script: | mkdir build && cd build - cmake -DLLVM_TARGETS_TO_BUILD=EVM -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=EVM .. + cmake -DCMAKE_BUILD_TYPE=Release -DLLVM_TARGETS_TO_BUILD=EVM -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=EVM .. echo nproc: $(nproc) echo ">>> make -j8" make -j8 From 6d6d68c89f0745b3fc1d730e58e490501edf8042 Mon Sep 17 00:00:00 2001 From: meows Date: Wed, 13 May 2020 08:18:46 -0500 Subject: [PATCH 10/17] problem: ci build fails because oom solution?: add LLVM_USE_LINKER=gold to limit mem https://stackoverflow.com/questions/25197570/llvm-clang-compile-error-with-memory-exhausted#comment77614764_25221717 Signed-off-by: meows --- .github/workflows/ci.yml | 2 +- azure-pipelines.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3bbf2e21aaf6c..5185ac5177e33 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,7 +16,7 @@ jobs: - name: Build run: | mkdir build && cd build - cmake -DCMAKE_BUILD_TYPE=Release -DLLVM_TARGETS_TO_BUILD=EVM -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=EVM .. + cmake -DCMAKE_BUILD_TYPE=Release -DLLVM_USE_LINKER=gold -DLLVM_TARGETS_TO_BUILD=EVM -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=EVM .. echo "nproc: $(nproc)" echo ">>> make -j6" make -j6 diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 61c50d9617e0b..103042da9bf10 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -16,7 +16,7 @@ steps: fetchDepth: 1 - script: | mkdir build && cd build - cmake -DCMAKE_BUILD_TYPE=Release -DLLVM_TARGETS_TO_BUILD=EVM -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=EVM .. + cmake -DCMAKE_BUILD_TYPE=Release -DLLVM_USE_LINKER=gold -DLLVM_TARGETS_TO_BUILD=EVM -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=EVM .. echo nproc: $(nproc) echo ">>> make -j8" make -j8 From 459dd113ffc8654d4cd68cc48da6c141d7e3c9da Mon Sep 17 00:00:00 2001 From: meows Date: Wed, 13 May 2020 09:32:21 -0500 Subject: [PATCH 11/17] Revert "problem: ci build fails because oom" This reverts commit 6d6d68c89f0745b3fc1d730e58e490501edf8042. This change turned out to be unnecessary. --- .github/workflows/ci.yml | 2 +- azure-pipelines.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5185ac5177e33..3bbf2e21aaf6c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,7 +16,7 @@ jobs: - name: Build run: | mkdir build && cd build - cmake -DCMAKE_BUILD_TYPE=Release -DLLVM_USE_LINKER=gold -DLLVM_TARGETS_TO_BUILD=EVM -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=EVM .. + cmake -DCMAKE_BUILD_TYPE=Release -DLLVM_TARGETS_TO_BUILD=EVM -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=EVM .. echo "nproc: $(nproc)" echo ">>> make -j6" make -j6 diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 103042da9bf10..61c50d9617e0b 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -16,7 +16,7 @@ steps: fetchDepth: 1 - script: | mkdir build && cd build - cmake -DCMAKE_BUILD_TYPE=Release -DLLVM_USE_LINKER=gold -DLLVM_TARGETS_TO_BUILD=EVM -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=EVM .. + cmake -DCMAKE_BUILD_TYPE=Release -DLLVM_TARGETS_TO_BUILD=EVM -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=EVM .. echo nproc: $(nproc) echo ">>> make -j8" make -j8 From d8f2a2740f2cfeb99e6244c1d4a1c21de4f6cfdb Mon Sep 17 00:00:00 2001 From: meows Date: Wed, 13 May 2020 09:36:12 -0500 Subject: [PATCH 12/17] use nproc for make -j value Anecdotally, both Azure and Actions have 2 procs available. This configuration standardizes the make commands to use this value (whatever it is), and hopefully future- proofs it for optimzation to the CI env. Signed-off-by: meows --- .github/workflows/ci.yml | 4 +--- azure-pipelines.yml | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3bbf2e21aaf6c..d57e54e4368fd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,9 +17,7 @@ jobs: run: | mkdir build && cd build cmake -DCMAKE_BUILD_TYPE=Release -DLLVM_TARGETS_TO_BUILD=EVM -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=EVM .. - echo "nproc: $(nproc)" - echo ">>> make -j6" - make -j6 + make -j$(nproc) cd - - name: Archive run: | diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 61c50d9617e0b..9ffa70d90fdc2 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -17,9 +17,7 @@ steps: - script: | mkdir build && cd build cmake -DCMAKE_BUILD_TYPE=Release -DLLVM_TARGETS_TO_BUILD=EVM -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=EVM .. - echo nproc: $(nproc) - echo ">>> make -j8" - make -j8 + make -j$(nproc) cd .. displayName: 'Build artifacts' - task: ArchiveFiles@2 From 21fb8cdfe8221c4493dfa29f37299cd66ea91fec Mon Sep 17 00:00:00 2001 From: meows Date: Wed, 13 May 2020 09:36:54 -0500 Subject: [PATCH 13/17] use less idiomatic cd command in Actions CI Signed-off-by: meows --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d57e54e4368fd..c45b4838b8c32 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,7 +18,7 @@ jobs: mkdir build && cd build cmake -DCMAKE_BUILD_TYPE=Release -DLLVM_TARGETS_TO_BUILD=EVM -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=EVM .. make -j$(nproc) - cd - + cd .. - name: Archive run: | zip -j evm-llvm-llc-$GITHUB_SHA.zip build/bin/llc From e88b91716c8d2110cb8f36effc4b377b176e4266 Mon Sep 17 00:00:00 2001 From: meows Date: Wed, 13 May 2020 09:39:31 -0500 Subject: [PATCH 14/17] name archive with Build.SourceVersion env var This is congruent to behavior at Github Actions config. Signed-off-by: meows --- azure-pipelines.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 9ffa70d90fdc2..a0e8003efdcca 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -25,8 +25,9 @@ steps: rootFolderOrFile: 'build/bin/llc' includeRootFolder: false archiveType: 'zip' - archiveFile: '$(Build.ArtifactStagingDirectory)/evm_llvm-llc.zip' + archiveFile: '$(Build.ArtifactStagingDirectory)/evm_llvm-llc-$(Build.SourceVersion).zip' - script: | - shasum -a 256 $(Build.ArtifactStagingDirectory)/evm_llvm-llc.zip > $(Build.ArtifactStagingDirectory)/evm_llvm-llc.zip.sha256 + shasum -a 256 $(Build.ArtifactStagingDirectory)/evm_llvm-llc-$(Build.SourceVersion).zip \ + > $(Build.ArtifactStagingDirectory)/evm_llvm-llc-$(Build.SourceVersion).zip.sha256 displayName: 'Finalize artifacts' - task: PublishBuildArtifacts@1 \ No newline at end of file From 6ab18b049a956c2bf9a25a305de62521db989632 Mon Sep 17 00:00:00 2001 From: meows Date: Wed, 13 May 2020 09:43:14 -0500 Subject: [PATCH 15/17] cat sha256 value for provenance reference This allows a consumer to cross reference the checksum between logs and artifacts. Signed-off-by: meows --- .github/workflows/ci.yml | 1 + azure-pipelines.yml | 1 + 2 files changed, 2 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c45b4838b8c32..d45fac9b286c3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -23,6 +23,7 @@ jobs: run: | zip -j evm-llvm-llc-$GITHUB_SHA.zip build/bin/llc shasum -a 256 evm-llvm-llc-$GITHUB_SHA.zip > evm-llvm-llc-$GITHUB_SHA.zip.sha256 + cat evm-llvm-llc-$GITHUB_SHA.zip.sha256 - name: Upload uses: actions/upload-artifact@v2 with: diff --git a/azure-pipelines.yml b/azure-pipelines.yml index a0e8003efdcca..9bdcfa5f5ad1d 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -29,5 +29,6 @@ steps: - script: | shasum -a 256 $(Build.ArtifactStagingDirectory)/evm_llvm-llc-$(Build.SourceVersion).zip \ > $(Build.ArtifactStagingDirectory)/evm_llvm-llc-$(Build.SourceVersion).zip.sha256 + cat $(Build.ArtifactStagingDirectory)/evm_llvm-llc-$(Build.SourceVersion).zip.sha256 displayName: 'Finalize artifacts' - task: PublishBuildArtifacts@1 \ No newline at end of file From 05c0aca8ec661e030ca1541b7336bb58a8cce939 Mon Sep 17 00:00:00 2001 From: meows Date: Wed, 13 May 2020 10:03:30 -0500 Subject: [PATCH 16/17] builds only on EVM branch or any tag Signed-off-by: meows --- .github/workflows/ci.yml | 5 ++++- azure-pipelines.yml | 1 - 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d45fac9b286c3..93c3cf58546ed 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,7 +2,10 @@ name: C/C++ CI on: push: - branches: [ EVM ] + branches: + - EVM + tags: + - '**' jobs: build: diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 9bdcfa5f5ad1d..015297ffcb66f 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -4,7 +4,6 @@ # https://docs.microsoft.com/azure/devops/pipelines/apps/c-cpp/gcc trigger: -- master - EVM - refs/tags/* From d2fc88054fe02643c46aa8dd7ae64fa8c56d62cf Mon Sep 17 00:00:00 2001 From: meows Date: Wed, 13 May 2020 10:04:10 -0500 Subject: [PATCH 17/17] use 'make llc' Simplifies and streamlines make step greatly. Signed-off-by: meows --- .github/workflows/ci.yml | 2 +- azure-pipelines.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 93c3cf58546ed..5b5db8a28168e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,7 +20,7 @@ jobs: run: | mkdir build && cd build cmake -DCMAKE_BUILD_TYPE=Release -DLLVM_TARGETS_TO_BUILD=EVM -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=EVM .. - make -j$(nproc) + make -j$(nproc) llc cd .. - name: Archive run: | diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 015297ffcb66f..886e4cefb3096 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -16,7 +16,7 @@ steps: - script: | mkdir build && cd build cmake -DCMAKE_BUILD_TYPE=Release -DLLVM_TARGETS_TO_BUILD=EVM -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=EVM .. - make -j$(nproc) + make -j$(nproc) llc cd .. displayName: 'Build artifacts' - task: ArchiveFiles@2