diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml new file mode 100644 index 00000000000..63d86acb633 --- /dev/null +++ b/.github/workflows/cmake.yml @@ -0,0 +1,105 @@ +# Workflow to build Dawn using CMake +name: CMake + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + build: + runs-on: ${{ matrix.os }} + + strategy: + # Set fail-fast to false to ensure that feedback is delivered for all matrix combinations. Consider changing this to true when your workflow is stable. + fail-fast: false + + # Set up a matrix to run the following 3 configurations: + # 1. + # 2. + # 3. + # + # To add more build types (Release, Debug, RelWithDebInfo, etc.) customize the build_type list. + matrix: + os: [ubuntu-latest, windows-latest, macos-latest] + build_type: [Debug, Release] + c_compiler: [clang, cl] + include: + - os: windows-latest + c_compiler: cl + cpp_compiler: cl + - os: ubuntu-latest + c_compiler: clang + cpp_compiler: clang++ + - os: macos-latest + c_compiler: clang + cpp_compiler: clang++ + exclude: + - os: windows-latest + c_compiler: clang + - os: windows-latest + c_compiler: cl + build_type: Debug + - os: ubuntu-latest + c_compiler: cl + - os: macos-latest + c_compiler: cl + + steps: + - uses: actions/checkout@v3 + + - name: Set reusable strings + # Turn repeated input strings (such as the build output directory) into step outputs. These step outputs can be used throughout the workflow file. + id: strings + shell: bash + run: | + echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT" + + - name: Install Ubuntu build dependencies + if: matrix.os == 'ubuntu-latest' + run: | + sudo apt update + sudo apt install libgl-dev libx11-xcb-dev libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev libxext-dev wayland-protocols libwayland-dev libxkbcommon-dev + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: 3.11 + + - name: Fetch dependencies + run: python ./tools/fetch_dawn_dependencies.py --use-test-deps --shallow + + - name: Set up Ninja + uses: seanmiddleditch/gha-setup-ninja@master + + - name: Set up Visual Studio environment + if: matrix.os == 'windows-latest' + uses: seanmiddleditch/gha-setup-vsdevenv@master + + - name: Set up sccache + uses: mozilla-actions/sccache-action@v0.0.3 + + - name: Configure CMake + # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make. + # See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type + run: > + cmake -G Ninja -B ${{ steps.strings.outputs.build-output-dir }} + -DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }} + -DCMAKE_C_COMPILER=${{ matrix.c_compiler }} + -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} + -DCMAKE_C_COMPILER_LAUNCHER=sccache + -DCMAKE_CXX_COMPILER_LAUNCHER=sccache + -S ${{ github.workspace }} + env: + SCCACHE_GHA_ENABLED: "true" + + - name: Build + # Build your program with the given configuration. Note that --config is needed because the default Windows generator is a multi-config generator (Visual Studio generator). + run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }} + env: + SCCACHE_GHA_ENABLED: "true" diff --git a/.github/workflows/gn.yml b/.github/workflows/gn.yml new file mode 100644 index 00000000000..cc0fbf1c8e6 --- /dev/null +++ b/.github/workflows/gn.yml @@ -0,0 +1,69 @@ +# Workflow to build Dawn using GN +name: GN + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + build: + runs-on: ${{ matrix.os }} + + strategy: + # Set fail-fast to false to ensure that feedback is delivered for all matrix combinations. Consider changing this to true when your workflow is stable. + fail-fast: false + + matrix: + os: [ubuntu-latest, windows-latest, macos-latest] + + steps: + - name: Install Ubuntu build dependencies + if: matrix.os == 'ubuntu-latest' + run: | + sudo apt update + sudo apt install libgl-dev libx11-xcb-dev libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev libxext-dev wayland-protocols libwayland-dev libxkbcommon-dev + + - name: Install depot_tools + uses: newkdev/setup-depot-tools@v1.0.1 + + - uses: actions/checkout@v3 + + - name: Set up checkout + run: | + cp ./scripts/standalone.gclient .gclient + + - name: gclient sync --no-history --shallow + run: gclient sync --no-history --shallow + env: + DEPOT_TOOLS_WIN_TOOLCHAIN: 0 + + - name: Set up sccache + uses: mozilla-actions/sccache-action@v0.0.3 + + - name: Generate build files + shell: bash + run: | + mkdir -p out/build + cat << EOF >> out/build/args.gn + cc_wrapper="sccache" + is_debug=false + is_component_build=true + is_clang=true + EOF + gn gen out/build + + env: + SCCACHE_GHA_ENABLED: "true" + DEPOT_TOOLS_WIN_TOOLCHAIN: 0 + + - name: Build + run: autoninja -C out/build + env: + SCCACHE_GHA_ENABLED: "true" + DEPOT_TOOLS_WIN_TOOLCHAIN: 0 diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml new file mode 100644 index 00000000000..bb098260576 --- /dev/null +++ b/.github/workflows/go.yml @@ -0,0 +1,28 @@ +# This workflow will build a golang project +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go + +name: Go + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +jobs: + + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Set up Go + uses: actions/setup-go@v4 + with: + go-version: '1.18' + + - name: Build + run: go build -v ./... + + - name: Test + run: go test -v ./...