-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CI: fix checks when packages not modified
The "app-lint" check has been replaced with "pr-check", which also includes checking site generation when appropriate.
- Loading branch information
1 parent
e7d9152
commit 8cc58ed
Showing
5 changed files
with
108 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,53 +1,50 @@ | ||
name: 'Package: Lint' | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
paths: | ||
- 'packages/**' | ||
workflow_call: | ||
inputs: | ||
packages: | ||
type: string | ||
required: true | ||
|
||
# Disable all permissions | ||
permissions: {} | ||
|
||
jobs: | ||
app-lint: | ||
package-lint: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
pull-requests: write | ||
actions: read | ||
pull-requests: read | ||
contents: read # Only needed for private repository | ||
issues: read # Only needed for private repository | ||
steps: | ||
- name: Check out repo | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.11' | ||
cache: 'pip' | ||
|
||
- name: Download Homebrew Toolbox | ||
uses: robinraju/[email protected] | ||
with: | ||
repository: "webosbrew/dev-toolbox-cli" | ||
repository: 'webosbrew/dev-toolbox-cli' | ||
latest: true | ||
fileName: "webosbrew-toolbox-*.deb" | ||
out-file-path: "temp" | ||
fileName: 'webosbrew-toolbox-*.deb' | ||
out-file-path: 'temp' | ||
|
||
- name: Install dependencies | ||
run: | | ||
python3 -m pip install -r ./requirements.txt | ||
sudo apt-get install ./temp/webosbrew-toolbox-*.deb | ||
- name: Check changed packages | ||
id: changed_files | ||
uses: dorny/paths-filter@v3 | ||
with: | ||
list-files: shell | ||
filters: | | ||
packages: | ||
- added|modified: 'packages/**' | ||
- name: Lint package information | ||
if: ${{ steps.changed_files.outputs.packages == 'true' }} | ||
run: | | ||
export lint_retcode=0 | ||
for changed_file in ${{ steps.changed_files.outputs.packages_files }}; do | ||
for changed_file in ${{ inputs.packages }}; do | ||
echo "## Check Results for $(basename "${changed_file}"):" >> /tmp/lint-report.md | ||
echo >> /tmp/lint-report.md | ||
|
@@ -76,7 +73,7 @@ jobs: | |
if: ${{ !env.ACT && (success() || failure()) }} | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: lint-results | ||
name: package-lint-results | ||
path: | | ||
/tmp/lint-report.md | ||
/tmp/issue-number.txt | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
name: 'PR Check' | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
filter-paths: | ||
permissions: | ||
pull-requests: read | ||
runs-on: ubuntu-latest | ||
outputs: | ||
need-package: ${{ steps.changed_files.outputs.packages }} | ||
packages-files: ${{ steps.changed_files.outputs.packages_files }} | ||
need-site: ${{ steps.changed_files.outputs.site }} | ||
steps: | ||
- name: Check changed files | ||
id: changed_files | ||
uses: dorny/paths-filter@v3 | ||
with: | ||
list-files: 'escape' | ||
# the 'site' filters won't work with default 'some' | ||
predicate-quantifier: 'every' | ||
filters: | | ||
packages: | ||
- added|modified: 'packages/**' | ||
site: | ||
- '**' | ||
- '!packages/**' | ||
- '!README.md' | ||
package-check: | ||
needs: filter-paths | ||
if: ${{ needs.filter-paths.outputs.need-package == 'true' }} | ||
uses: ./.github/workflows/package-lint.yml | ||
with: | ||
packages: ${{ needs.filter-paths.outputs.packages-files }} | ||
|
||
site-check: | ||
needs: filter-paths | ||
if: ${{ needs.filter-paths.outputs.need-site == 'true' }} | ||
uses: ./.github/workflows/site-generate.yml | ||
|
||
pr-check: | ||
needs: [package-check, site-check] | ||
runs-on: ubuntu-latest | ||
# can't do anything too fancy due to https://github.com/actions/runner/issues/491 | ||
if: always() && !(needs.package-check.result == 'skipped' && needs.site-check.result == 'skipped') | ||
steps: | ||
- name: Status | ||
# check result manually | ||
run: exit "${{ ((needs.package-check.result == 'success' || needs.package-check.result == 'skipped') && (needs.site-check.result == 'success' || needs.site-check.result == 'skipped')) && '0' || '1' }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,7 @@ on: | |
workflow_call: | ||
|
||
jobs: | ||
generate: | ||
site-generate: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,9 @@ | ||
name: 'Site: Lint' | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
paths-ignore: | ||
- 'packages/**' | ||
workflow_call: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
generate: | ||
site-lint: | ||
uses: ./.github/workflows/site-generate.yml |