servo/.github/workflows/linux.yml
Martin Robinson fed3491f23
Combine all try workflows (#30096)
There are currently two ways to run try. One is to push to the `try` or
`try-*` branches and the other is to trigger a workflow via GitHub
comment. This change combines these methods into one workflow. In
addition, WPT results are reported together rather than separately and
filtered results for all WPT tests are bundled together in the same
artifact.
2023-08-20 09:43:02 +00:00

157 lines
4.5 KiB
YAML

name: Linux
on:
workflow_call:
inputs:
wpt:
required: false
type: string
wpt-layout:
required: false
type: string
unit-tests:
required: false
default: false
type: boolean
upload:
required: false
default: false
type: boolean
github-release-id:
required: false
type: string
workflow_dispatch:
inputs:
wpt:
default: "test"
required: false
type: choice
options: ["test", "sync"]
wpt-layout:
required: false
type: choice
options: ["none", "2013", "2020", "all"]
unit-tests:
required: false
default: false
type: boolean
upload:
required: false
default: false
type: boolean
env:
RUST_BACKTRACE: 1
SHELL: /bin/bash
SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: "sccache"
CCACHE: "sccache"
CARGO_INCREMENTAL: 0
jobs:
build:
name: Build
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
if: github.event_name != 'issue_comment'
with:
fetch-depth: 2
# This is necessary to checkout the pull request if this run was triggered
# via an `issue_comment` action on a pull request.
- uses: actions/checkout@v3
if: github.event_name == 'issue_comment'
with:
ref: refs/pull/${{ github.event.issue.number }}/head
fetch-depth: 2
- name: Run sccache-cache
uses: mozilla-actions/sccache-action@v0.0.3
- name: Select Python 3.9
uses: actions/setup-python@v4
with:
python-version: '3.9'
- name: Bootstrap Python
run: python3 -m pip install --upgrade pip virtualenv
- name: Bootstrap dependencies
run: sudo apt update && python3 ./mach bootstrap
- name: Tidy
run: python3 ./mach test-tidy --no-progress --all
- name: Release build
run: python3 ./mach build --release
- name: Smoketest
run: xvfb-run python3 ./mach smoketest --release
- name: Script tests
run: ./mach test-scripts
- name: Unit tests
if: ${{ inputs.unit-tests }}
run: python3 ./mach test-unit --release
- name: Rename build timing
run: cp -r target/cargo-timings target/cargo-timings-linux
- name: Archive build timing
uses: actions/upload-artifact@v3
with:
name: cargo-timings
# Using a wildcard here ensures that the archive includes the path.
path: target/cargo-timings-*
- name: Lockfile check
run: ./etc/ci/lockfile_changed.sh
- name: Package
run: python3 ./mach package --release
- name: Upload Package
uses: actions/upload-artifact@v3
with:
name: linux
path: target/release/servo-tech-demo.tar.gz
- name: Upload
if: ${{ inputs.upload }}
run: |
python3 ./mach upload-nightly linux \
--secret-from-environment \
--github-release-id ${{ inputs.github-release-id }}
env:
S3_UPLOAD_CREDENTIALS: ${{ secrets.S3_UPLOAD_CREDENTIALS }}
NIGHTLY_REPO_TOKEN: ${{ secrets.NIGHTLY_REPO_TOKEN }}
NIGHTLY_REPO: ${{ github.repository_owner }}/servo-nightly-builds
- name: Package binary
run: tar -czf target.tar.gz target/release/servo resources
- name: Archive binary
uses: actions/upload-artifact@v3
with:
name: release-binary
path: target.tar.gz
wpt-2020:
if: ${{ inputs.wpt-layout == '2020' || inputs.wpt-layout == 'all' }}
name: Linux WPT Tests 2020
needs: ["build"]
uses: ./.github/workflows/linux-wpt.yml
with:
wpt: ${{ inputs.wpt }}
layout: "layout-2020"
wpt-2013:
if: ${{ inputs.wpt-layout == '2013' || inputs.wpt-layout == 'all' }}
name: Linux WPT Tests 2013
needs: ["build"]
uses: ./.github/workflows/linux-wpt.yml
with:
wpt: ${{ inputs.wpt }}
layout: "layout-2013"
result:
name: Result
runs-on: ubuntu-latest
if: always()
# needs all build to detect cancellation
needs:
- "build"
- "wpt-2020"
- "wpt-2013"
steps:
- name: Mark the job as successful
run: exit 0
if: ${{ !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') }}
- name: Mark the job as unsuccessful
run: exit 1
if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')