Skip to content

Commit

Permalink
Move linting steps to GitHub Actions (#3869)
Browse files Browse the repository at this point in the history
* Remove go build/unittest steps

These are performed in the ADO "CI" pipeline.

* Merge golint steps into ci-go workflow

* Add new ci-python workflow

This currently contains an equivalent copy of the Lint_Az_ARO_Extension step in the ADO CI pipeline.

* Remove Lint_Az_ARO_Extension from ADO CI pipeline

* Update build/test step in CI pipeline to reflect current steps

Co-authored-by: Kipp Morris <[email protected]>

---------

Co-authored-by: Kipp Morris <[email protected]>
  • Loading branch information
tsatam and kimorris27 authored Oct 2, 2024
1 parent 4cb12bb commit 53565ba
Show file tree
Hide file tree
Showing 4 changed files with 105 additions and 130 deletions.
49 changes: 32 additions & 17 deletions .github/workflows/ci-go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,6 @@ permissions:
contents: read

jobs:
ci-from-docker:
runs-on: ubuntu-latest
container:
image: registry.access.redhat.com/ubi8/go-toolset:1.21.13-1
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Add GOBIN to PATH
run: |
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
- name: Build all
run: |
make build-all
- name: Run unit tests
run: |
make unit-test-go
vendor-check:
runs-on: ubuntu-latest
container:
Expand Down Expand Up @@ -57,3 +40,35 @@ jobs:
run: |
make generate
hack/ci-utils/isClean.sh
golangci:
name: golangci-lint
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod

- name: Run golangci-lint
uses: golangci/golangci-lint-action@v6
with:
version: v1.59.1
args: -v --timeout 15m

validate-go:
name: validate-go
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod

- run: make validate-go-action
26 changes: 26 additions & 0 deletions .github/workflows/ci-python.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: ci-python

on:
push:
tags:
- v*
branches:
- master
- azext-aro-*
pull_request:

permissions:
contents: read

jobs:
validate-python:
runs-on: ubuntu-latest
container:
image: registry.access.redhat.com/ubi8/python-311:latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: validate
run: |
make test-python
hack/ci-utils/isClean.sh
45 changes: 0 additions & 45 deletions .github/workflows/golint.yml

This file was deleted.

115 changes: 47 additions & 68 deletions .pipelines/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,78 +28,57 @@ resources:
variables:
- template: vars.yml

stages:
- stage: NotContainerized
dependsOn: Containerized
jobs:
- job: Lint_Az_ARO_Extension
pool:
name: 1es-aro-ci-pool
variables:
HOME: $(Agent.BuildDirectory)
steps:
- template: ./templates/template-checkout.yml
- script: |
set -xe
export AZDEV_CONFIG_DIR=$(Agent.BuildDirectory)/azdev-config
make test-python
[[ -z "$(git status -s)" ]]
displayName: πŸ§ͺ Lint Az ARO Extension
target: python
jobs:
- job: Build_Test_And_Push_Az_ARO_Extension
pool:
name: 1es-aro-ci-pool
steps:
- template: ./templates/template-checkout.yml

- stage: Containerized
dependsOn: []
jobs:
- job: Build_Test_And_Push_Az_ARO_Extension
pool:
name: 1es-aro-ci-pool
steps:
- template: ./templates/template-checkout.yml
# Build and test the Az ARO Extension
- script: |
set -xe
DOCKER_BUILD_CI_ARGS="--load" make ci-azext-aro VERSION=$(Build.BuildId)
displayName: πŸ›  Build & Test Az ARO Extension
# Build and test the Az ARO Extension
- script: |
set -xe
DOCKER_BUILD_CI_ARGS="--load" make ci-azext-aro VERSION=$(Build.BuildId)
displayName: πŸ›  Build & Test Az ARO Extension
# Push the image to ACR
- template: ./templates/template-acr-push.yml
parameters:
acrFQDN: 'arosvcdev.azurecr.io'
repository: 'azext-aro'
pushLatest: true

# Push the image to ACR
- template: ./templates/template-acr-push.yml
parameters:
acrFQDN: 'arosvcdev.azurecr.io'
repository: 'azext-aro'
pushLatest: true
- job: Build_And_Test_RP_And_Portal
pool:
name: 1es-aro-ci-pool
steps:
- template: ./templates/template-checkout.yml

- job: Build_Lint_Test_RP_And_Portal
pool:
name: 1es-aro-ci-pool
steps:
- template: ./templates/template-checkout.yml
# Build and test RP and Portal
- script: |
set -xe
DOCKER_BUILD_CI_ARGS="--load" make ci-rp VERSION=$(Build.BuildId)
displayName: πŸ›  Build & Test RP and Portal
# Build and test RP and Portal
- script: |
set -xe
DOCKER_BUILD_CI_ARGS="--load" make ci-rp VERSION=$(Build.BuildId)
displayName: πŸ›  Build & Test RP and Portal
# Publish test results
- task: PublishTestResults@2
displayName: πŸ“Š Publish tests results
inputs:
testResultsFiles: $(System.DefaultWorkingDirectory)/report.xml
condition: succeededOrFailed()

# Publish test results
- task: PublishTestResults@2
displayName: πŸ“Š Publish tests results
inputs:
testResultsFiles: $(System.DefaultWorkingDirectory)/report.xml
condition: succeededOrFailed()
# Publish code coverage results
- task: PublishCodeCoverageResults@2
displayName: πŸ“ˆ Publish code coverage
inputs:
codeCoverageTool: Cobertura
summaryFileLocation: $(System.DefaultWorkingDirectory)/coverage.xml
failIfCoverageEmpty: false
condition: succeededOrFailed()

# Publish code coverage results
- task: PublishCodeCoverageResults@2
displayName: πŸ“ˆ Publish code coverage
inputs:
codeCoverageTool: Cobertura
summaryFileLocation: $(System.DefaultWorkingDirectory)/coverage.xml
failIfCoverageEmpty: false
condition: succeededOrFailed()

# Push the image to ACR
- template: ./templates/template-acr-push.yml
parameters:
acrFQDN: 'arosvcdev.azurecr.io'
repository: 'aro'
pushLatest: true
# Push the image to ACR
- template: ./templates/template-acr-push.yml
parameters:
acrFQDN: 'arosvcdev.azurecr.io'
repository: 'aro'
pushLatest: true

0 comments on commit 53565ba

Please sign in to comment.