Move normalization step into the dispatch flow (#6549) #4611
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
name: Build And Release On Push To Master | |
on: | |
push: | |
branches: [master] | |
jobs: | |
cache-pnpm-store: | |
name: Install everything with PNPM and cache it | |
secrets: inherit | |
uses: ./.github/workflows/cache-pnpm-install.yml | |
test-editor-code: | |
name: Test Editor - TypeScript, ESLint, dependency-cruiser | |
timeout-minutes: 15 | |
runs-on: ubuntu-latest | |
needs: [cache-pnpm-store] | |
env: | |
UTOPIA_SHA: ${{ github.sha }} | |
steps: | |
- name: Cancel existing runs on this branch | |
uses: fauguste/auto-cancellation-running-action@0.1.4 | |
with: | |
githubToken: ${{ secrets.GITHUB_TOKEN }} | |
- name: Check out the repo | |
uses: actions/checkout@v2 | |
- name: Cache editor test result | |
id: cache-editor-tests | |
uses: actions/cache@v2 | |
with: | |
# For the tests it doesn't really matter what we cache | |
path: editor/lib | |
key: ${{ runner.os }}-editor-code-tests-master-${{ hashFiles('editor/src/**') }}-${{ hashFiles('utopia-api/src/**') }}-${{ hashFiles('editor/package.json') }}-${{ hashFiles('utopia-api/package.json') }} | |
- name: Cache .pnpm-store | |
uses: actions/cache@v2 | |
with: | |
path: ${{ needs.cache-pnpm-store.outputs.pnpm-store-path }} | |
key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}-captured-location | |
- name: Install nix | |
uses: cachix/install-nix-action@v12 | |
with: | |
nix_path: nixpkgs=https://github.com/NixOS/nixpkgs/archive/6120ac5cd201f6cb593d1b80e861be0342495be9.tar.gz | |
- name: Run tsc, eslint, depdendency-cruiser and the website tests | |
if: steps.cache-editor-tests.outputs.cache-hit != 'true' | |
run: nix-shell --arg includeServerBuildSupport false --arg includeRunLocallySupport false --run check-editor-code-ci | |
test-editor-jest: | |
name: Test Editor - Jest tests | |
timeout-minutes: 15 | |
runs-on: ubuntu-latest | |
needs: [cache-pnpm-store] | |
env: | |
UTOPIA_SHA: ${{ github.sha }} | |
steps: | |
- name: Cancel existing runs on this branch | |
uses: fauguste/auto-cancellation-running-action@0.1.4 | |
with: | |
githubToken: ${{ secrets.GITHUB_TOKEN }} | |
- name: Check out the repo | |
uses: actions/checkout@v2 | |
- name: Cache editor test result | |
id: cache-editor-tests | |
uses: actions/cache@v2 | |
with: | |
# For the tests it doesn't really matter what we cache | |
path: editor/lib | |
key: ${{ runner.os }}-editor-jest-tests-master-${{ hashFiles('editor/src/**') }}-${{ hashFiles('utopia-api/src/**') }}-${{ hashFiles('editor/package.json') }}-${{ hashFiles('utopia-api/package.json') }} | |
- name: Cache .pnpm-store | |
uses: actions/cache@v2 | |
with: | |
path: ${{ needs.cache-pnpm-store.outputs.pnpm-store-path }} | |
key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}-captured-location | |
- name: Install nix | |
uses: cachix/install-nix-action@v12 | |
with: | |
nix_path: nixpkgs=https://github.com/NixOS/nixpkgs/archive/6120ac5cd201f6cb593d1b80e861be0342495be9.tar.gz | |
- name: Run the Jest tests | |
if: steps.cache-editor-tests.outputs.cache-hit != 'true' | |
run: nix-shell --arg includeServerBuildSupport false --arg includeRunLocallySupport false --run check-editor-jest-ci | |
call-test-editor-karma-shard-1: | |
name: Test Editor Shard 1 | |
needs: [cache-pnpm-store] | |
uses: ./.github/workflows/editor-sharded-tests.yml | |
secrets: inherit | |
with: | |
shard_number: 1 | |
branch: master | |
pnpm-store-path: ${{ needs.cache-pnpm-store.outputs.pnpm-store-path }} | |
call-test-editor-karma-shard-2: | |
name: Test Editor Shard 2 | |
needs: [cache-pnpm-store] | |
uses: ./.github/workflows/editor-sharded-tests.yml | |
secrets: inherit | |
with: | |
shard_number: 2 | |
branch: master | |
pnpm-store-path: ${{ needs.cache-pnpm-store.outputs.pnpm-store-path }} | |
test-server: | |
name: Test Server | |
timeout-minutes: 30 | |
runs-on: ubuntu-latest | |
env: | |
UTOPIA_SHA: ${{ github.sha }} | |
steps: | |
- name: Check out the repo | |
uses: actions/checkout@v2 | |
- name: Cache .cabal/packages | |
uses: actions/cache@v2 | |
with: | |
path: .cabal/packages | |
key: ${{ runner.os }}-${{ matrix.ghc }}-cabal-packages-2 | |
- name: Cache .cabal/store | |
uses: actions/cache@v2 | |
with: | |
path: .cabal/store | |
key: ${{ runner.os }}-${{ matrix.ghc }}-cabal-store-2 | |
- name: Cache dist-newstyle | |
uses: actions/cache@v2 | |
with: | |
path: server/dist-newstyle | |
key: ${{ runner.os }}-${{ matrix.ghc }}-server-dist-newstyle-2 | |
- name: Cache server test result | |
id: cache-server-tests | |
uses: actions/cache@v2 | |
with: | |
# For the tests it doesn't really matter what we cache | |
path: server/src | |
key: ${{ runner.os }}-server-tests-master-${{ hashFiles('server/src/**') }}-${{ hashFiles('server/test/**') }}-${{ hashFiles('server/cabal.project.freeze') }} | |
- name: Install nix | |
uses: cachix/install-nix-action@v12 | |
with: | |
nix_path: nixpkgs=https://github.com/NixOS/nixpkgs/archive/6120ac5cd201f6cb593d1b80e861be0342495be9.tar.gz | |
- name: Start PostgreSQL | |
run: nix-shell --arg includeEditorBuildSupport false --arg includeRunLocallySupport false --arg includeDatabaseSupport true --run start-postgres-background | |
- name: Run the tests | |
if: steps.cache-server-tests.outputs.cache-hit != 'true' | |
run: nix-shell --arg includeEditorBuildSupport false --arg includeRunLocallySupport false --run test-server-ci | |
trigger-deploy: | |
name: Trigger Deploy | |
timeout-minutes: 5 | |
needs: | |
[ | |
test-editor-code, | |
test-editor-jest, | |
call-test-editor-karma-shard-1, | |
call-test-editor-karma-shard-2, | |
test-server, | |
] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Use repository dispatch event to trigger deploy | |
uses: peter-evans/repository-dispatch@v1.1.0 | |
with: | |
token: ${{ secrets.DEPLOY_REPO_ACCESS_TOKEN }} | |
repository: concrete-utopia/utopia-deploy | |
event-type: trigger-deploy | |
post-failure-to-discord: | |
name: Post Failure Message To Discord | |
timeout-minutes: 5 | |
runs-on: ubuntu-latest | |
if: failure() | |
needs: [trigger-deploy] | |
steps: | |
- name: Discord Notification | |
uses: Ilshidur/action-discord@0.3.2 | |
env: | |
DISCORD_WEBHOOK: ${{ secrets.DISCORD_BUILD_WEBHOOK }} | |
DISCORD_USERNAME: 'Build Failure' | |
with: | |
args: 'Build failed: https://github.com/{{ GITHUB_REPOSITORY }}/actions/runs/{{ GITHUB_RUN_ID }}' |