Skip to content

Commit

Permalink
Upgrade download and upload github actions to v4 (#7069)
Browse files Browse the repository at this point in the history
  • Loading branch information
ferhoyos committed Jan 31, 2024
1 parent 239e21c commit a918a59
Show file tree
Hide file tree
Showing 9 changed files with 300 additions and 301 deletions.
88 changes: 44 additions & 44 deletions .github/workflows/build-backend.yml
Expand Up @@ -11,47 +11,47 @@ jobs:
name: Build and unit test backend
runs-on: ubuntu-20.04
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ inputs.build_branch }}
- name: Determine go version
id: go_version
run: |
GO_VERSION=$(sed -rn 's/^GO_VERSION_KIALI \= (.*)/\1/p' Makefile)
# Remove any pre release identifier (ie: "-SNAPSHOT")
GO_VERSION=${GO_VERSION%-*}
echo $GO_VERSION
echo "go_version=$GO_VERSION" >> $GITHUB_ENV
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.go_version }}
cache: true
cache-dependency-path: go.sum
- name: Lint Install
run: make lint-install

- name: Verify code linting
run: make lint

- name: Build
run: make -e GO_BUILD_FLAGS=${{ env.GO_BUILD_FLAGS }} -e CGO_ENABLED=${{ env.CGO_ENABLED }} clean-all build
env:
# Build with -race flag if this is a PR, otherwise it is a release and
# we don't want to build with race detection because of the perf penalty.
GO_BUILD_FLAGS: ${{ github.base_ref && '-race' }}
# The -race flag requires CGO_ENABLED
CGO_ENABLED: ${{ github.base_ref && '1' }}

- name: Test backend
run: make -e GO_TEST_FLAGS="-race" test

- name: Upload go binary
uses: actions/upload-artifact@v3
with:
name: kiali
path: ~/go/bin/kiali
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ inputs.build_branch }}

- name: Determine go version
id: go_version
run: |
GO_VERSION=$(sed -rn 's/^GO_VERSION_KIALI \= (.*)/\1/p' Makefile)
# Remove any pre release identifier (ie: "-SNAPSHOT")
GO_VERSION=${GO_VERSION%-*}
echo $GO_VERSION
echo "go_version=$GO_VERSION" >> $GITHUB_ENV
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.go_version }}
cache: true
cache-dependency-path: go.sum
- name: Lint Install
run: make lint-install

- name: Verify code linting
run: make lint

- name: Build
run: make -e GO_BUILD_FLAGS=${{ env.GO_BUILD_FLAGS }} -e CGO_ENABLED=${{ env.CGO_ENABLED }} clean-all build
env:
# Build with -race flag if this is a PR, otherwise it is a release and
# we don't want to build with race detection because of the perf penalty.
GO_BUILD_FLAGS: ${{ github.base_ref && '-race' }}
# The -race flag requires CGO_ENABLED
CGO_ENABLED: ${{ github.base_ref && '1' }}

- name: Test backend
run: make -e GO_TEST_FLAGS="-race" test

- name: Upload go binary
uses: actions/upload-artifact@v4
with:
name: kiali
path: ~/go/bin/kiali
44 changes: 22 additions & 22 deletions .github/workflows/build-frontend.yml
Expand Up @@ -15,29 +15,29 @@ jobs:
name: Build and unit test frontend
runs-on: ubuntu-20.04
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ inputs.build_branch }}
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ inputs.build_branch }}

- name: Setup node
uses: actions/setup-node@v4
with:
node-version: "18"
cache: yarn
cache-dependency-path: frontend/yarn.lock
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: "18"
cache: yarn
cache-dependency-path: frontend/yarn.lock

- name: Build
run: make clean-all build-ui
- name: Build
run: make clean-all build-ui

- name: Test frontend
run: |
cd frontend
yarn pretty-quick --check --verbose --branch ${{ inputs.target_branch }}
yarn test
- name: Test frontend
run: |
cd frontend
yarn pretty-quick --check --verbose --branch ${{ inputs.target_branch }}
yarn test
- name: Upload frontend build
uses: actions/upload-artifact@v3
with:
name: build
path: frontend/build/
- name: Upload frontend build
uses: actions/upload-artifact@v4
with:
name: build
path: frontend/build/
74 changes: 37 additions & 37 deletions .github/workflows/integration-tests-backend.yml
Expand Up @@ -22,47 +22,47 @@ jobs:
name: Backend API integration tests
runs-on: ubuntu-20.04
steps:
- name: Check out code
uses: actions/checkout@v4
with:
ref: ${{ inputs.build_branch }}
- name: Check out code
uses: actions/checkout@v4
with:
ref: ${{ inputs.build_branch }}

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
# The builtin cache feature ensures that installing golangci-lint
# is consistently fast.
cache: true
cache-dependency-path: go.sum
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
# The builtin cache feature ensures that installing golangci-lint
# is consistently fast.
cache: true
cache-dependency-path: go.sum

