Commit Graph

32 Commits

Author SHA1 Message Date
Thomas Gummerer ae8134f5ad
upgrade to latest version of golangci-lint ()
The version we currently have doesn't support Go 1.22 properly, so it
throws a bunch of warnings locally when trying to run it with the latest
Go version installed. Just running the latest version locally also
doesn't quite work, since it throws a bunch of errors from the
perfsprint linter, which seems to have gotten stricter.

Upgrade to the latest version of golangci-lint, and fix all the errors
we're getting from it. Mostly done via `perfsprint -fix`, with some
manual changes that `perfsprint -fix` wouldn't touch.
2024-04-19 06:20:33 +00:00
Justin Van Patten 348a976084
ci: Use latest version of actions/checkout ()
Upgrade all workflows to the latest version of actions/checkout (which
uses node 20 runtime).
2024-03-30 15:53:47 +00:00
Justin Van Patten 1ac7b904d1
ci: Use latest version of golangci/golangci-lint-action ()
Upgrade all workflows to the latest version of
golangci/golangci-lint-action (which uses node 20 runtime).
2024-03-30 15:53:12 +00:00
Justin Van Patten 5b56b62a9c
ci: Use the latest version of actions/setup-node ()
Upgrade all workflows to the latest version of actions/setup-node (which
uses node 20 runtime).
2024-03-29 18:03:41 +00:00
Justin Van Patten fa87e176a5
ci: Use the latest version of actions/setup-python ()
Upgrade all workflows to the latest version of actions/setup-python
(which uses node 20 runtime).
2024-03-29 16:10:15 +00:00
Justin Van Patten a415f4c6b3
ci: Use the latest version of actions/setup-go ()
Upgrade all workflows to the latest version of actions/setup-go (which
uses node 20 runtime).
2024-03-29 16:00:53 +00:00
Fraser Waters c56bb05174
Update golangci-lint () 2023-11-21 15:16:13 +00:00
Justin Van Patten ad3e4fb059
[sdk/go] Fix issues with templates ()
Addresses two issues with codegen templates in the Go SDK:

1. `type_builtins.go.template` was including an import for a package
that doesn't exist. (The import doesn't exist in the current generated
code that is checked-in). This change removes the import line from the
template.

2. Some changes had been made directly to `config/require.go`, but this
is a generated file -- the changes should have been made to the
template. This change moves the changes to the template.

After the changes to these templates, running `make gen` in `sdk/go`
yields no diffs.

Fixes 
2023-09-04 19:51:13 +00:00
Abhinav Gupta 79ffe88b6d
ci(lint): Upgrade to latest golangci-lint ()
Upgrade to latest version of golangci-lint
and fix or opt-out the issues it caught.

The false positives are:

```
sdk/go/common/workspace/plugins_test.go:512:3: G101: Potential hardcoded credentials (gosec)
pkg/resource/deploy/builtins.go:180:2: G101: Potential hardcoded credentials (gosec)
```

The fixed issues are:

```
pkg/resource/deploy/deploytest/pluginhost.go:440:16: G601: Implicit memory aliasing in for loop. (gosec)
                        Version:    &v.version,
                                    ^
pkg/engine/lifecycletest/alias_test.go:58:25: G601: Implicit memory aliasing in for loop. (gosec)
                        DeleteBeforeReplace: &r.deleteBeforeReplace,
                                             ^
```
2023-08-31 18:26:04 +00:00
Bryce Lampe f3d0feb8b2
ci: Remove Bors ()
# Description

This PR removes Bors in favor of native GitHub merge queues. A very
similar
cutover was tested and verified in
https://github.com/pulumi/watchutil-rs/pull/39.

# Deployment plan

* [x] Find some time where PRs aren't being merged. This is mostly to
minimize confusion
  while we're futzing with branch protections. 
* [x] Update the repo's branch protection rules to match
  https://github.com/pulumi/watchutil-rs/pull/38:
