diff --git a/Meta/Azure/Caches.yml b/Meta/Azure/Caches.yml index cd0a17ba4c0..d96aa4361aa 100644 --- a/Meta/Azure/Caches.yml +++ b/Meta/Azure/Caches.yml @@ -6,6 +6,20 @@ parameters: ccache_version: 1 # Increment this number if CI has trouble with ccache. steps: + - ${{ if ne(parameters.arch, 'Lagom') }}: + - ${{ if eq(parameters.toolchain, 'gcc') }}: + - task: Cache@2 + inputs: + key: '"toolchain" | "${{ parameters.arch }}" | Toolchain/BuildClang.sh | Userland/Libraries/LibC/**/*.h | Userland/Libraries/LibPthread/**/*.h' + path: $(Build.SourcesDirectory)/Toolchain/Cache + displayName: 'Toolchain Cache' + - ${{ if eq(parameters.toolchain, 'clang') }}: + - task: Cache@2 + inputs: + key: '"toolchain" | "${{ parameters.arch }}" | Toolchain/BuildIt.sh | Userland/Libraries/LibC/**/*.h | Userland/Libraries/LibPthread/**/*.h' + path: $(Build.SourcesDirectory)/Toolchain/Cache + displayName: 'Toolchain Cache' + - task: Cache@2 inputs: key: '"ccache" | "${{ parameters.os }}" | "${{ parameters.arch }}" | "${{ parameters.toolchain }}" | "${{ parameters.ccache_version }}"' diff --git a/Meta/Azure/Serenity.yml b/Meta/Azure/Serenity.yml new file mode 100644 index 00000000000..eabb7dab008 --- /dev/null +++ b/Meta/Azure/Serenity.yml @@ -0,0 +1,89 @@ +parameters: + arch: 'i686' + +jobs: + - job: 'Serenity_Clang_${{ parameters.arch }}' + timeoutInMinutes: 0 # Setting to 0 means the maximum allowed timeout is used. + + variables: + - name: CCACHE_DIR + value: $(Build.SourcesDirectory)/.ccache + + pool: + vmImage: ubuntu-20.04 + + steps: + - template: Setup.yml + parameters: + os: 'Serenity' + + - template: Caches.yml + parameters: + arch: '${{ parameters.arch }}' + toolchain: 'clang' + build_directory: 'Build' + + - script: ./Toolchain/BuildClang.sh + displayName: Build Toolchain + env: + TRY_USE_LOCAL_TOOLCHAIN: 'y' + ARCH: '${{ parameters.arch }}' + + - script: | + mkdir -p Build + displayName: 'Create Build Directory' + + - script: | + cmake -GNinja \ + -DSERENITY_ARCH=${{ parameters.arch }} \ + -DUSE_CLANG_TOOLCHAIN=ON \ + -DENABLE_UNDEFINED_SANITIZER=ON \ + -DENABLE_PCI_IDS_DOWNLOAD=OFF \ + -DENABLE_USB_IDS_DOWNLOAD=OFF \ + -DCMAKE_C_COMPILER=gcc-10 \ + -DCMAKE_CXX_COMPILER=g++-10 \ + .. + displayName: 'Create Build Environment' + workingDirectory: $(Build.SourcesDirectory)/Build + + - script: | + cmake --build . + displayName: 'Build' + workingDirectory: $(Build.SourcesDirectory)/Build + + - script: | + ninja install && ninja image + displayName: 'Create RootFS' + workingDirectory: $(Build.SourcesDirectory)/Build + + - script: | + ninja run + + echo "##[group]Verify Output File" + mkdir fsmount + sudo mount -t ext2 -o loop,rw _disk_image fsmount + + echo "Results: " + sudo cat fsmount/home/anon/test-results.log + echo "##[endgroup]" + + if ! sudo grep -q "Failed: 0" fsmount/home/anon/test-results.log + then + echo "##[error]:^( Tests failed, failing job" + exit 1 + fi + displayName: 'Test' + workingDirectory: $(Build.SourcesDirectory)/Build + env: + SERENITY_QEMU_CPU: 'max,vmx=off' + SERENITY_KERNEL_CMDLINE: 'boot_mode=self-test' + SERENITY_RUN: 'ci' + + - script: | + [ ! -e debug.log ] || cat debug.log + displayName: 'Print Target Logs' + workingDirectory: $(Build.SourcesDirectory)/Build + + - script: | + ccache -s + displayName: 'Cache Stats' diff --git a/Meta/Azure/Setup.yml b/Meta/Azure/Setup.yml index 6e8d9858bc2..4e611275706 100644 --- a/Meta/Azure/Setup.yml +++ b/Meta/Azure/Setup.yml @@ -5,6 +5,13 @@ steps: - checkout: self persistCredentials: true + - ${{ if eq(parameters.os, 'Serenity') }}: + - script: | + sudo add-apt-repository ppa:canonical-server/server-backports + sudo apt-get update + sudo apt-get install libmpfr-dev libmpc-dev ninja-build e2fsprogs qemu-utils qemu-system-i386 ccache + displayName: 'Install Dependencies' + - ${{ if eq(parameters.os, 'Linux') }}: - script: | sudo apt-get purge -y clang-11 diff --git a/azure-pipelines.yml b/azure-pipelines.yml index bfc2d7b4fa4..9b83a69ffad 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -10,3 +10,11 @@ jobs: parameters: os: 'macOS' allow_test_failures: true + + - template: Meta/Azure/Serenity.yml + parameters: + arch: 'i686' + + - template: Meta/Azure/Serenity.yml + parameters: + arch: 'x86_64'