Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update workflows and scripts #148

Merged
merged 7 commits into from
Aug 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .github/actions/build/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Build and Test
description: Runs build

runs:
using: "composite"
steps:
- name: Install pulumictl
uses: jaxxstorm/[email protected]
with:
repo: pulumi/pulumictl
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 18.x
registry-url: https://registry.npmjs.org
- name: Install Yarn
shell: bash
run: curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version 1.13.0
- name: Install packages
shell: bash
run: yarn install --frozen-lockfile
- name: Run build
shell: bash
run: yarn run build
- name: Run unit tests
shell: bash
run: yarn run test
20 changes: 20 additions & 0 deletions .github/actions/lint/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Lint
description: Runs lint

runs:
using: "composite"
steps:
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 18.x
registry-url: https://registry.npmjs.org
- name: Install Yarn
shell: bash
run: curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version 1.13.0
- name: Install packages
shell: bash
run: yarn install --frozen-lockfile
- name: Run lint
shell: bash
run: yarn run lint
100 changes: 73 additions & 27 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,33 @@ jobs:
steps:
- name: Checkout Repo
uses: actions/checkout@v4
- name: Unshallow clone for tags
run: git fetch --prune --unshallow --tags
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 18.19.x
registry-url: https://registry.npmjs.org
- name: Install Yarn
run: curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version 1.13.0
- name: Install packages
run: yarn install
- name: Run lint
run: yarn run lint
- name: lint
uses: ./.github/actions/lint

build:
name: Build and Test
runs-on: ubuntu-latest
concurrency: build-and-test # Currently integration tests can clash across branches.
steps:
- name: Checkout Repo
uses: actions/checkout@v4
- name: build
uses: ./.github/actions/build