- name: Download go binary
uses: actions/download-artifact@v3
with:
name: kiali
path: ~/go/bin/
- name: Download go binary
uses: actions/download-artifact@v4
with:
name: kiali
path: ~/go/bin/

- name: Ensure kiali binary is executable
run: chmod +x ~/go/bin/kiali
- name: Ensure kiali binary is executable
run: chmod +x ~/go/bin/kiali

- name: Download frontend build
uses: actions/download-artifact@v3
with:
name: build
path: frontend/build
- name: Download frontend build
uses: actions/download-artifact@v4
with:
name: build
path: frontend/build

- name: Run backend integration tests
run: hack/run-integration-tests.sh --test-suite backend $(if [ -n "${{ inputs.istio_version }}" ]; then echo "--istio-version ${{ inputs.istio_version }}"; fi)
- name: Run backend integration tests
run: hack/run-integration-tests.sh --test-suite backend $(if [ -n "${{ inputs.istio_version }}" ]; then echo "--istio-version ${{ inputs.istio_version }}"; fi)

- name: Get debug info when integration tests fail
if: failure()
run: |
mkdir debug-output
hack/ci-get-debug-info.sh --output-directory debug-output
- name: Get debug info when integration tests fail
if: failure()
run: |
mkdir debug-output
hack/ci-get-debug-info.sh --output-directory debug-output
- name: Upload debug info artifact
if: failure()
uses: actions/upload-artifact@v3
with:
name: debug-info
path: debug-output
- name: Upload debug info artifact
if: failure()
uses: actions/upload-artifact@v4
with:
name: debug-info
path: debug-output
Expand Up @@ -28,57 +28,57 @@ jobs:
# avoid warnings like "tput: No value for $TERM and no -T specified"
TERM: xterm
steps:
- name: Check out code
uses: actions/checkout@v4
with:
ref: ${{ inputs.build_branch }}
- name: Check out code
uses: actions/checkout@v4
with:
ref: ${{ inputs.build_branch }}

- name: Setup node
uses: actions/setup-node@v4
with:
node-version: "18"
cache: yarn
cache-dependency-path: frontend/yarn.lock
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: "18"
cache: yarn
cache-dependency-path: frontend/yarn.lock

- name: Download go binary
uses: actions/download-artifact@v3
with:
name: kiali
path: ~/go/bin/
- name: Download go binary
uses: actions/download-artifact@v4
with:
name: kiali
path: ~/go/bin/

- name: Ensure kiali binary is executable
run: chmod +x ~/go/bin/kiali
- name: Ensure kiali binary is executable
run: chmod +x ~/go/bin/kiali

- name: Download frontend build
uses: actions/download-artifact@v3
with:
name: build
path: frontend/build
- name: Download frontend build
uses: actions/download-artifact@v4
with:
name: build
path: frontend/build

# Need to install frontend dependencies to run cypress tests.
- name: Install frontend dependencies
working-directory: ./frontend
run: yarn install --frozen-lockfile
# Need to install frontend dependencies to run cypress tests.
- name: Install frontend dependencies
working-directory: ./frontend
run: yarn install --frozen-lockfile

- name: Run frontend multi-cluster integration tests
run: hack/run-integration-tests.sh --test-suite frontend-multi-primary $(if [ -n "${{ inputs.istio_version }}" ]; then echo "--istio-version ${{ inputs.istio_version }}"; fi)
- name: Run frontend multi-cluster integration tests
run: hack/run-integration-tests.sh --test-suite frontend-multi-primary $(if [ -n "${{ inputs.istio_version }}" ]; then echo "--istio-version ${{ inputs.istio_version }}"; fi)

- name: Get debug info when integration tests fail
if: failure()
run: |
mkdir debug-output
hack/ci-get-debug-info.sh --output-directory debug-output --kubectl-context kind-east
- name: Get debug info when integration tests fail
if: failure()
run: |
mkdir debug-output
hack/ci-get-debug-info.sh --output-directory debug-output --kubectl-context kind-east
- name: Upload debug info artifact
if: failure()
uses: actions/upload-artifact@v3
with:
name: debug-info
path: debug-output
- name: Upload debug info artifact
if: failure()
uses: actions/upload-artifact@v4
with:
name: debug-info
path: debug-output

- name: Upload cypress screenshots when tests fail
uses: actions/upload-artifact@v3
if: failure()
with:
name: cypress-screenshots
path: frontend/cypress/screenshots
- name: Upload cypress screenshots when tests fail
uses: actions/upload-artifact@v4
if: failure()
with:
name: cypress-screenshots
path: frontend/cypress/screenshots

0 comments on commit a918a59

Please sign in to comment.