Skip to content

[pull] master from chaos-mesh:master #1330

[pull] master from chaos-mesh:master

[pull] master from chaos-mesh:master #1330

Workflow file for this run

# This workflow defines the go and ui related jobs.
#
# First, we use [dorny/paths-filter@v3](https://github.com/dorny/paths-filter) to
# detect changes in go and ui related files, and then run the corresponding sub-jobs
# based on the changes.
#
# Please note that due to the GitHub required checks, the `go` and `ui` jobs
# also need to run to report the status. So here we need to define an additional
# "skip" file to ensure that the status is reported. For details, please refer to:
#
# - `ci_skip.yml`
# - https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/defining-the-mergeability-of-pull-requests/troubleshooting-required-status-checks#handling-skipped-but-required-checks
name: ci
on:
pull_request:
branches:
- master
- release-*
permissions: read-all
jobs:
# JOB to run change detection
changes:
runs-on: ubuntu-20.04
# Set job outputs to values from filter step
outputs:
go: ${{ steps.filter.outputs.go }}
ui: ${{ steps.filter.outputs.ui }}
steps:
# For pull requests it's not necessary to checkout the code
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
go:
- Makefile
- go.*
- '**.go'
- 'helm/**'
ui:
- 'ui/pnpm-lock.yaml'
- '**.js'
- '**.ts?(x)'
go:
needs: changes
if: ${{ needs.changes.outputs.go == 'true' }}
strategy:
fail-fast: false
matrix:
arch: [amd64, arm64]
job:
- verify
- build
- test
runs-on: ${{ fromJson('{"amd64":"ubuntu-20.04", "arm64":["self-hosted", "Linux", "ARM64"]}')[matrix.arch] }}
steps:
- uses: actions/checkout@v4
- name: Build Chaos Mesh Build Env
env:
IMAGE_BUILD_ENV_BUILD: ${{ contains(github.event.pull_request.labels.*.name, 'rebuild-build-env-image') }}
run: |
if [ "${IMAGE_BUILD_ENV_BUILD}" = "true" ] ; then
export IMAGE_BUILD_ENV_BUILD=1;
else
export IMAGE_BUILD_ENV_BUILD=0;
fi
make image-build-env
- name: Build Chaos Mesh Dev Env
env:
IMAGE_DEV_ENV_BUILD: ${{ contains(github.event.pull_request.labels.*.name, 'rebuild-dev-env-image') }}
run: |
if [ "${IMAGE_DEV_ENV_BUILD}" = "true" ] ; then
export IMAGE_DEV_ENV_BUILD=1;
else
export IMAGE_DEV_ENV_BUILD=0;
fi
make image-dev-env
- name: ${{ matrix.job }}
env:
job: ${{ matrix.job }}
run: |
if [[ "$job" == "verify" ]]; then
make check
echo "Please run [make check] before creating a PR"
git diff --quiet
elif [[ "$job" == "build" ]]; then
make image
elif [[ "$job" == "test" ]]; then
make test
else
make $job
fi
- name: Upload Code Coverage
uses: codecov/codecov-action@v3
if: matrix.job == 'test'
with:
files: ./cover.out
ui:
needs: changes
if: ${{ needs.changes.outputs.ui == 'true' }}
defaults:
run:
working-directory: ./ui
strategy:
matrix:
job:
- build
- test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v2
with:
version: 9
- uses: actions/setup-node@v4
with:
node-version: 20
cache: "pnpm"
cache-dependency-path: "ui/pnpm-lock.yaml"
- run: pnpm install --frozen-lockfile
- name: Cache app/build
if: ${{ matrix.job == 'build' }}
uses: actions/cache@v2
with:
path: ./ui/app/build
key: ${{ runner.os }}-pnpm-${{ hashFiles('ui/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-
- name: Build app
if: ${{ matrix.job == 'build' }}
run: pnpm build
- name: Run tests
if: ${{ matrix.job == 'test' }}
run: pnpm test