test:
# Only run tests on the schedule event
# On 'push' we've just merged a PR that ran the tests
if: github.event_name == 'schedule'
name: acceptance-test
concurrency:
group: acceptance-test-${{ matrix.index }} # TODO: concurrent tests across PRs can cause problems
cancel-in-progress: false
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v4
# Needed for pulumictl to calculate version
- name: Unshallow clone for tags
run: git fetch --prune --unshallow --tags
- name: Install pulumictl
uses: jaxxstorm/[email protected]
with:
Expand All @@ -46,44 +53,83 @@ jobs:
role-duration-seconds: 3600
role-session-name: ${{ env.PROVIDER }}@githubActions
role-to-assume: ${{ secrets.AWS_CI_ROLE_ARN }}
- name: Unshallow clone for tags
run: git fetch --prune --unshallow --tags
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 18.19.x
node-version: 18.x
registry-url: https://registry.npmjs.org
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: 1.22.x
cache-dependency-path: examples/*.sum
- name: Install Yarn
run: curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version 1.13.0
- name: Install packages
run: yarn install
run: yarn install --frozen-lockfile
- name: Run build
run: yarn run build
- name: Run unit tests
run: yarn run test
run: yarn run prepare && yarn run build
- name: yarn link
run: pushd lib && yarn link && popd
run: yarn link
- name: set script-shell
run: yarn config set script-shell /bin/bash
- name: Set up gotestfmt
uses: GoTestTools/gotestfmt-action@v2
- name: Install gotestsum
run: go install gotest.tools/gotestsum@latest
- name: Go mod download
run: cd examples && go mod download
- name: Generate go test Slice
id: test_split
uses: hashicorp-forge/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
working-directory: examples
total: ${{ matrix.parallel }}
index: ${{ matrix.index }}
- name: Run examples
run: yarn run test-examples-gotestfmt
run: cd examples && gotestsum --format github-actions -- -v -count=1 -timeout 2h -parallel 4 -run "${{ steps.test_split.outputs.run }}"
strategy:
fail-fast: false
matrix:
parallel: [3]
index: [0, 1, 2]

release:
if: github.event_name == 'push'
name: Release
runs-on: ubuntu-latest
needs:
- build
- lint
steps:
- name: Checkout Repo
uses: actions/checkout@v4
# Needed for pulumictl to calculate version
- name: Unshallow clone for tags
run: git fetch --prune --unshallow --tags
- name: Install pulumictl
uses: jaxxstorm/[email protected]
with:
repo: pulumi/pulumictl
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 18.x
registry-url: https://registry.npmjs.org
- name: Install Yarn
run: curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version 1.13.0
- name: Install packages
run: yarn install --frozen-lockfile
- name: Run build
run: yarn run set-version && yarn run build
- if: github.event_name == 'push'
name: Publish Dev Package
uses: JS-DevTools/npm-publish@v1
with:
access: "public"
token: ${{ secrets.NPM_TOKEN }}
package: ${{github.workspace}}/lib/package.json
package: ${{github.workspace}}/package.json
tag: dev
check-version: true

name: main
"on":
schedule:
Expand Down
96 changes: 69 additions & 27 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,30 @@ jobs:
steps:
- name: Checkout Repo
uses: actions/checkout@v4
- name: Unshallow clone for tags
run: git fetch --prune --unshallow --tags
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 18.19.x
registry-url: https://registry.npmjs.org
- name: Install Yarn
run: curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version 1.13.0
- name: Install packages
run: yarn install
- name: Run lint
run: yarn run lint
- name: lint
uses: ./.github/actions/lint

build:
name: Build and Test
runs-on: ubuntu-latest
concurrency: build-and-test # Currently integration tests can clash across branches.
steps:
- name: Checkout Repo
uses: actions/checkout@v4
- name: build
uses: ./.github/actions/build

test:
name: acceptance-test
concurrency:
group: acceptance-test-${{ matrix.index }} # TODO: concurrent tests across PRs can cause problems
cancel-in-progress: false
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v4
# Needed for pulumictl to calculate version
- name: Unshallow clone for tags
run: git fetch --prune --unshallow --tags
- name: Install pulumictl
uses: jaxxstorm/[email protected]
corymhall marked this conversation as resolved.
Show resolved Hide resolved
with:
Expand All @@ -46,41 +50,79 @@ jobs:
role-duration-seconds: 3600
role-session-name: ${{ env.PROVIDER }}@githubActions
role-to-assume: ${{ secrets.AWS_CI_ROLE_ARN }}
- name: Unshallow clone for tags
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In some CIs that's part of computing the version and can trip up versioning.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just moved it up sooner.

run: git fetch --prune --unshallow --tags
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 18.19.x
node-version: 18.x
registry-url: https://registry.npmjs.org
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: 1.22.x
cache-dependency-path: examples/*.sum
- name: Install Yarn
run: curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version 1.13.0
- name: Install packages
run: yarn install
run: yarn install --frozen-lockfile
- name: Run build
run: yarn run build
- name: Run unit tests
run: yarn run test
run: yarn run prepare && yarn run build
- name: yarn link
run: pushd lib && yarn link && popd
run: yarn link
- name: set script-shell
run: yarn config set script-shell /bin/bash
- name: Set up gotestfmt
uses: haveyoudebuggedit/gotestfmt-action@v2
- name: Install gotestsum
run: go install gotest.tools/gotestsum@latest
- name: Go mod download
run: cd examples && go mod download
- name: Generate go test Slice
id: test_split
uses: hashicorp-forge/[email protected]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

with:
token: ${{ secrets.GITHUB_TOKEN }}
working-directory: examples
total: ${{ matrix.parallel }}
index: ${{ matrix.index }}
- name: Run examples
run: yarn run test-examples-gotestfmt
run: cd examples && gotestsum --format github-actions -- -v -count=1 -timeout 2h -parallel 4 -run "${{ steps.test_split.outputs.run }}"
strategy:
fail-fast: false
matrix:
parallel: [3]
index: [0, 1, 2]

release:
name: Release
runs-on: ubuntu-latest
needs:
- build
- test
- lint
steps:
- name: Checkout Repo
uses: actions/checkout@v4
# Needed for pulumictl to calculate version
- name: Unshallow clone for tags
run: git fetch --prune --unshallow --tags
- name: Install pulumictl
uses: jaxxstorm/[email protected]
with:
repo: pulumi/pulumictl
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 18.x
registry-url: https://registry.npmjs.org
- name: Install Yarn
run: curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version 1.13.0
- name: Install packages
run: yarn install --frozen-lockfile
- name: Run build
run: yarn run set-version && yarn run build
- name: Publish Dev Package
uses: JS-DevTools/npm-publish@v1
with:
access: "public"
token: ${{ secrets.NPM_TOKEN }}
package: ${{github.workspace}}/lib/package.json
package: ${{github.workspace}}/package.json
name: release
"on":
push:
Expand Down
Loading
Loading