diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..c6daa18 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,98 @@ +name: CI + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +env: + # Go version we currently use to build containerd across all CI. + # Note: don't forget to update `Binaries` step, as it contains the matrix of all supported Go versions. + GO_VERSION: "1.21.0" + +permissions: # added using https://github.com/step-security/secure-workflows + contents: read + +jobs: + + # + # golangci-lint + # + linters: + permissions: + contents: read # for actions/checkout to fetch code + pull-requests: read # for golangci/golangci-lint-action to fetch pull requests + name: Linters + runs-on: ${{ matrix.os }} + timeout-minutes: 10 + + strategy: + matrix: + os: [ubuntu-22.04, macos-12, windows-2022] + + steps: + - uses: actions/setup-go@v4 + with: + go-version: ${{ env.GO_VERSION }} + cache: false # see actions/setup-go#368 + + - uses: actions/checkout@v3 + - uses: golangci/golangci-lint-action@v3 + with: + version: v1.52.2 + skip-cache: true + args: --timeout=5m + + # + # Project checks + # + project: + name: Project Checks + if: github.repository == 'containerd/errdefs' + runs-on: ubuntu-22.04 + timeout-minutes: 5 + + steps: + - uses: actions/setup-go@v4 + with: + go-version: ${{ env.GO_VERSION }} + cache: false # see actions/setup-go#368 + + - uses: actions/checkout@v3 + with: + path: src/github.com/containerd/errdefs + fetch-depth: 25 + + - uses: containerd/project-checks@v1.1.0 + with: + working-directory: src/github.com/containerd/errdefs + repo-access-token: ${{ secrets.GITHUB_TOKEN }} + + tests: + name: Tests + runs-on: ${{ matrix.os }} + timeout-minutes: 5 + + strategy: + matrix: + os: [ubuntu-22.04, macos-12, windows-2022] + + steps: + - uses: actions/checkout@v2 + with: + path: src/github.com/containerd/errdefs + + - uses: actions/setup-go@v2 + with: + go-version: ${{ env.GO_VERSION }} + + - name: Set env + shell: bash + run: | + echo "GOPATH=${{ github.workspace }}" >> $GITHUB_ENV + echo "${{ github.workspace }}/bin" >> $GITHUB_PATH + + - run: | + go test -v -race + working-directory: src/github.com/containerd/errdefs diff --git a/README.md b/README.md new file mode 100644 index 0000000..bd418c6 --- /dev/null +++ b/README.md @@ -0,0 +1,13 @@ +# errdefs + +A Go package for defining and checking common containerd errors. + +## Project details + +**errdefs** is a containerd sub-project, licensed under the [Apache 2.0 license](./LICENSE). +As a containerd sub-project, you will find the: + * [Project governance](https://github.com/containerd/project/blob/main/GOVERNANCE.md), + * [Maintainers](https://github.com/containerd/project/blob/main/MAINTAINERS), + * and [Contributing guidelines](https://github.com/containerd/project/blob/main/CONTRIBUTING.md) + +information in our [`containerd/project`](https://github.com/containerd/project) repository. diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..d6525c7 --- /dev/null +++ b/go.mod @@ -0,0 +1,12 @@ +module github.com/containerd/errdefs + +go 1.20 + +require google.golang.org/grpc v1.58.3 + +require ( + github.com/golang/protobuf v1.5.3 // indirect + golang.org/x/sys v0.13.0 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20231002182017-d307bd883b97 // indirect + google.golang.org/protobuf v1.31.0 // indirect +) diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..4e7237e --- /dev/null +++ b/go.sum @@ -0,0 +1,18 @@ +github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= +github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= +github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= +golang.org/x/net v0.12.0 h1:cfawfvKITfUsFCeJIHJrbSxpeu/E81khclypR0GVT50= +golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= +golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/text v0.11.0 h1:LAntKIrcmeSKERyiOh0XMV39LXS8IE9UL2yP7+f5ij4= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/genproto/googleapis/rpc v0.0.0-20231002182017-d307bd883b97 h1:6GQBEOdGkX6MMTLT9V+TjtIRZCw9VPD5Z+yHY9wMgS0= +google.golang.org/genproto/googleapis/rpc v0.0.0-20231002182017-d307bd883b97/go.mod h1:v7nGkzlmW8P3n/bKmWBn2WpBjpOEx8Q6gMueudAmKfY= +google.golang.org/grpc v1.58.3 h1:BjnpXut1btbtgN/6sp+brB2Kbm2LjNXnidYujAVbSoQ= +google.golang.org/grpc v1.58.3/go.mod h1:tgX3ZQDlNJGU96V6yHh1T/JeoBQ2TXdr43YbYSsCJk0= +google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= +google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= +google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=