code.gitea.io/gitea@v1.21.7/.github/workflows/pull-compliance.yml (about)

     1  name: compliance
     2  
     3  on:
     4    pull_request:
     5  
     6  concurrency:
     7    group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
     8    cancel-in-progress: true
     9  
    10  jobs:
    11    files-changed:
    12      uses: ./.github/workflows/files-changed.yml
    13  
    14    lint-backend:
    15      if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.actions == 'true'
    16      needs: files-changed
    17      runs-on: ubuntu-latest
    18      steps:
    19        - uses: actions/checkout@v4
    20        - uses: actions/setup-go@v4
    21          with:
    22            go-version: "~1.21"
    23            check-latest: true
    24        - run: make deps-backend deps-tools
    25        - run: make lint-backend
    26          env:
    27            TAGS: bindata sqlite sqlite_unlock_notify
    28  
    29    lint-templates:
    30      if: needs.files-changed.outputs.templates == 'true'
    31      needs: files-changed
    32      runs-on: ubuntu-latest
    33      steps:
    34        - uses: actions/checkout@v4
    35        - uses: actions/setup-python@v4
    36          with:
    37            python-version: "3.11"
    38        - run: pip install poetry
    39        - run: make deps-py
    40        - run: make lint-templates
    41  
    42    lint-yaml:
    43      if: needs.files-changed.outputs.yaml == 'true'
    44      needs: files-changed
    45      runs-on: ubuntu-latest
    46      steps:
    47        - uses: actions/checkout@v4
    48        - uses: actions/setup-python@v4
    49          with:
    50            python-version: "3.11"
    51        - run: pip install poetry
    52        - run: make deps-py
    53        - run: make lint-yaml
    54  
    55    lint-swagger:
    56      if: needs.files-changed.outputs.swagger == 'true'
    57      needs: files-changed
    58      runs-on: ubuntu-latest
    59      steps:
    60        - uses: actions/checkout@v4
    61        - uses: actions/setup-node@v3
    62          with:
    63            node-version: 20
    64        - run: make deps-frontend
    65        - run: make lint-swagger
    66  
    67    lint-spell:
    68      if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.frontend == 'true' || needs.files-changed.outputs.actions == 'true' || needs.files-changed.outputs.docs == 'true' || needs.files-changed.outputs.templates == 'true'
    69      needs: files-changed
    70      runs-on: ubuntu-latest
    71      steps:
    72        - uses: actions/checkout@v4
    73        - uses: actions/setup-go@v5
    74          with:
    75            go-version-file: go.mod
    76            check-latest: true
    77        - run: make lint-spell
    78  
    79    lint-go-windows:
    80      if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.actions == 'true'
    81      needs: files-changed
    82      runs-on: ubuntu-latest
    83      steps:
    84        - uses: actions/checkout@v4
    85        - uses: actions/setup-go@v4
    86          with:
    87            go-version: "~1.21"
    88            check-latest: true
    89        - run: make deps-backend deps-tools
    90        - run: make lint-go-windows lint-go-vet
    91          env:
    92            TAGS: bindata sqlite sqlite_unlock_notify
    93            GOOS: windows
    94            GOARCH: amd64
    95  
    96    lint-go-gogit:
    97      if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.actions == 'true'
    98      needs: files-changed
    99      runs-on: ubuntu-latest
   100      steps:
   101        - uses: actions/checkout@v4
   102        - uses: actions/setup-go@v4
   103          with:
   104            go-version: "~1.21"
   105            check-latest: true
   106        - run: make deps-backend deps-tools
   107        - run: make lint-go
   108          env:
   109            TAGS: bindata gogit sqlite sqlite_unlock_notify
   110  
   111    checks-backend:
   112      if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.actions == 'true'
   113      needs: files-changed
   114      runs-on: ubuntu-latest
   115      steps:
   116        - uses: actions/checkout@v4
   117        - uses: actions/setup-go@v4
   118          with:
   119            go-version: "~1.21"
   120            check-latest: true
   121        - run: make deps-backend deps-tools
   122        - run: make --always-make checks-backend # ensure the "go-licenses" make target runs
   123  
   124    frontend:
   125      if: needs.files-changed.outputs.frontend == 'true' || needs.files-changed.outputs.actions == 'true'
   126      needs: files-changed
   127      runs-on: ubuntu-latest
   128      steps:
   129        - uses: actions/checkout@v4
   130        - uses: actions/setup-node@v3
   131          with:
   132            node-version: 20
   133        - run: make deps-frontend
   134        - run: make lint-frontend
   135        - run: make checks-frontend
   136        - run: make test-frontend
   137        - run: make frontend
   138  
   139    backend:
   140      if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.actions == 'true'
   141      needs: files-changed
   142      runs-on: ubuntu-latest
   143      steps:
   144        - uses: actions/checkout@v4
   145        - uses: actions/setup-go@v4
   146          with:
   147            go-version: "~1.21"
   148            check-latest: true
   149        # no frontend build here as backend should be able to build
   150        # even without any frontend files
   151        - run: make deps-backend
   152        - run: go build -o gitea_no_gcc # test if build succeeds without the sqlite tag
   153        - name: build-backend-arm64
   154          run: make backend # test cross compile
   155          env:
   156            GOOS: linux
   157            GOARCH: arm64
   158            TAGS: bindata gogit
   159        - name: build-backend-windows
   160          run: go build -o gitea_windows
   161          env:
   162            GOOS: windows
   163            GOARCH: amd64
   164            TAGS: bindata gogit
   165        - name: build-backend-386
   166          run: go build -o gitea_linux_386 # test if compatible with 32 bit
   167          env:
   168            GOOS: linux
   169            GOARCH: 386
   170  
   171    docs:
   172      if: needs.files-changed.outputs.docs == 'true' || needs.files-changed.outputs.actions == 'true'
   173      needs: files-changed
   174      runs-on: ubuntu-latest
   175      steps:
   176        - uses: actions/checkout@v4
   177        - uses: actions/setup-node@v3
   178          with:
   179            node-version: 20
   180        - run: make deps-frontend
   181        - run: make lint-md
   182        - run: make docs
   183  
   184    actions:
   185      if: needs.files-changed.outputs.actions == 'true' || needs.files-changed.outputs.actions == 'true'
   186      needs: files-changed
   187      runs-on: ubuntu-latest
   188      steps:
   189        - uses: actions/checkout@v4
   190        - uses: actions/setup-go@v4
   191        - run: make lint-actions