From 1fc3b0bfae81e2f30e6203fc9dc3c970dd0b2c54 Mon Sep 17 00:00:00 2001 From: Lucas Nogueira Date: Tue, 23 May 2023 12:32:23 -0300 Subject: [PATCH] feat: add CI to check if file was rebuilt --- .github/workflows/check-generate-files.yml | 129 +++++++++++++++++++++ .scripts/ci/has-diff.sh | 9 ++ 2 files changed, 138 insertions(+) create mode 100644 .github/workflows/check-generate-files.yml create mode 100755 .scripts/ci/has-diff.sh diff --git a/.github/workflows/check-generate-files.yml b/.github/workflows/check-generate-files.yml new file mode 100644 index 00000000..7d16a1e3 --- /dev/null +++ b/.github/workflows/check-generate-files.yml @@ -0,0 +1,129 @@ +# Copyright 2019-2023 Tauri Programme within The Commons Conservancy +# SPDX-License-Identifier: Apache-2.0 +# SPDX-License-Identifier: MIT + +name: check generated files + +on: + pull_request: + paths: + - ".github/workflows/check-generated-files.yml" + - "**/guest-js/**" + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + changes: + runs-on: ubuntu-latest + outputs: + packages: ${{ steps.filter.outputs.changes }} + steps: + - uses: actions/checkout@v3 + - uses: dorny/paths-filter@v2 + id: filter + with: + filters: | + app: + .github/workflows/check-generated-files.yml + - plugins/app/guest-js/** + authenticator: + .github/workflows/check-generated-files.yml + - plugins/authenticator/guest-js/** + autostart: + .github/workflows/check-generated-files.yml + - plugins/autostart/guest-js/** + cli: + .github/workflows/check-generated-files.yml + - plugins/cli/guest-js/** + clipboard: + .github/workflows/check-generated-files.yml + - plugins/clipboard/guest-js/** + dialog: + .github/workflows/check-generated-files.yml + - plugins/dialog/guest-js/** + - plugins/fs/guest-js/** + fs: + .github/workflows/check-generated-files.yml + - plugins/fs/guest-js/** + global-shortcut: + .github/workflows/check-generated-files.yml + - plugins/global-shortcut/guest-js/** + http: + .github/workflows/check-generated-files.yml + - plugins/http/guest-js/** + - plugins/fs/guest-js/** + localhost: + .github/workflows/check-generated-files.yml + - plugins/localhost/guest-js/** + log: + .github/workflows/check-generated-files.yml + - plugins/log/guest-js/** + notification: + .github/workflows/check-generated-files.yml + - plugins/notification/guest-js/** + os: + .github/workflows/check-generated-files.yml + - plugins/os/guest-js/** + persisted-scope: + .github/workflows/check-generated-files.yml + - plugins/persisted-scope/guest-js/** + - plugins/fs/guest-js/** + positioner: + .github/workflows/check-generated-files.yml + - plugins/positioner/guest-js/** + process: + .github/workflows/check-generated-files.yml + - plugins/process/guest-js/** + shell: + .github/workflows/check-generated-files.yml + - plugins/shell/guest-js/** + single-instance: + .github/workflows/check-generated-files.yml + - plugins/single-instance/guest-js/** + sql: + .github/workflows/check-generated-files.yml + - plugins/sql/guest-js/** + store: + .github/workflows/check-generated-files.yml + - plugins/store/guest-js/** + stronghold: + .github/workflows/check-generated-files.yml + - plugins/stronghold/guest-js/** + updater: + .github/workflows/check-generated-files.yml + - plugins/updater/guest-js/** + upload: + .github/workflows/check-generated-files.yml + - plugins/upload/guest-js/** + websocket: + .github/workflows/check-generated-files.yml + - plugins/websocket/guest-js/** + window: + .github/workflows/check-generated-files.yml + - plugins/window/guest-js/** + window-state: + .github/workflows/check-generated-files.yml + - plugins/window-state/guest-js/** + + test: + needs: changes + if: ${{ needs.changes.outputs.packages != '[]' && needs.changes.outputs.packages != '' }} + strategy: + fail-fast: false + matrix: + package: ${{ fromJSON(needs.changes.outputs.packages) }} + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + - name: build api + working-directory: plugins/${{ matrix.package }} + run: pnpm install && pnpm build + + - name: check diff + run: | + ./.scripts/ci/has-diff.sh diff --git a/.scripts/ci/has-diff.sh b/.scripts/ci/has-diff.sh new file mode 100755 index 00000000..dd40c06f --- /dev/null +++ b/.scripts/ci/has-diff.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +if git diff --quiet --ignore-submodules HEAD +then + echo "working directory is clean" +else + echo "found diff" + exit 1 +fi