* "Allow specified actors to bypass required pull requests": "bors" →
Unchecked
    * "Status checks that are required": "bors" → "ci-ok"
    * "Require merge queue": Unchecked → Checked
        * "Only merge non-failing pull requests" → Unchecked
        * "Merge method" → Squash and merge
* [ ] Merge this PR using the "Merge when ready" button.
* [ ] If it merges successfully: confirm the prepare-release step ran
and published
      pre-release artifacts.
* [ ] If the merge fails: it's possible we'll need to tweak steps
slightly
(e.g. if the step's name doesn't match the branch protection rule). The
      end goal is a "ci-ok" step in both the PR and merge workflows that
      captures whether everything is green.
* [ ] If the issues aren't immediately resolvable, revert the changes
made
to branch protection settings. Folks will continue to merge with
          Bors.

If all goes well, we should be able to continue merging with MQ for a
while --
at least long enough to cut a new CLI release. Once we're confident we
won't
need to roll back:
* [ ] Delete branch protection rules for:
    * staging
    * testing
* [ ] Remove pu/pu from https://app.bors.tech/repositories

Fixes https://github.com/pulumi/pulumi/issues/13501

## Checklist

- [ ] I have run `make tidy` to update any new dependencies
- [ ] I have run `make lint` to verify my code passes the lint check
  - [ ] I have formatted my code using `gofumpt`

<!--- Please provide details if the checkbox below is to be left
unchecked. -->
- [ ] I have added tests that prove my fix is effective or that my
feature works
<!---
User-facing changes require a CHANGELOG entry.
-->
- [ ] I have run `make changelog` and committed the
`changelog/pending/<file>` documenting my change
<!--
If the change(s) in this PR is a modification of an existing call to the
Pulumi Cloud,
then the service should honor older versions of the CLI where this
change would not exist.
You must then bump the API version in
/pkg/backend/httpstate/client/api.go, as well as add
it to the service.
-->
- [ ] Yes, there are changes in this PR that warrants bumping the Pulumi
Cloud API version
<!-- @Pulumi employees: If yes, you must submit corresponding changes in
the service repo. -->
2023-08-12 01:36:48 +00:00
Ian Wahbe 76af81ba21 Upgrade the golangci-lint version used in CI 2023-06-28 13:57:25 +02:00
Abhinav Gupta 785db327f4
ci(lint): Disable setup-go cache for golangci-lint
The golangci-lint-action comes with its own caching logic,
which includes caching Go build data.
We should not have setup-go caching enabled in that case.

ref: https://github.com/golangci/golangci-lint-action#how-to-use
Note the `cache: false`.

Note that usually setup-go doesn't take much time,
but sometimes it fails while downloading or uploading the cache.
This just drops an occasional source of flakiness in the job.
2023-06-21 09:54:15 -07:00
Abhinav Gupta 7837e6c78c
ci(lint): make tidy > ./scripts/tidy.sh
`make tidy` is a more future-proof advice than `./scripts/tidy.sh`.

Refs https://github.com/pulumi/pulumi/pull/13054#discussion_r1210794437
2023-05-30 13:38:58 -07:00
Abhinav Gupta 1291fdb3b9
ci(lint): Helpful message on tidy failure
When the 'go mod tidy' lint check fails,
it prints a simple error message reporting the failure.

Most will resort to running `go mod tidy` manually
to attempt to fix this, but this will not always work.
We need to run `./scripts/tidy.sh` which updates all go.mod files
and includes specific compatibility flags.
2023-05-30 10:54:35 -07:00
Abhinav Gupta 2b178711c8
ci: make lint_golang to lint all Go packages
Adds a `make lint_golang` target that lints all Go packages
in one command instead of copy-pasting between them.

Instead of duplicating the list of packages in ci-lint,
use the golangci-lint-action to install the linter once,
and let the `make` target actually run it.

The primary motivation for this is to reduce duplication in CI setup
in anticipation of adding a new package to the list.

Usage notes:

- The `--path-prefix` flag ensures that file paths
  in the error messages are correct.
