2022-03-31 15:40:20 +00:00
|
|
|
name: Lint
|
|
|
|
|
|
|
|
on:
|
|
|
|
pull_request:
|
|
|
|
|
|
|
|
jobs:
|
2022-04-05 13:43:46 +00:00
|
|
|
# Determine what the js changes are
|
|
|
|
js-changes:
|
2022-03-31 15:40:20 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
outputs:
|
|
|
|
packages: ${{ steps.filter.outputs.changes }}
|
|
|
|
steps:
|
|
|
|
# Use paths-filter to determine which paths have changes
|
|
|
|
# https://github.com/dorny/paths-filter
|
|
|
|
- uses: dorny/paths-filter@v2
|
|
|
|
id: filter
|
|
|
|
with:
|
|
|
|
# Format of key: value. When there is a change detected in value, the
|
|
|
|
# key will be returned in the output.
|
|
|
|
filters: |
|
|
|
|
packages/dashboard: packages/dashboard/**
|
2022-04-05 13:43:46 +00:00
|
|
|
packages/dashboard-v2: packages/dashboard-v2/**
|
2022-03-31 15:40:20 +00:00
|
|
|
packages/dnslink-api: packages/dnslink-api/**
|
|
|
|
packages/handshake-api: packages/handshake-api/**
|
|
|
|
packages/health-check: packages/health-check/**
|
|
|
|
packages/website: packages/website/**
|
|
|
|
|
|
|
|
# Determine what the dockerfile changes are
|
|
|
|
dockerfile-changes:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
outputs:
|
|
|
|
packages: ${{ steps.filter.outputs.changes }}
|
|
|
|
steps:
|
|
|
|
# Use paths-filter to determine which paths have changes
|
|
|
|
# https://github.com/dorny/paths-filter
|
|
|
|
- uses: dorny/paths-filter@v2
|
|
|
|
id: filter
|
|
|
|
with:
|
|
|
|
# Format of key: value. When there is a change detected in value, the
|
|
|
|
# key will be returned in the output.
|
|
|
|
filters: |
|
|
|
|
docker/nginx/Dockerfile: docker/nginx/Dockerfile
|
|
|
|
docker/sia/Dockerfile: docker/sia/Dockerfile
|
|
|
|
packages/dashboard/Dockerfile: packages/dashboard/Dockerfile
|
|
|
|
packages/dnslink-api/Dockerfile: packages/dnslink-api/Dockerfile
|
|
|
|
packages/handshake-api/Dockerfile: packages/handshake-api/Dockerfile
|
|
|
|
packages/health-check/Dockerfile: packages/health-check/Dockerfile
|
|
|
|
packages/website/Dockerfile: packages/website/Dockerfile
|
|
|
|
|
2022-04-05 13:43:46 +00:00
|
|
|
# Run the js lint if there are changes to any of the js packages
|
|
|
|
js-lint:
|
|
|
|
needs: js-changes
|
2022-03-31 15:40:20 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
2022-04-05 13:43:46 +00:00
|
|
|
working-directory: ${{ fromJSON(needs.js-changes.outputs.packages) }}
|
2022-03-31 15:40:20 +00:00
|
|
|
steps:
|
2022-04-06 19:09:36 +00:00
|
|
|
- uses: actions/checkout@v3
|
2022-04-05 13:43:46 +00:00
|
|
|
- name: Run JS-Lint Action
|
|
|
|
uses: ./.github/actions/js-lint
|
2022-03-31 15:40:20 +00:00
|
|
|
with:
|
|
|
|
working-directory: ${{ matrix.working-directory }}
|
|
|
|
|
|
|
|
# Run the hadolint dockefile lint if there are changes to any of the
|
|
|
|
# dockerfiles
|
|
|
|
hadolint:
|
|
|
|
needs: dockerfile-changes
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
|
|
dockerfile: ${{ fromJSON(needs.dockerfile-changes.outputs.packages) }}
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
2022-04-06 19:09:36 +00:00
|
|
|
- uses: hadolint/hadolint-action@v2.1.0
|
2022-03-31 15:40:20 +00:00
|
|
|
with:
|
|
|
|
dockerfile: ${{ matrix.dockerfile }}
|
|
|
|
|
|
|
|
# Determine if there are python changes
|
|
|
|
python-changes:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
outputs:
|
|
|
|
# Check if the changed status of py is true
|
|
|
|
updates: steps.changes.outputs.py == 'true'
|
|
|
|
steps:
|
|
|
|
# Use paths-filter to determine which paths have changes
|
|
|
|
# https://github.com/dorny/paths-filter
|
|
|
|
- uses: dorny/paths-filter@v2
|
|
|
|
id: changes
|
|
|
|
with:
|
|
|
|
filters: |
|
|
|
|
py: "**.py"
|
|
|
|
|
|
|
|
# Run the hadolint dockefile lint if there are changes to any of the
|
|
|
|
# dockerfiles
|
|
|
|
python-lint:
|
|
|
|
needs: python-changes
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2022-04-06 19:09:36 +00:00
|
|
|
- uses: actions/checkout@v3
|
2022-03-31 15:40:20 +00:00
|
|
|
- name: Run Black python linter
|
|
|
|
if: ${{ needs.python-changes.outputs.updates }}
|
|
|
|
uses: ./.github/actions/python-black-lint
|
|
|
|
- name: Run Flake8 python linter
|
|
|
|
if: ${{ needs.python-changes.outputs.updates }}
|
|
|
|
uses: ./.github/actions/python-flake8-lint
|