actions: update generation script to use matrix

This commit is contained in:
David Bauer 2021-01-01 23:21:52 +01:00
parent 7709de6753
commit 441fbf1283

View File

@ -16,34 +16,36 @@ on:
pull_request: pull_request:
types: [opened, synchronize, reopened] types: [opened, synchronize, reopened]
jobs: jobs:
""" build_firmware:
strategy:
ACTIONS_TARGET=""" fail-fast: false
{target_name}: matrix:
name: {target_name} target: [{matrix}]
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v1 - uses: actions/checkout@v1
- name: Install Dependencies - name: Install Dependencies
run: sudo contrib/actions/install-dependencies.sh run: sudo contrib/actions/install-dependencies.sh
- name: Build - name: Build
run: contrib/actions/run-build.sh {target_name} run: contrib/actions/run-build.sh ${{{{ matrix.target }}}}
- name: Archive build logs - name: Archive build logs
if: ${{{{ !cancelled() }}}} if: ${{{{ !cancelled() }}}}
uses: actions/upload-artifact@v1 uses: actions/upload-artifact@v1
with: with:
name: {target_name}_logs name: ${{{{ matrix.target }}}}_logs
path: openwrt/logs path: openwrt/logs
- name: Archive build output - name: Archive build output
uses: actions/upload-artifact@v1 uses: actions/upload-artifact@v1
with: with:
name: {target_name}_output name: ${{{{ matrix.target }}}}_output
path: output path: output
""" """
output = ACTIONS_HEAD targets = []
for target in sys.stdin: for target in sys.stdin:
output += ACTIONS_TARGET.format(target_name=target.strip()) targets.append(target.strip())
output = ACTIONS_HEAD.format(matrix=", ".join(targets))
print(output) print(output)