Run workflows depending on changed files #440
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This file is not auto-generated. Feel free to edit it. | |
name: ✨ Pull Request | |
on: | |
push: | |
branches: | |
- develop | |
pull_request: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
permissions: | |
contents: read # Read-only access to repository contents | |
issues: write # Write access to issues | |
pull-requests: write # Write access to pull requests | |
statuses: write # Write access to commit statuses | |
checks: write | |
jobs: | |
gui-changed-files: | |
runs-on: ubuntu-latest | |
name: 🔍 GUI files changed | |
outputs: | |
all_changed_files: ${{ steps.gui-changed-files.outputs.all_changed_files }} | |
any_changed: ${{ steps.gui-changed-files.outputs.any_changed }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 2 | |
- name: Get changed files | |
id: gui-changed-files | |
uses: tj-actions/changed-files@v45 | |
with: | |
files: | | |
app/** | |
package.json | |
pnpm-lock.yaml | |
pnpm-workspace.yaml | |
eslint.config.js | |
.prettierrc.js | |
.prettierignore | |
vitest.workspace.ts | |
.github/workflows/gui* | |
files_ignore: | | |
app/ide-desktop/** | |
app/gui/scripts/** | |
app/gui/.gitignore | |
.git-* | |
- name: List all changed files | |
env: | |
ALL_CHANGED_FILES: ${{ steps.gui-changed-files.outputs.all_changed_files }} | |
run: | | |
for file in ${ALL_CHANGED_FILES}; do | |
echo "$file was changed" | |
done | |
wasm-changed-files: | |
runs-on: ubuntu-latest | |
name: 🔍 WASM files changed | |
outputs: | |
all_changed_files: ${{ steps.wasm-changed-files.outputs.all_changed_files }} | |
any_changed: ${{ steps.wasm-changed-files.outputs.any_changed }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 2 | |
- name: Get changed files | |
id: wasm-changed-files | |
uses: tj-actions/changed-files@v45 | |
with: | |
files: | | |
.cargo/** | |
app/rust-ffi/**, | |
build/**, | |
lib/rust/**", | |
tools/language-server/logstat/**", | |
tools/language-server/wstest/**", | |
Cargo.lock, | |
Cargo.toml, | |
rust-toolchain.toml, | |
rustfmt.toml | |
- name: List all changed files | |
env: | |
ALL_CHANGED_FILES: ${{ steps.wasm-changed-files.outputs.all_changed_files }} | |
run: | | |
for file in ${ALL_CHANGED_FILES}; do | |
echo "$file was changed" | |
done | |
engine-changed-files: | |
runs-on: ubuntu-latest | |
name: 🔍 Engine files changed | |
outputs: | |
all_changed_files: ${{ steps.engine-changed-files.outputs.all_changed_files }} | |
any_changed: ${{ steps.engine-changed-files.outputs.any_changed }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 2 | |
- name: Get changed files | |
id: engine-changed-files | |
uses: tj-actions/changed-files@v45 | |
with: | |
files: | | |
distribution/** | |
engine/** | |
lib/** | |
project/** | |
std-bits/** | |
test/** | |
build.sbt | |
.cargo/** | |
Cargo.lock, | |
Cargo.toml, | |
rust-toolchain.toml, | |
- name: List all changed files | |
env: | |
ALL_CHANGED_FILES: ${{ steps.engine-changed-files.outputs.all_changed_files }} | |
run: | | |
for file in ${ALL_CHANGED_FILES}; do | |
echo "$file was changed" | |
done | |
gui-checks: | |
name: 🧰 GUI Checks | |
uses: ./.github/workflows/gui-checks.yml | |
needs: [gui-changed-files] | |
if: ${{ needs.gui-changed-files.outputs.any_changed == 'true' }} | |
secrets: inherit | |
wasm-checks: | |
name: 🧰 WASM Checks | |
uses: ./.github/workflows/gui-tests.yml | |
needs: [wasm-changed-files] | |
if: ${{ needs.wasm-changed-files.outputs.any_changed == 'true' }} | |
secrets: inherit | |
engine-checks: | |
name: 🧰 Engine Checks | |
uses: ./.github/workflows/scala-new.yml | |
needs: [engine-changed-files] | |
if: ${{ needs.engine-changed-files.outputs.any_changed == 'true' }} | |
secrets: inherit | |
gui-packaging: | |
name: 🧰 GUI Packaging | |
uses: ./.github/workflows/gui.yml | |
needs: [gui-changed-files, wasm-changed-files, engine-changed-files] | |
if: ${{ needs.gui-changed-files.outputs.any_changed == 'true' || needs.wasm-changed-files.outputs.any_changed == 'true' || needs.engine-changed-files.outputs.any_changed == 'true' }} | |
secrets: inherit | |
storybook: | |
name: 📚 Deploy Storybook | |
uses: ./.github/workflows/storybook.yml | |
needs: [gui-changed-files] | |
if: ${{ needs.gui-changed-files.outputs.any_changed == 'true' }} | |
secrets: inherit | |
# This job is used to report success if the needed jobs were successful. | |
# This is a workaround to make optional jobs required if they run | |
gui-report: | |
name: GUI Checks Report | |
runs-on: ubuntu-latest | |
needs: [gui-checks, storybook] | |
if: always() | |
steps: | |
- name: GUI Report | |
run: | | |
echo "Checks: ${{ needs.gui-checks.result }}" | |
echo "Storybook: ${{ needs.storybook.result }}" | |
if [[ "${{ needs.gui-checks.result }}" == "failure" || "${{ needs.storybook.result }}" == "failure" ]]; then | |
exit 1 | |
fi | |
echo "Success!" | |
wasm-report: | |
name: WASM Checks Report | |
runs-on: ubuntu-latest | |
needs: [wasm-checks] | |
if: always() | |
steps: | |
- name: WASM Report | |
run: | | |
echo "Checks: ${{ needs.wasm-checks.result }}" | |
if [[ "${{ needs.wasm-checks.result }}" == "failure" ]]; then | |
exit 1 | |
fi | |
echo "Success!" | |
engine-report: | |
name: Engine Checks Report | |
runs-on: ubuntu-latest | |
needs: [engine-checks] | |
if: always() | |
steps: | |
- name: Engine Report | |
run: | | |
echo "Checks: ${{ needs.engine-checks.result }}" | |
if [[ "${{ needs.engine-checks.result }}" == "failure" ]]; then | |
exit 1 | |
fi | |
echo "Success!" | |
gui-packaging-report: | |
name: GUI Packaging Report | |
runs-on: ubuntu-latest | |
needs: [gui-packaging] | |
if: always() | |
steps: | |
- name: GUI Packaging Report | |
run: | | |
echo "Checks: ${{ needs.gui-packaging.result }}" | |
if [[ "${{ needs.gui-packaging.result }}" == "failure" ]]; then | |
exit 1 | |
fi | |
echo "Success!" |