- The optional GOLANGCI_LINT_ARGS variable allows adding additional
  arguments.
  We use this to opt-into github-actions-friendly output in CI.
2023-05-19 14:49:42 -07:00
Robbie McKinstry cf767cc47e
Regularlize lint workflow.
When we introduced Rome into the Node SDK, we added a Make rule
for formatting separate from our linting rule. This commit moves
format-checking into the lint rule so that the Node SDK's Make rules
will more closely match the Python SDK's Make rules.
Now, in both SDKs, `make lint` also checks formatting.
2023-05-11 00:07:16 -04:00
Robbie McKinstry c513796701
Add Rome autoformatter to Node SDK.
This commit adds the Rome autoformatter to the Node SDK toolchain.
It adds rules to the Makefile to validate formatting in CI, and to
autoformat. Lastly, it updates CI to ensure each commit correctly formats
the code.
2023-04-28 18:25:36 -04:00
Abhinav Gupta bc82d40014
ci-lint: Upgrade to golangci-lint v1.52 2023-03-21 08:54:36 -07:00
Abhinav Gupta 984ef78824
ci/lint: Upgrade to golangci-lint v1.51
v1.51 includes support for staticcheck.
2023-02-03 14:19:32 -08:00
Abhinav Gupta 3760061ef8
ci/lint: Use golangci-lint-action
Instead of rolling our own caching logic,
use the official golangci-lint-action
and run `go mod tidy` concurrently.

This has a few advantages over the current setup:

- Non-container builds are faster to run
  (we take ~20 seconds to set up the container)
- golangci-lint-action's caching logic is better:
  it periodically invalidates itself automatically
- `go mod tidy` takes over am inute to run;
  this can be done in parallel

Caveats:

- golangci-lint-action does not support multiple modules in one call,
  so we have to run the action separately for each submodule.
- We have to duplicate some of what `make lint` specifies.
  If we ever add more checks to `make lint`,
  we'll need to also update this job.

Refs 
Supersedes 
2023-01-31 14:23:03 -08:00
Abhinav Gupta 6a77acba79
Use go.work only for ci-lint
Add a go.work workspace with pkg, sdk, and tests only in CI
when linting the Go code.

In `make lint`, pick between "lint all together"
and "lint all separately"
based on whether we're in a Go workspace.
2023-01-31 10:06:28 -08:00
Abhinav Gupta 21525fbf67
ci/lint: Use latest golangci-lint
Now that all code is gofmt compliant (),
we can upgrade to the latest golangci-lint.

Refs 
Refs 
2023-01-10 19:03:24 -08:00
Fraser Waters f4ad5c5a56 Remove dotnet 2022-12-13 16:13:53 +00:00
Aaron Friel 12ca78ee61 ci: Re-enable version sets for .NET, test GA version of 6 and 7 2022-11-11 11:28:13 -08:00
Aaron Friel d6e03eb39d ci: block non-linear merges 2022-11-08 11:22:32 -08:00
Aaron Friel 91756bc1e3 fix(ci): Disable setup-dotnet action, rely on globally installed dotnet 2022-10-11 08:53:00 -07:00
Aaron Friel b0070a0410 ci: Fail if repo is not tidy 2022-10-04 22:57:08 -07:00
Fraser Waters 19bae8f75f Run make tidy as part of linting
We run make tidy as part of release so we really want to make sure it's
correct before anything hits master.
2022-10-05 16:22:10 +01:00
Aaron Friel 110dd76629 ci: Pin yarn lockfile for security & dependency scanning 2022-09-21 15:35:43 -07:00
Aaron Friel 2af74b6469 ci: Use reduced smoke testing on Windows & macOS targets 2022-09-21 09:55:06 -07:00
Aaron Friel 6ef7ef64d6 ci: Enable testing of language version sets 2022-09-21 09:48:38 -07:00
Aaron Friel 272b987791 ci: ensure trunk is always green 2022-09-13 13:38:14 -07:00