plane/.github/workflows/build-test-pull-request.yml

138 lines
3.7 KiB
YAML
Raw Normal View History

name: Build and Lint on Pull Request
on:
workflow_dispatch:
pull_request:
types: ["opened", "synchronize"]
jobs:
get-changed-files:
runs-on: ubuntu-latest
outputs:
apiserver_changed: ${{ steps.changed-files.outputs.apiserver_any_changed }}
2024-05-08 19:23:47 +00:00
admin_changed: ${{ steps.changed-files.outputs.admin_any_changed }}
space_changed: ${{ steps.changed-files.outputs.space_any_changed }}
web_changed: ${{ steps.changed-files.outputs.web_any_changed }}
steps:
2024-05-14 08:56:23 +00:00
- uses: actions/checkout@v4
- name: Get changed files
id: changed-files
2024-05-14 08:56:23 +00:00
uses: tj-actions/changed-files@v44
with:
files_yaml: |
apiserver:
- apiserver/**
2024-05-08 19:23:47 +00:00
admin:
- admin/**
- packages/**
- 'package.json'
- 'yarn.lock'
- 'tsconfig.json'
- 'turbo.json'
2024-05-08 19:23:47 +00:00
space:
- space/**
- packages/**
- 'package.json'
- 'yarn.lock'
- 'tsconfig.json'
- 'turbo.json'
2024-05-08 19:23:47 +00:00
web:
- web/**
- packages/**
- 'package.json'
- 'yarn.lock'
- 'tsconfig.json'
- 'turbo.json'
lint-apiserver:
needs: get-changed-files
runs-on: ubuntu-latest
if: needs.get-changed-files.outputs.apiserver_changed == 'true'
steps:
2024-05-14 08:56:23 +00:00
- uses: actions/checkout@v4
- name: Set up Python
2024-05-14 08:56:23 +00:00
uses: actions/setup-python@v5
with:
2024-05-08 19:23:47 +00:00
python-version: "3.x" # Specify the Python version you need
- name: Install Pylint
run: python -m pip install ruff
- name: Install Apiserver Dependencies
run: cd apiserver && pip install -r requirements.txt
- name: Lint apiserver
run: ruff check --fix apiserver
2024-05-08 19:23:47 +00:00
lint-admin:
needs: get-changed-files
2024-05-08 19:23:47 +00:00
if: needs.get-changed-files.outputs.admin_changed == 'true'
runs-on: ubuntu-latest
steps:
2024-05-14 08:56:23 +00:00
- uses: actions/checkout@v4
- name: Setup Node.js
2024-05-14 08:56:23 +00:00
uses: actions/setup-node@v4
with:
node-version: 18.x
- run: yarn install
2024-05-08 19:23:47 +00:00
- run: yarn lint --filter=admin
lint-space:
needs: get-changed-files
if: needs.get-changed-files.outputs.space_changed == 'true'
runs-on: ubuntu-latest
steps:
2024-05-14 08:56:23 +00:00
- uses: actions/checkout@v4
- name: Setup Node.js
2024-05-14 08:56:23 +00:00
uses: actions/setup-node@v4
with:
node-version: 18.x
- run: yarn install
- run: yarn lint --filter=space
2024-05-08 19:23:47 +00:00
lint-web:
needs: get-changed-files
if: needs.get-changed-files.outputs.web_changed == 'true'
runs-on: ubuntu-latest
steps:
2024-05-14 08:56:23 +00:00
- uses: actions/checkout@v4
- name: Setup Node.js
2024-05-14 08:56:23 +00:00
uses: actions/setup-node@v4
with:
node-version: 18.x
- run: yarn install
2024-05-08 19:23:47 +00:00
- run: yarn lint --filter=web
build-admin:
2024-05-08 20:11:48 +00:00
needs: lint-admin
2024-05-08 19:23:47 +00:00
runs-on: ubuntu-latest
steps:
2024-05-14 08:56:23 +00:00
- uses: actions/checkout@v4
2024-05-08 19:23:47 +00:00
- name: Setup Node.js
2024-05-14 08:56:23 +00:00
uses: actions/setup-node@v4
2024-05-08 19:23:47 +00:00
with:
node-version: 18.x
- run: yarn install
- run: yarn build --filter=admin
build-space:
needs: lint-space
runs-on: ubuntu-latest
steps:
2024-05-14 08:56:23 +00:00
- uses: actions/checkout@v4
- name: Setup Node.js
2024-05-14 08:56:23 +00:00
uses: actions/setup-node@v4
with:
node-version: 18.x
- run: yarn install
- run: yarn build --filter=space
2024-05-08 19:23:47 +00:00
build-web:
needs: lint-web
runs-on: ubuntu-latest
steps:
2024-05-14 08:56:23 +00:00
- uses: actions/checkout@v4
2024-05-08 19:23:47 +00:00
- name: Setup Node.js
2024-05-14 08:56:23 +00:00
uses: actions/setup-node@v4
2024-05-08 19:23:47 +00:00
with:
node-version: 18.x
- run: yarn install
- run: yarn build --filter=web