From 50735dca2e0ac363b71e3125dcbcdd438e84b86b Mon Sep 17 00:00:00 2001 From: pygrum Date: Wed, 27 Dec 2023 17:38:01 +0000 Subject: [PATCH] only run checks if files in relevant folders are changed --- .github/workflows/build.yml | 23 +++++++++++++++++++++++ .github/workflows/test-deploy.yml | 16 ++++++++++++++++ 2 files changed, 39 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 66b02d4..bf2fc41 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -11,10 +11,20 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 + - uses: dorny/paths-filter@v2 + id: filter + with: + filters: | + sources: + - 'pkg/**' + - 'cmd/**' + - 'scripts/**' - uses: actions/setup-go@v4 + if: steps.filter.outputs.sources == 'true' with: go-version: 1.21 - name: Build all Monarch clients + if: steps.filter.outputs.sources == 'true' run: make linux macos windows build-test-monarch: @@ -26,19 +36,32 @@ jobs: - "./scripts/docker-install-monarch.sh" steps: - uses: actions/checkout@v3 + - uses: dorny/paths-filter@v2 + id: filter + with: + filters: | + sources: + - 'pkg/**' + - 'cmd/**' + - 'scripts/**' + - 'docker/monarch/**' - uses: actions/setup-go@v4 with: go-version: 1.21 - name: Install Monarch + if: steps.filter.outputs.sources == 'true' continue-on-error: false run: bash ${{ matrix.install_script }} - name: Setup Monarch Container + if: steps.filter.outputs.sources == 'true' continue-on-error: false run: docker build -t monarch -f docker/builder/Dockerfile . - name: Run Monarch tests + if: steps.filter.outputs.sources == 'true' run: go test ./... - name: Cleanup + if: steps.filter.outputs.sources == 'true' run: bash ./scripts/uninstall-monarch.sh diff --git a/.github/workflows/test-deploy.yml b/.github/workflows/test-deploy.yml index 85c13b9..9148d08 100644 --- a/.github/workflows/test-deploy.yml +++ b/.github/workflows/test-deploy.yml @@ -12,10 +12,22 @@ jobs: IMAGE_VERSION: latest # just for test steps: - uses: actions/checkout@v3 + - uses: dorny/paths-filter@v2 + id: filter + with: + filters: | + sources: + - 'pkg/**' + - 'cmd/**' + - 'scripts/**' + - 'docker/builder/**' + python: + - 'python/**' - name: Set up Buildx uses: docker/setup-buildx-action@v3 - name: Login to Docker Hub + if: steps.filter.outputs.sources == 'true' uses: docker/login-action@v3 with: username: ${{ secrets.DOCKERHUB_USERNAME }} @@ -23,6 +35,7 @@ jobs: - name: Push uses: docker/build-push-action@v3 + if: steps.filter.outputs.sources == 'true' with: context: . push: false @@ -31,9 +44,12 @@ jobs: - name: Install python package uses: actions/setup-python@v4 + if: steps.filter.outputs.python == 'true' continue-on-error: false - name: upgrade pip packages + if: steps.filter.outputs.python == 'true' run: python3 -m pip install --user --upgrade setuptools wheel twine - name: setup distribution + if: steps.filter.outputs.python == 'true' run: python3 python/setup.py sdist bdist_wheel