Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: consolidation of workflows #331

Closed
wants to merge 13 commits into from
144 changes: 144 additions & 0 deletions .github/workflows/callable-pull-request.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
# Copyright 2024 Defense Unicorns
# SPDX-License-Identifier: AGPL-3.0-or-later OR LicenseRef-Defense-Unicorns-Commercial

name: Callable-Pull-Request

on:
workflow_call:
inputs:
runsOn:
type: string
default: ubuntu-latest
flavors:
type: string
default: "['upstream', 'unicorn', 'registry1']"
types:
type: string
default: "['install', 'upgrade']"
reports-path:
type: string
description: The path to test outputs to upload
reports-name:
type: string
description: The name prefix for upload test reports
default: playwright-report
udsCliVersion:
description: The uds-cli version to install
# renovate: datasource=github-tags depName=defenseunicorns/uds-cli versioning=semver
default: 0.17.0
type: string

# Permissions for the GITHUB_TOKEN used by the workflow.
permissions:
contents: read # Allows reading the content of the repository.

Check failure on line 33 in .github/workflows/callable-pull-request.yaml

View workflow job for this annotation

GitHub Actions / run

33:5 [indentation] wrong indentation: expected 2 but found 4

Check failure on line 33 in .github/workflows/callable-pull-request.yaml

View workflow job for this annotation

GitHub Actions / validate / lint / run

33:5 [indentation] wrong indentation: expected 2 but found 4
packages: read # Allows reading the content of the repository's packages.
id-token: write

jobs:
paths-filter:
runs-on: ubuntu-latest
outputs:
docs: ${{ steps.filter.outputs.changes.docs }}
main: ${{ steps.filter.outputs.changes.main }}
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
docs:
- '**.md'
- '**.jpg'
- '**.png'
- '**.gif'
- '**.svg'
- 'adr/**'
- 'docs/**'
- '.gitignore'
- 'renovate.json'
- '.release-please-config.json'
- 'release-please-config.json'
- 'CODEOWNERS'
- 'LICENSE'
- 'CONTRIBUTING.md'
- 'SECURITY.md'
- 'config/renovate.json5'
main:
- '!**.md'
- '!**.jpg'
- '!**.png'
- '!**.gif'
- '!**.svg'
- '!adr/**'
- '!docs/**'
- '!.gitignore'
- '!renovate.json'
- '!.release-please-config.json'
- '!release-please-config.json'
- '!CODEOWNERS'
- '!LICENSE'
- '!CONTRIBUTING.md'
- '!SECURITY.md'
- '!config/renovate.json5'

check-flavor:
needs: paths-filter
if: needs.paths-filter.outputs.main == 'true'
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1

- name: test-flavor
uses: ./.github/actions/test-flavor
id: test-flavor
outputs:
upgrade-flavors: ${{ steps.test-flavor.outputs.upgrade-flavors }}

test:
needs:

Check failure on line 99 in .github/workflows/callable-pull-request.yaml

View workflow job for this annotation

GitHub Actions / run

99:11 [trailing-spaces] trailing spaces

Check failure on line 99 in .github/workflows/callable-pull-request.yaml

View workflow job for this annotation

GitHub Actions / validate / lint / run

99:11 [trailing-spaces] trailing spaces
- check-flavor
- paths-filter
if: needs.paths-filter.outputs.main == 'true'
strategy:
fail-fast: true
matrix:
types: ${{ fromJson(inputs.types) }}
flavors: ${{ fromJson(inputs.flavors) }}
uses: ./.github/workflows/callable-test.yaml
with:
upgrade-flavors: ${{ needs.check-flavor.outputs.upgrade-flavors }}
flavor: ${{ matrix.flavor }}
type: ${{ matrix.type }}
secrets: inherit # Inherits all secrets from the parent workflow.


doc-shim:
needs: paths-filter
runs-on: ubuntu-latest
timeout-minutes: 20
if: needs.paths-filter.outputs.docs == 'true'
strategy:
fail-fast: true
matrix:
type: ${{ fromJson(inputs.types) }}
flavor: ${{ fromJson(inputs.flavors) }}
steps:
- name: Shim for ${{ matrix.type }} ${{ matrix.flavor }}
run: |
echo "Documentation-only change detected; marking ${{ matrix.type }} ${{ matrix.flavor }} as successful."

lint:
permissions:
pull-requests: read
contents: read
uses: ./.github/workflows/callable-lint.yaml
secrets: inherit


commitlint:
permissions:
pull-requests: read
contents: read
uses: ./.github/workflows/callable-commitlint.yaml
secrets: inherit

Check failure on line 144 in .github/workflows/callable-pull-request.yaml

View workflow job for this annotation

GitHub Actions / run

144:21 [new-line-at-end-of-file] no new line character at the end of file

Check failure on line 144 in .github/workflows/callable-pull-request.yaml

View workflow job for this annotation

GitHub Actions / validate / lint / run

144:21 [new-line-at-end-of-file] no new line character at the end of file
41 changes: 0 additions & 41 deletions .github/workflows/ci-docs-shim.yaml

This file was deleted.

23 changes: 23 additions & 0 deletions .github/workflows/pull-request.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Copyright 2024 Defense Unicorns
# SPDX-License-Identifier: AGPL-3.0-or-later OR LicenseRef-Defense-Unicorns-Commercial

name: Pull Request Workflow

on:
pull_request:
branches: [main]
types: [ milestoned, opened, edited, synchronize]

Check failure on line 9 in .github/workflows/pull-request.yaml

View workflow job for this annotation

GitHub Actions / run

9:13 [brackets] too many spaces inside brackets

Check failure on line 9 in .github/workflows/pull-request.yaml

View workflow job for this annotation

GitHub Actions / validate / lint / run

9:13 [brackets] too many spaces inside brackets

# Permissions for the GITHUB_TOKEN used by the workflow.
permissions:
contents: read # Allows reading the content of the repository.
pull-requests: read # Allows reading pull requests

jobs:
validate:
permissions:
contents: read # Allows reading the content of the repository.

Check failure on line 19 in .github/workflows/pull-request.yaml

View workflow job for this annotation

GitHub Actions / run

19:9 [indentation] wrong indentation: expected 6 but found 8

Check failure on line 19 in .github/workflows/pull-request.yaml

View workflow job for this annotation

GitHub Actions / validate / lint / run

19:9 [indentation] wrong indentation: expected 6 but found 8
packages: read # Allows reading the content of the repository's packages.
id-token: write
pull-requests: read # Allows reading pull requests
uses: ./.github/workflows/callable-pull-request.yaml
48 changes: 0 additions & 48 deletions .github/workflows/release.yaml

This file was deleted.

65 changes: 0 additions & 65 deletions .github/workflows/test.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ The repo itself contains:
- [VSCode configuration](config/.vscode) to setup syntax highlighting for different tooling in your IDE.
- [An example](.) UDS Package for Nginx that demonstrates the general structure and acts as a test for the common tasks.

## Task Usage
## Task Usage

Common `tasks` can be included in downstream repositories and executed with `uds run`. You can learn more about the common tasks in this repo on the [tasks README](./tasks/README.md).

Expand Down
Loading