diff --git a/.github/actions/setup-deps/action.yml b/.github/actions/setup-deps/action.yml deleted file mode 100644 index 801db15d3e030..0000000000000 --- a/.github/actions/setup-deps/action.yml +++ /dev/null @@ -1,64 +0,0 @@ -name: "Turborepo CI Setup" -description: "Sets up everything for CI" -inputs: - github-token: - description: "Github token. You can pass secrets.GITHUB_TOKEN" - required: true - setup-node: - description: "Set to false to prevent Node setup steps" - required: false - default: true - go-version: - description: "Change Go version" - required: false - default: "1.18" -runs: - using: "composite" - steps: - - name: Set up Go - uses: actions/setup-go@v3 - with: - go-version: ${{ inputs.go-version }} - cache: true - cache-dependency-path: cli/go.sum - - - name: Set Up Protoc - uses: arduino/setup-protoc@v1 - with: - version: "3.x" - repo-token: ${{ inputs.github-token }} - - - name: Set Up GRPC protobuf - shell: bash - run: | - go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.28.0 - go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.2.0 - - # Setup Node things - - name: Setup pnpm - uses: pnpm/action-setup@v2.2.2 - if: ${{ inputs.setup-node == 'true' }} - with: - version: 7.2.1 - - - name: Setup Node.js - uses: actions/setup-node@v2 - if: ${{ inputs.setup-node == 'true' }} - with: - node-version: 16 - cache: pnpm - - - name: Configure corepack - if: ${{ inputs.setup-node == 'true' }} - # Forcibly upgrade our available version of corepack. - # The bundled version in node 16 has known issues. - # Prepends the corepack bin dir so that it is always first. - shell: bash - run: | - npm install --force --global corepack@latest - npm config get prefix >> $GITHUB_PATH - corepack enable - - - run: pnpm install - shell: bash - if: ${{ inputs.setup-node == 'true' }} diff --git a/.github/actions/setup-go/action.yml b/.github/actions/setup-go/action.yml new file mode 100644 index 0000000000000..c991714eb0638 --- /dev/null +++ b/.github/actions/setup-go/action.yml @@ -0,0 +1,31 @@ +name: "Turborepo Go Setup" +description: "Sets Go up for CI" +inputs: + github-token: + description: "GitHub token. You can pass secrets.GITHUB_TOKEN" + required: true + go-version: + description: "Change Go version" + required: false + default: "1.18" +runs: + using: "composite" + steps: + - name: Set up Go + uses: actions/setup-go@v3 + with: + go-version: ${{ inputs.go-version }} + cache: true + cache-dependency-path: cli/go.sum + + - name: Set Up Protoc + uses: arduino/setup-protoc@v1 + with: + version: "3.x" + repo-token: ${{ inputs.github-token }} + + - name: Set Up GRPC protobuf + shell: bash + run: | + go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.28.0 + go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.2.0 diff --git a/.github/actions/setup-node/action.yml b/.github/actions/setup-node/action.yml new file mode 100644 index 0000000000000..a7143c1c4c022 --- /dev/null +++ b/.github/actions/setup-node/action.yml @@ -0,0 +1,40 @@ +name: "Turborepo Node.js Setup" +description: "Sets Node.js up for CI" +inputs: + enable-corepack: + description: "Control turning on corepack." + required: false + default: true +runs: + using: "composite" + steps: + - name: Setup pnpm + uses: pnpm/action-setup@v2.2.2 + with: + version: 7.2.1 + + - name: Setup Node.js + uses: actions/setup-node@v2 + with: + node-version: 16 + cache: pnpm + + - name: Configure corepack + # Forcibly upgrade our available version of corepack. + # The bundled version in node 16 has known issues. + # Prepends the npm bin dir so that it is always first. + shell: bash + run: | + npm install --force --global corepack@latest + npm config get prefix >> $GITHUB_PATH + corepack enable + + - name: Enable corepack + if: ${{ inputs.enable-corepack == 'true' }} + shell: bash + run: | + corepack enable + + - name: pnpm install + shell: bash + run: pnpm install diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index f669d4472760a..fda33da2b39e7 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -18,30 +18,14 @@ jobs: steps: - uses: actions/checkout@v3 - with: - fetch-depth: 2 - - - uses: ./.github/actions/setup-deps + - uses: ./.github/actions/setup-node + - uses: ./.github/actions/setup-go with: github-token: "${{ secrets.GITHUB_TOKEN }}" - setup-node: false # TODO: does this need to be customized in this workflow? - - - uses: pnpm/action-setup@v2.2.2 - with: - version: 7.2.1 - - - name: Setup Node.js environment - uses: actions/setup-node@v2 - with: - node-version: 16 - cache: pnpm - name: Build run: cd cli && make turbo - - name: Install dependencies - run: pnpm install --filter=benchmark - - name: Download previous benchmark results # continue on error so that we handle the bootstrap case where there is no previous data continue-on-error: true diff --git a/.github/workflows/pr-go-e2e.yml b/.github/workflows/pr-go-e2e.yml index d29fa7cb395ba..52f2e33f3f03d 100644 --- a/.github/workflows/pr-go-e2e.yml +++ b/.github/workflows/pr-go-e2e.yml @@ -1,8 +1,5 @@ name: CLI E2E tests -env: - NPM_TOKEN: ${{ secrets.NPM_TOKEN }} - concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true @@ -24,10 +21,8 @@ jobs: steps: - uses: actions/checkout@v3 - with: - fetch-depth: 2 - - - uses: ./.github/actions/setup-deps + - uses: ./.github/actions/setup-node + - uses: ./.github/actions/setup-go with: github-token: "${{ secrets.GITHUB_TOKEN }}" diff --git a/.github/workflows/pr-go-lint.yml b/.github/workflows/pr-go-lint.yml index eb70707953af3..ca3781a2d31dc 100644 --- a/.github/workflows/pr-go-lint.yml +++ b/.github/workflows/pr-go-lint.yml @@ -4,9 +4,6 @@ concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true -env: - NPM_TOKEN: ${{ secrets.NPM_TOKEN }} - on: pull_request: types: [opened, edited, synchronize] @@ -20,13 +17,10 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 + - uses: ./.github/actions/setup-go with: - fetch-depth: 2 - - - uses: ./.github/actions/setup-deps - with: + go-version: 1.17 github-token: "${{ secrets.GITHUB_TOKEN }}" - setup-node: false - name: Setup Protos run: cd cli && make compile-protos diff --git a/.github/workflows/pr-go-run-examples.yml b/.github/workflows/pr-go-run-examples.yml index 4b74d763eba7c..a6e7cdd2f4fea 100644 --- a/.github/workflows/pr-go-run-examples.yml +++ b/.github/workflows/pr-go-run-examples.yml @@ -1,8 +1,5 @@ name: CLI Run Examples -env: - NPM_TOKEN: ${{ secrets.NPM_TOKEN }} - concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true @@ -34,7 +31,6 @@ jobs: runs-on: ${{ matrix.os }} steps: - # TODO: what is this for? The other Go workflows don't need it - name: Install Sponge shell: bash run: | @@ -45,19 +41,15 @@ jobs: fi - uses: actions/checkout@v3 - with: - fetch-depth: 2 - - uses: ./.github/actions/setup-deps + - uses: ./.github/actions/setup-go with: github-token: "${{ secrets.GITHUB_TOKEN }}" - setup-node: false # TODO: Does this need to be customized in this workflow? - uses: pnpm/action-setup@v2.2.2 with: version: 7.2.1 - # TODO: Is this necessary? The other Go jobs don't include this - name: Make sure pnpm always has a cache shell: bash run: | diff --git a/.github/workflows/pr-go-unit.yml b/.github/workflows/pr-go-unit.yml index 9b7305f313a17..6e44112bf845f 100644 --- a/.github/workflows/pr-go-unit.yml +++ b/.github/workflows/pr-go-unit.yml @@ -1,8 +1,5 @@ name: CLI Unit Tests -env: - NPM_TOKEN: ${{ secrets.NPM_TOKEN }} - concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true @@ -24,10 +21,8 @@ jobs: steps: - uses: actions/checkout@v3 - with: - fetch-depth: 2 - - - uses: ./.github/actions/setup-deps + - uses: ./.github/actions/setup-node + - uses: ./.github/actions/setup-go with: github-token: "${{ secrets.GITHUB_TOKEN }}" diff --git a/.github/workflows/pr-js-lint.yml b/.github/workflows/pr-js-lint.yml index 6a2ff9e63e9ce..33ab7de8b38f8 100644 --- a/.github/workflows/pr-js-lint.yml +++ b/.github/workflows/pr-js-lint.yml @@ -4,9 +4,6 @@ concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true -env: - NPM_TOKEN: ${{ secrets.NPM_TOKEN }} - on: push: branches: ["main"] @@ -28,10 +25,8 @@ jobs: steps: - uses: actions/checkout@v3 - with: - fetch-depth: 2 - - - uses: ./.github/actions/setup-deps + - uses: ./.github/actions/setup-node + - uses: ./.github/actions/setup-go with: github-token: "${{ secrets.GITHUB_TOKEN }}" diff --git a/.github/workflows/pr-js-tests.yml b/.github/workflows/pr-js-tests.yml index 4bb0c7e9da7e4..815319fc67624 100644 --- a/.github/workflows/pr-js-tests.yml +++ b/.github/workflows/pr-js-tests.yml @@ -4,9 +4,6 @@ concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true -env: - NPM_TOKEN: ${{ secrets.NPM_TOKEN }} - on: push: branches: ["main"] @@ -28,10 +25,8 @@ jobs: steps: - uses: actions/checkout@v3 - with: - fetch-depth: 2 - - - uses: ./.github/actions/setup-deps + - uses: ./.github/actions/setup-node + - uses: ./.github/actions/setup-go with: github-token: "${{ secrets.GITHUB_TOKEN }}" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b94853414eace..36200759990fe 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -33,13 +33,13 @@ jobs: steps: - uses: actions/checkout@v3 with: - fetch-depth: 2 token: ${{ secrets.TURBOBOT }} - - - uses: ./.github/actions/setup-deps + - uses: ./.github/actions/setup-node + with: + enable-corepack: false + - uses: ./.github/actions/setup-go with: github-token: "${{ secrets.GITHUB_TOKEN }}" - setup-node: false # TODO: does this need to be customized? (corepack step is omitted here) - name: golangci-lint uses: golangci/golangci-lint-action@v3 @@ -54,20 +54,6 @@ jobs: # We ignore the output of this run, instead using it just to install the binary. args: --issues-exit-code=0 - - uses: pnpm/action-setup@v2.2.2 - with: - version: 7.2.1 - - - name: Setup Node.js environment - uses: actions/setup-node@v3 - with: - node-version: 16 - registry-url: 'https://registry.npmjs.org' - cache: pnpm - - - name: Install dependencies - run: pnpm install --filter=turbo-monorepo - - name: Configure git run: | git config --global user.name 'Turbobot'