code.gitea.io/gitea@v1.22.3/.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@v5
    21          with:
    22            go-version-file: go.mod
    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@v5
    36          with:
    37            python-version: "3.12"
    38        - uses: actions/setup-node@v4
    39          with:
    40            node-version: 20
    41            cache: npm
    42            cache-dependency-path: package-lock.json
    43        - run: pip install poetry
    44        - run: make deps-py
    45        - run: make deps-frontend
    46        - run: make lint-templates
    47  
    48    lint-yaml:
    49      if: needs.files-changed.outputs.yaml == 'true'
    50      needs: files-changed
    51      runs-on: ubuntu-latest
    52      steps:
    53        - uses: actions/checkout@v4
    54        - uses: actions/setup-python@v5
    55          with:
    56            python-version: "3.12"
    57        - run: pip install poetry
    58        - run: make deps-py
    59        - run: make lint-yaml
    60  
    61    lint-swagger:
    62      if: needs.files-changed.outputs.swagger == 'true'
    63      needs: files-changed
    64      runs-on: ubuntu-latest
    65      steps:
    66        - uses: actions/checkout@v4
    67        - uses: actions/setup-node@v4
    68          with:
    69            node-version: 20
    70            cache: npm
    71            cache-dependency-path: package-lock.json
    72        - run: make deps-frontend
    73        - run: make lint-swagger
    74  
    75    lint-spell:
    76      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'
    77      needs: files-changed
    78      runs-on: ubuntu-latest
    79      steps:
    80        - uses: actions/checkout@v4
    81        - uses: actions/setup-go@v5
    82          with:
    83            go-version-file: go.mod
    84            check-latest: true
    85        - run: make lint-spell
    86  
    87    lint-go-windows:
    88      if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.actions == 'true'
    89      needs: files-changed
    90      runs-on: ubuntu-latest
    91      steps:
    92        - uses: actions/checkout@v4
    93        - uses: actions/setup-go@v5
    94          with:
    95            go-version-file: go.mod
    96            check-latest: true
    97        - run: make deps-backend deps-tools
    98        - run: make lint-go-windows lint-go-vet
    99          env:
   100            TAGS: bindata sqlite sqlite_unlock_notify
   101            GOOS: windows
   102            GOARCH: amd64
   103  
   104    lint-go-gogit:
   105      if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.actions == 'true'
   106      needs: files-changed
   107      runs-on: ubuntu-latest
   108      steps:
   109        - uses: actions/checkout@v4
   110        - uses: actions/setup-go@v5
   111          with:
   112            go-version-file: go.mod
   113            check-latest: true
   114        - run: make deps-backend deps-tools
   115        - run: make lint-go
   116          env:
   117            TAGS: bindata gogit sqlite sqlite_unlock_notify
   118  
   119    checks-backend:
   120      if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.actions == 'true'
   121      needs: files-changed
   122      runs-on: ubuntu-latest
   123      steps:
   124        - uses: actions/checkout@v4
   125        - uses: actions/setup-go@v5
   126          with:
   127            go-version-file: go.mod
   128            check-latest: true
   129        - run: make deps-backend deps-tools
   130        - run: make --always-make checks-backend # ensure the "go-licenses" make target runs
   131  
   132    frontend:
   133      if: needs.files-changed.outputs.frontend == 'true' || needs.files-changed.outputs.actions == 'true'
   134      needs: files-changed
   135      runs-on: ubuntu-latest
   136      steps:
   137        - uses: actions/checkout@v4
   138        - uses: actions/setup-node@v4
   139          with:
   140            node-version: 20
   141            cache: npm
   142            cache-dependency-path: package-lock.json
   143        - run: make deps-frontend
   144        - run: make lint-frontend
   145        - run: make checks-frontend
   146        - run: make test-frontend
   147        - run: make frontend
   148  
   149    backend:
   150      if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.actions == 'true'
   151      needs: files-changed
   152      runs-on: ubuntu-latest
   153      steps:
   154        - uses: actions/checkout@v4
   155        - uses: actions/setup-go@v5
   156          with:
   157            go-version-file: go.mod
   158            check-latest: true
   159        # no frontend build here as backend should be able to build
   160        # even without any frontend files
   161        - run: make deps-backend
   162        - run: go build -o gitea_no_gcc # test if build succeeds without the sqlite tag
   163        - name: build-backend-arm64
   164          run: make backend # test cross compile
   165          env:
   166            GOOS: linux
   167            GOARCH: arm64
   168            TAGS: bindata gogit
   169        - name: build-backend-windows
   170          run: go build -o gitea_windows
   171          env:
   172            GOOS: windows
   173            GOARCH: amd64
   174            TAGS: bindata gogit
   175        - name: build-backend-386
   176          run: go build -o gitea_linux_386 # test if compatible with 32 bit
   177          env:
   178            GOOS: linux
   179            GOARCH: 386
   180  
   181    docs:
   182      if: needs.files-changed.outputs.docs == 'true' || needs.files-changed.outputs.actions == 'true'
   183      needs: files-changed
   184      runs-on: ubuntu-latest
   185      steps:
   186        - uses: actions/checkout@v4
   187        - uses: actions/setup-node@v4
   188          with:
   189            node-version: 20
   190            cache: npm
   191            cache-dependency-path: package-lock.json
   192        - run: make deps-frontend
   193        - run: make lint-md
   194        - run: make docs
   195  
   196    actions:
   197      if: needs.files-changed.outputs.actions == 'true' || needs.files-changed.outputs.actions == 'true'
   198      needs: files-changed
   199      runs-on: ubuntu-latest
   200      steps:
   201        - uses: actions/checkout@v4
   202        - uses: actions/setup-go@v5
   203          with:
   204            go-version-file: go.mod
   205            check-latest: true
   206        - run: make lint-actions