Skip to content

Commit

Permalink
actions: try composite actions
Browse files Browse the repository at this point in the history
  • Loading branch information
pragmatrix committed Aug 8, 2020
1 parent 950e964 commit 29196ef
Show file tree
Hide file tree
Showing 3 changed files with 125 additions and 49 deletions.
73 changes: 73 additions & 0 deletions .github/workflows/build-host.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
inputs:
# TODO: do we need that, runner.os should be sufficient.
host-os:
description: 'The operating system of the host'
required: true

host-target:
description: 'The target of the host'
required: true

rust-edition:
description: 'The edition of rust to build with, like "stable" or "beta"'
required: true

features:
description: 'The feature set to build all targets with.'
required: true

runs:
using: 'composite'
# TODO: we could use actions here that set up
# the OS based on runner.os
steps:
- name: Install Rust
uses: hecrj/setup-rust-action@master
with:
rust-version: ${{ matrix.rust }}

- name: Install Clippy
run: |
rustup component add clippy
shell: bash

- uses: actions/checkout@v2
with:
# depth 1 is default
submodules: true

# remove LLVM on macOS so that only Apple's clang is used
- name: Remove LLVM (macOS)
run: |
brew uninstall llvm
if: runner.os == 'macOS'

- name: LLVM (Windows only)
run: |
choco install llvm
if: runner.os == 'Windows'

- name: Setup Python 2 (Windows only)
uses: actions/setup-python@v2
with:
python-version: '2.7.18'
architecture: 'x64'
if: runner.os == 'Windows'

- name: Python Version (Windows only)
run: |
python --version
if: runner.os == 'Windows'

- name: Build Host Target
uses: ./.github/actions/build-target
with:
target: '${{ inputs.host-target }}'
features: '${{ inputs.features }}'
runBinaries: true



# - name: Run Clippy
# run: cargo clippy -vv --release --workspace
# shell: bash
27 changes: 27 additions & 0 deletions .github/workflows/build-target.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
inputs:
target:
description: 'The target to build.'
required: true

features:
description: 'The features to build.'
required: true

runBinaries:
description: 'Run test cases and examples?'
default: false
required: false

runs:
using: 'composite'
steps:
- name: 'Add Rust target ${{ inputs.target }}'
run: |
rustup target add ${{ inputs.target }}
shell: bash

- name: 'Build all targets in skia-safe for ${{ inputs.target }} with features "${{ inputs.features }}"'
run: |
cargo clean
(cd skia-safe && cargo build --release --features "${{ inputs.features }}" --all-targets --target ${{ inputs.target }} -vv)
shell: bash
74 changes: 25 additions & 49 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,62 +8,38 @@ jobs:
strategy:
matrix:
os: [windows-2019, macOS-10.15, ubuntu-20.04]
rust: [stable, beta]
edition: [stable, beta]
fail-fast: false
include:
- os: 'windows-2019'
host-target: 'x86_64-pc-windows-msvc'
host-os: 'Windows'
features: 'gl,vulkan,textlayout'

include:
- os: 'macOS-10.15'
host-target: 'x86_64-apple-darwin'
host-os: 'macOS'
features: 'gl,vulkan,textlayout,metal'

include:
- os: 'ubuntu-20.04'
host-target: 'x86_64-unknown-linux-gnu'
host-os: 'Linux'
features: 'gl,vulkan,textlayout'

steps:
- name: Install Rust
uses: hecrj/setup-rust-action@master
- name: 'Build on ${{ matrix.host-os }} Host with Host Target ${{ matrix.host-target }}'
uses: ./.github/workflows/build-host
with:
rust-version: ${{ matrix.rust }}

- name: Install Clippy
run: |
rustup component add clippy
shell: bash

- uses: actions/checkout@v2
with:
submodules: true

# remove LLVM on macOS so that only Apple's clang is used
- name: Remove LLVM (macOS)
run: |
brew uninstall llvm
if: runner.os == 'macOS'

- name: LLVM (Windows only)
run: |
choco install llvm
if: runner.os == 'Windows'

- name: Setup Python 2 (Windows only)
uses: actions/setup-python@v2
with:
python-version: '2.7.18'
architecture: 'x64'
if: runner.os == 'Windows'

- name: Python Version (Windows only)
run: |
python --version
if: runner.os == 'Windows'

- name: Build
run: cargo build -vv --release
shell: bash

# - name: Run Clippy
# run: cargo clippy -vv --release --workspace
# shell: bash

- name: Run Tests
run: cargo test -vv --release --workspace -- --test-threads 1
shell: bash
host-os: ${{ matrix.host-os }}
rust-edition: ${{ matrix.edition }}
host-target: ${{ matrix.host-target }}
features: ${{ matrix.features }}

rustfmt:
name: Check Rust Formatting
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v1
with:
Expand Down

0 comments on commit 29196ef

Please sign in to comment.