diff --git a/.github/workflows/go.yaml b/.github/workflows/go.yaml new file mode 100644 index 00000000..153bf8b3 --- /dev/null +++ b/.github/workflows/go.yaml @@ -0,0 +1,80 @@ +name: Go +on: + push: + branches: + - master + paths: + - '.github/workflows/go.yaml' + - '**.go' + - 'go.mod' + - 'go.sum' + + pull_request: + paths: + - '.github/workflows/go.yaml' + - '**.go' + - 'go.mod' + - 'go.sum' + +permissions: + contents: read + +jobs: + fmt: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-go@v4 + with: + go-version-file: 'go.mod' + cache: false + - name: fmt + run: go fmt ./... + - name: Check diff + run: git diff --exit-code + + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-go@v4 + with: + go-version-file: 'go.mod' + cache: false + - name: golangci-lint + uses: golangci/golangci-lint-action@v3 + with: + only-new-issues: true + version: v1.51.1 + + generate: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-go@v4 + with: + go-version-file: 'go.mod' + cache: false + - name: Generate + run: make generate + - name: Check diff + run: git diff --exit-code + + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-go@v4 + with: + go-version-file: 'go.mod' + - run: make manifests + - name: Check diff + run: git diff --exit-code + - name: Install kubebuilder + run: | + curl -L -O https://github.com/kubernetes-sigs/kubebuilder/releases/download/v2.3.2/kubebuilder_2.3.2_linux_amd64.tar.gz + tar zxvf kubebuilder_2.3.2_linux_amd64.tar.gz + sudo mv kubebuilder_2.3.2_linux_amd64 /usr/local/kubebuilder + - name: Run go tests + run: | + go test -short `go list ./... | grep -v ./test_e2e_arc` diff --git a/.github/workflows/golangci-lint.yaml b/.github/workflows/golangci-lint.yaml deleted file mode 100644 index 13e5fb55..00000000 --- a/.github/workflows/golangci-lint.yaml +++ /dev/null @@ -1,23 +0,0 @@ -name: golangci-lint -on: - push: - branches: - - master - pull_request: -permissions: - contents: read - pull-requests: read -jobs: - golangci: - name: lint - runs-on: ubuntu-latest - steps: - - uses: actions/setup-go@v3 - with: - go-version: 1.19 - - uses: actions/checkout@v3 - - name: golangci-lint - uses: golangci/golangci-lint-action@v3 - with: - only-new-issues: true - version: v1.51.1 diff --git a/.github/workflows/validate-arc.yaml b/.github/workflows/validate-arc.yaml deleted file mode 100644 index e487f5fb..00000000 --- a/.github/workflows/validate-arc.yaml +++ /dev/null @@ -1,60 +0,0 @@ -name: Validate ARC - -on: - pull_request: - branches: - - master - paths-ignore: - - '**.md' - - '.github/ISSUE_TEMPLATE/**' - - '.github/workflows/publish-canary.yaml' - - '.github/workflows/validate-chart.yaml' - - '.github/workflows/publish-chart.yaml' - - '.github/workflows/runners.yaml' - - '.github/workflows/publish-arc.yaml' - - '.github/workflows/validate-entrypoint.yaml' - - '.github/renovate.*' - - 'runner/**' - - '.gitignore' - - 'PROJECT' - - 'LICENSE' - - 'Makefile' - -permissions: - contents: read - -jobs: - test-controller: - name: Test ARC - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Set-up Go - uses: actions/setup-go@v3 - with: - go-version: '1.19' - check-latest: false - - - uses: actions/cache@v3 - with: - path: ~/go/pkg/mod - key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} - restore-keys: | - ${{ runner.os }}-go- - - - name: Install kubebuilder - run: | - curl -L -O https://github.com/kubernetes-sigs/kubebuilder/releases/download/v2.3.2/kubebuilder_2.3.2_linux_amd64.tar.gz - tar zxvf kubebuilder_2.3.2_linux_amd64.tar.gz - sudo mv kubebuilder_2.3.2_linux_amd64 /usr/local/kubebuilder - - - name: Run tests - run: | - make test - - - name: Verify manifests are up-to-date - run: | - make manifests - git diff --exit-code diff --git a/go.mod b/go.mod index 90f6c0e0..c5a759eb 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/actions/actions-runner-controller -go 1.19 +go 1.20 require ( github.com/bradleyfalzon/ghinstallation/v2 v2.1.0