Skip to content

Create Github Actions workflows #28

Create Github Actions workflows

Create Github Actions workflows #28

Workflow file for this run

# 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/[email protected]
- 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=out/build" >> "$GITHUB_OUTPUT"
echo "build-key=${{ runner.os }}-${{github.workflow}}" >> "$GITHUB_OUTPUT"
# Only download workspace artifacts on pull requests. CI builds should start from a fresh state.
- name: Download workspace artifacts
uses: dawidd6/action-download-artifact@v2
if: ${{ github.event_name == 'pull_request' }}
with:
workflow: ${{ github.workflow }}
workflow_conclusion: success
name: workspace-${{ steps.strings.outputs.build-key }}
search_artifacts: true
path: ${{ github.workspace }}/${{ steps.strings.outputs.build-output-dir }}
continue-on-error: true
- 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/[email protected]
- name: Generate build files
shell: bash
run: |
mkdir -p ${{ steps.strings.outputs.build-output-dir }}
cat << EOF >> ${{ steps.strings.outputs.build-output-dir }}/args.gn
cc_wrapper="sccache"
is_debug=false
is_component_build=true
is_clang=true
EOF
gn gen ${{ steps.strings.outputs.build-output-dir }}
env:
SCCACHE_GHA_ENABLED: "true"
DEPOT_TOOLS_WIN_TOOLCHAIN: 0
- name: Build
run: autoninja -C ${{ steps.strings.outputs.build-output-dir }}
env:
SCCACHE_GHA_ENABLED: "true"
DEPOT_TOOLS_WIN_TOOLCHAIN: 0
# Always upload workspace artifacts. Eventually only do this for pushes to main.
- name: Upload workspace artifacts
uses: actions/upload-artifact@v3
with:
name: workspace-${{ steps.strings.outputs.build-key }}
path: ${{ github.workspace }}/${{ steps.strings.outputs.build-output-dir }}
retention-days: 7