diff options
author | Josh Matthews <josh@joshmatthews.net> | 2020-11-27 09:05:59 -0500 |
---|---|---|
committer | Josh Matthews <josh@joshmatthews.net> | 2021-02-26 04:20:22 -0500 |
commit | 3ce71cda73c9840d36b99c20aecd190125791ea3 (patch) | |
tree | 66df8410d440b475d0d8a93b2c8810793561c443 /etc | |
parent | a59c5bbb6bca313610743175b2bc76ff25bada41 (diff) | |
download | servo-3ce71cda73c9840d36b99c20aecd190125791ea3.tar.gz servo-3ce71cda73c9840d36b99c20aecd190125791ea3.zip |
Add build github actions workflows for mac/windows/linux.
Diffstat (limited to 'etc')
-rw-r--r-- | etc/ci/generate_workflow.py | 59 | ||||
-rw-r--r-- | etc/ci/workflow.mako | 196 |
2 files changed, 255 insertions, 0 deletions
diff --git a/etc/ci/generate_workflow.py b/etc/ci/generate_workflow.py new file mode 100644 index 00000000000..9abf03e4784 --- /dev/null +++ b/etc/ci/generate_workflow.py @@ -0,0 +1,59 @@ +# Copyright 2021 The Servo Project Developers. See the COPYRIGHT +# file at the top-level directory of this distribution. +# +# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +# option. This file may not be copied, modified, or distributed +# except according to those terms. + +import os.path +import sys + +BASE = os.path.dirname(__file__.replace('\\', '/')) +sys.path.insert(0, os.path.join( + BASE, "..", "..", "components", "style", "properties", "Mako-1.1.2-py2.py3-none-any.whl" +)) + +from mako import exceptions # noqa +from mako.lookup import TemplateLookup # noqa +from mako.template import Template # noqa + + +def abort(message): + print(message, file=sys.stderr) + sys.exit(1) + + +def render(filename, **context): + try: + lookup = TemplateLookup(directories=[BASE], + input_encoding="utf8", + strict_undefined=True) + template = Template(open(os.path.join(BASE, filename), "rb").read(), + filename=filename, + input_encoding="utf8", + lookup=lookup, + strict_undefined=True) + # Uncomment to debug generated Python code: + # write("/tmp", "mako_%s.py" % os.path.basename(filename), template.code) + return template.render(**context) + except Exception: + # Uncomment to see a traceback in generated Python code: + # raise + abort(exceptions.text_error_template().render()) + + +def main(): + with open(os.path.join(".github", "workflows", "main.yml"), 'w') as f: + f.write(render( + 'workflow.mako', + total_chunks=20, + GITHUB_REPOSITORY="${{ github.repository }}", + GITHUB_REF="${{ github.ref }}", + GITHUB_SHA="${{ github.sha }}", + )) + + +if __name__ == "__main__": + main() diff --git a/etc/ci/workflow.mako b/etc/ci/workflow.mako new file mode 100644 index 00000000000..bd8f4c3bf45 --- /dev/null +++ b/etc/ci/workflow.mako @@ -0,0 +1,196 @@ +name: CI + +on: + # Triggers the workflow on push or pull request events but only for the master branch + push: + branches: [ "master", "github-actions-dev", "auto", "try", "try-linux", "try-mac" ] + pull_request: + branches: [ "master", "github-actions-dev" ] + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +env: + RUST_BACKTRACE: 1 + SHELL: /bin/bash + +jobs: + build-win: + name: Build (Windows) + runs-on: windows-2019 + steps: + - name: Clone + run: | + mkdir c:/Repo + git clone https://github.com/${ GITHUB_REPOSITORY } --depth 2 c:/Repo + cd c:/Repo + git fetch origin ${ GITHUB_REF } + git checkout ${ GITHUB_SHA } + - name: Bootstrap + working-directory: c:/Repo + run: | + python -m pip install --upgrade pip virtualenv + python mach fetch + - name: Release build + working-directory: c:/Repo + run: python mach build --release --media-stack=dummy + - name: Unit tests + working-directory: c:/Repo + run: python mach test-unit --release + - name: Smoketest + working-directory: c:/Repo + run: python mach smoketest --angle + + build-mac: + name: Build (macOS) + runs-on: macos-10.15 + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 2 + - name: Bootstrap + run: | + python3 -m pip install --upgrade pip virtualenv + brew bundle install --verbose --no-upgrade --file=etc/taskcluster/macos/Brewfile + brew bundle install --verbose --no-upgrade --file=etc/taskcluster/macos/Brewfile-build + rm -rf /usr/local/etc/openssl + rm -rf /usr/local/etc/openssl@1.1 + brew install openssl@1.1 gnu-tar + - name: Release build + run: | + export OPENSSL_INCLUDE_DIR="$(brew --prefix openssl)/include" + export OPENSSL_LIB_DIR="$(brew --prefix openssl)/lib" + export PKG_CONFIG_PATH="$(brew --prefix libffi)/lib/pkgconfig/" + export PKG_CONFIG_PATH="$(brew --prefix zlib)/lib/pkgconfig/:$PKG_CONFIG_PATH" + python3 ./mach build --release + - name: Smoketest + run: python3 ./mach smoketest + - name: Package binary + run: gtar -czf target.tar.gz target/release/servo target/release/*.dylib resources + - name: Archive binary + uses: actions/upload-artifact@v2 + with: + name: release-binary-macos + path: target.tar.gz + +% for chunk in range(1, total_chunks + 1): + # mac-wpt${chunk}: + # #needs: build-mac + # runs-on: macos-10.15 + # steps: + # - uses: actions/checkout@v2 + # with: + # fetch-depth: 2 + + # #- name: Download release binary + # # uses: actions/download-artifact@v2 + # # with: + # # name: release-binary-macos + + # - name: Fake build + # run: | + # wget https://joshmatthews.net/release-binary-macos.zip + # unzip release-binary-macos.zip + + # - name: Prep test environment + # run: | + # brew install gnu-tar + # gtar -xzf target.tar.gz + # python3 -m pip install --upgrade pip virtualenv + # brew bundle install --verbose --no-upgrade --file=etc/taskcluster/macos/Brewfile + # - name: Smoketest + # run: python3 ./mach smoketest + # - name: Run tests + # run: | + # python3 ./mach test-wpt --release --processes=3 --timeout-multiplier=8 --total-chunks=${total_chunks} --this-chunk=${chunk} --log-raw=test-wpt.log --log-servojson=wpt-jsonsummary.log --always-succeed | cat + # python3 ./mach filter-intermittents wpt-jsonsummary.log --log-intermittents=intermittents.log --log-filteredsummary=filtered-wpt-summary.log --tracker-api=default --reporter-api=default + + # - name: Archive logs + # uses: actions/upload-artifact@v2 + # with: + # name: wpt${chunk}-logs-macos + # path: | + # test-wpt.log + # wpt-jsonsummary.log + # filtered-wpt-summary.log + # intermittents.log +% endfor + + build-linux: + name: Build (Linux) + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 2 + - name: Bootstrap + run: | + python3 -m pip install --upgrade pip virtualenv + sudo apt update + python3 ./mach bootstrap + - name: Release build + run: python3 ./mach build --release + - name: Package binary + run: tar -czf target.tar.gz target/release/servo resources + - name: Archive binary + uses: actions/upload-artifact@v2 + with: + name: release-binary + path: target.tar.gz + +% for chunk in range(1, total_chunks + 1): + # linux-wpt${chunk}: + # #needs: build-linux + # runs-on: ubuntu-20.04 + # steps: + # - uses: actions/checkout@v2 + # with: + # fetch-depth: 2 + + # #- name: Download release binary + # # uses: actions/download-artifact@v2 + # # with: + # # name: release-binary + + # - name: Fake build + # run: | + # wget https://joshmatthews.net/release-binary.zip + # unzip release-binary.zip + + # - name: Prep test environment + # run: | + # tar -xzf target.tar.gz + # python3 -m pip install --upgrade pip virtualenv + # sudo apt update + # sudo apt install -qy --no-install-recommends libgl1 libssl1.1 libdbus-1-3 libxcb-xfixes0-dev libxcb-shape0-dev libunwind8 libegl1-mesa + # wget http://mirrors.kernel.org/ubuntu/pool/main/libf/libffi/libffi6_3.2.1-8_amd64.deb + # sudo apt install ./libffi6_3.2.1-8_amd64.deb + # python3 ./mach bootstrap-gstreamer + + # - name: Run tests + # run: | + # python3 ./mach test-wpt --release --processes=2 --total-chunks=${total_chunks} --this-chunk=${chunk} --log-raw=test-wpt.log --log-servojson=wpt-jsonsummary.log --always-succeed | cat + # python3 ./mach filter-intermittents wpt-jsonsummary.log --log-intermittents=intermittents.log --log-filteredsummary=filtered-wpt-summary.log --tracker-api=default --reporter-api=default + + # - name: Archive logs + # uses: actions/upload-artifact@v2 + # with: + # name: wpt${chunk}-logs-linux + # path: | + # test-wpt.log + # wpt-jsonsummary.log + # filtered-wpt-summary.log + # intermittents.log +% endfor + + build_result: + name: homu build finished + runs-on: ubuntu-latest + needs: ["build-win", "build-mac", "build-linux"] + steps: + - name: Mark the job as successful + run: exit 0 + if: success() + - name: Mark the job as unsuccessful + run: exit 1 + if: "!success()" |