81 lines
2.4 KiB
YAML
81 lines
2.4 KiB
YAML
|
# Copyright 2022 Google LLC
|
||
|
#
|
||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||
|
# you may not use this file except in compliance with the License.
|
||
|
# You may obtain a copy of the License at
|
||
|
#
|
||
|
# https://www.apache.org/licenses/LICENSE-2.0
|
||
|
#
|
||
|
# Unless required by applicable law or agreed to in writing, software
|
||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
|
# See the License for the specific language governing permissions and
|
||
|
# limitations under the License.
|
||
|
|
||
|
# A workflow to test building in various Linux distros.
|
||
|
name: Test Linux Distros
|
||
|
|
||
|
# Runs when called from another workflow.
|
||
|
on:
|
||
|
workflow_call:
|
||
|
inputs:
|
||
|
ref:
|
||
|
required: true
|
||
|
type: string
|
||
|
|
||
|
# By default, run all commands in a bash shell. On Windows, the default would
|
||
|
# otherwise be powershell.
|
||
|
defaults:
|
||
|
run:
|
||
|
shell: bash
|
||
|
|
||
|
jobs:
|
||
|
# Configure the build matrix based on files in the repo.
|
||
|
matrix_config:
|
||
|
name: Matrix config
|
||
|
runs-on: ubuntu-latest
|
||
|
outputs:
|
||
|
MATRIX: ${{ steps.configure.outputs.MATRIX }}
|
||
|
steps:
|
||
|
- uses: actions/checkout@v2
|
||
|
with:
|
||
|
ref: ${{ inputs.ref }}
|
||
|
|
||
|
- name: Configure Build Matrix
|
||
|
id: configure
|
||
|
shell: node {0}
|
||
|
run: |
|
||
|
const fs = require('fs');
|
||
|
const files = fs.readdirSync('packager/testing/dockers/');
|
||
|
const matrix = files.map((file) => {
|
||
|
return { os_name: file.replace('_Dockerfile', '') };
|
||
|
});
|
||
|
|
||
|
// Output a JSON object consumed by the build matrix below.
|
||
|
console.log(`::set-output name=MATRIX::${ JSON.stringify(matrix) }`);
|
||
|
|
||
|
// Log the outputs, for the sake of debugging this script.
|
||
|
console.log({matrix});
|
||
|
|
||
|
# Build each dockerfile in parallel in a different CI job.
|
||
|
build:
|
||
|
needs: matrix_config
|
||
|
strategy:
|
||
|
# Let other matrix entries complete, so we have all results on failure
|
||
|
# instead of just the first failure.
|
||
|
fail-fast: false
|
||
|
matrix:
|
||
|
include: ${{ fromJSON(needs.matrix_config.outputs.MATRIX) }}
|
||
|
|
||
|
name: ${{ matrix.os_name }}
|
||
|
runs-on: ubuntu-latest
|
||
|
|
||
|
steps:
|
||
|
- uses: actions/checkout@v2
|
||
|
with:
|
||
|
ref: ${{ inputs.ref }}
|
||
|
submodules: true
|
||
|
|
||
|
- name: Build in Docker
|
||
|
run: ./packager/testing/test_dockers.sh "${{ matrix.os_name }}"
|