From a3343159f86860c24b9f32c711837f0a0ff057e6 Mon Sep 17 00:00:00 2001 From: rfprod Date: Wed, 8 Jun 2022 14:58:08 +0300 Subject: [PATCH 01/26] ci(github): migrate ci from circleci to github - [x] reimplement circleci workflows using github actions ci; --- .github/workflows/build- tagged.yml | 146 ++++++++++++++++++++++++++++ .github/workflows/build-dev.yml | 146 ++++++++++++++++++++++++++++ .github/workflows/pr-validation.yml | 137 ++++++++++++++++++++++++++ 3 files changed, 429 insertions(+) create mode 100644 .github/workflows/build- tagged.yml create mode 100644 .github/workflows/build-dev.yml create mode 100644 .github/workflows/pr-validation.yml diff --git a/.github/workflows/build- tagged.yml b/.github/workflows/build- tagged.yml new file mode 100644 index 000000000..7be32bd20 --- /dev/null +++ b/.github/workflows/build- tagged.yml @@ -0,0 +1,146 @@ +# For more information see: +# - https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions +# - https://docs.github.com/en/actions/learn-github-actions/contexts#github-context + +name: build-tagged + +on: + push: + branches: [master] + tags: ['v.*'] + +defaults: + run: + shell: bash + +concurrency: + group: ${{ github.ref_name }}.${{ github.sha }}.build-tagged + cancel-in-progress: true + +jobs: + test-build-deploy: + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [16.x] + + steps: + - name: Checkout sources + uses: actions/checkout@v3 + + - name: Don't save Bash session history + run: unset HISTFILE + + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + check-latest: true + + - name: Configure kernel (increase watchers) + run: echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p + + - name: Get variables (branch name, commit hash, yarn cache directory,) + id: get-variables + run: | + echo "::set-output name=shortref::${GITHUB_REF#refs/*/}"; + echo "::set-output name=commitsha::$(echo ${GITHUB_SHA})"; + echo "::set-output name=yarncachedir::$(yarn cache dir)"; + + - name: Workspace cache + uses: actions/cache@v3 + id: workspace-cache + env: + cache-name: workspace-cache + with: + path: | + ~/.cache + ./node_modules + key: ${{ runner.os }}-node-${{ matrix.node-version }}-yarn-${{ hashFiles('**/yarn.lock') }}-branch-${{ steps.get-variables.outputs.shortref }}-workspace-${{ steps.get-variables.outputs.commitsha }} + restore-keys: | + ${{ runner.os }}-node-${{ matrix.node-version }}-yarn-${{ hashFiles('**/yarn.lock') }}-branch-${{ steps.get-variables.outputs.shortref }}-workspace- + ${{ runner.os }}-node-${{ matrix.node-version }}-yarn-${{ hashFiles('**/yarn.lock') }}-branch- + ${{ runner.os }}-node-${{ matrix.node-version }}-yarn- + ${{ runner.os }}- + + # TODO: verify if this is needed at all + # - name: Set NPM global path + # run: echo 'prefix = ~/.npm' > ~/.npmrc + + - name: Install project dependencies + run: yarn install --frozen-lockfile --non-interactive + + - name: Compile NGXS and create a pack + run: | + yarn build + yarn pack --filename ./dist/ngxs-core.tgz + + - name: Lint - TSLint + run: yarn lint + + - name: Lint - ESLint + run: yarn eslint + + - name: Unit Tests + run: yarn test:ci + + # - name: Integration Tests + # run: yarn test:ci:integration + + # - name: E2E Tests + # run: yarn test:ci:e2e + + # - name: Integration Tests - SSR + # run: yarn test:ci:integration:ssr + + - name: Integration Tests - ng7 + run: yarn integration:ng7 + + - name: Integration Tests - ng8 + run: yarn integration:ng8 + + - name: Integration Tests - ng9, Ivy off + run: yarn integration:ng9:ivy:off + + - name: Integration Tests - ng9, Ivy + run: yarn integration:ng9:ivy + + - name: Integration Tests - ng10, Ivy off + run: yarn integration:ng10:ivy:off + + - name: Integration Tests - ng10, Ivy + run: yarn integration:ng10:ivy + + - name: Integration Tests - ng11, Ivy off + run: yarn integration:ng11:ivy:off + + - name: Integration Tests - ng11, Ivy + run: yarn integration:ng11:ivy + + - name: Integration Tests - ng12, Ivy + run: yarn integration:ng12:ivy + + - name: Integration Tests - ng13, Ivy + run: yarn integration:ng13:ivy + + - name: Integration Tests - types + run: yarn test:types + + - name: Check the size of NGXS bundle + run: yarn bundlesize + + - name: Upload coverage results to Code Climate + run: | + curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > /tmp/cc-test-reporter + chmod +x /tmp/cc-test-reporter + /tmp/cc-test-reporter after-build --coverage-input-type lcov --exit-code 0 + env: + CC_TEST_REPORTER_ID: 3f4c9a9d57ded045e0f9ab5d23e5bbcbf709bb85637bea555f1233e72134b818 # TODO: better store it in secrets. Name the variable: CC_TEST_REPORTER_ID. Then delete this line and uncomment the nest one + # CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }} + + # TODO: uncommen after several test runs of the workflow + # - name: Publish tagged builds to all @ngxs packages + # run: | + # echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc + # yarn publish:tagged diff --git a/.github/workflows/build-dev.yml b/.github/workflows/build-dev.yml new file mode 100644 index 000000000..62cbdecb7 --- /dev/null +++ b/.github/workflows/build-dev.yml @@ -0,0 +1,146 @@ +# For more information see: +# - https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions +# - https://docs.github.com/en/actions/learn-github-actions/contexts#github-context + +name: build-dev + +on: + push: + branches: [master] + tags-ignore: ['*'] + +defaults: + run: + shell: bash + +concurrency: + group: ${{ github.ref_name }}.${{ github.sha }}.build-dev + cancel-in-progress: true + +jobs: + test-build-deploy: + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [16.x] + + steps: + - name: Checkout sources + uses: actions/checkout@v3 + + - name: Don't save Bash session history + run: unset HISTFILE + + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + check-latest: true + + - name: Configure kernel (increase watchers) + run: echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p + + - name: Get variables (branch name, commit hash, yarn cache directory,) + id: get-variables + run: | + echo "::set-output name=shortref::${GITHUB_REF#refs/*/}"; + echo "::set-output name=commitsha::$(echo ${GITHUB_SHA})"; + echo "::set-output name=yarncachedir::$(yarn cache dir)"; + + - name: Workspace cache + uses: actions/cache@v3 + id: workspace-cache + env: + cache-name: workspace-cache + with: + path: | + ~/.cache + ./node_modules + key: ${{ runner.os }}-node-${{ matrix.node-version }}-yarn-${{ hashFiles('**/yarn.lock') }}-branch-${{ steps.get-variables.outputs.shortref }}-workspace-${{ steps.get-variables.outputs.commitsha }} + restore-keys: | + ${{ runner.os }}-node-${{ matrix.node-version }}-yarn-${{ hashFiles('**/yarn.lock') }}-branch-${{ steps.get-variables.outputs.shortref }}-workspace- + ${{ runner.os }}-node-${{ matrix.node-version }}-yarn-${{ hashFiles('**/yarn.lock') }}-branch- + ${{ runner.os }}-node-${{ matrix.node-version }}-yarn- + ${{ runner.os }}- + + # TODO: verify if this is needed at all + # - name: Set NPM global path + # run: echo 'prefix = ~/.npm' > ~/.npmrc + + - name: Install project dependencies + run: yarn install --frozen-lockfile --non-interactive + + - name: Compile NGXS and create a pack + run: | + yarn build + yarn pack --filename ./dist/ngxs-core.tgz + + - name: Lint - TSLint + run: yarn lint + + - name: Lint - ESLint + run: yarn eslint + + - name: Unit Tests + run: yarn test:ci + + # - name: Integration Tests + # run: yarn test:ci:integration + + # - name: E2E Tests + # run: yarn test:ci:e2e + + # - name: Integration Tests - SSR + # run: yarn test:ci:integration:ssr + + - name: Integration Tests - ng7 + run: yarn integration:ng7 + + - name: Integration Tests - ng8 + run: yarn integration:ng8 + + - name: Integration Tests - ng9, Ivy off + run: yarn integration:ng9:ivy:off + + - name: Integration Tests - ng9, Ivy + run: yarn integration:ng9:ivy + + - name: Integration Tests - ng10, Ivy off + run: yarn integration:ng10:ivy:off + + - name: Integration Tests - ng10, Ivy + run: yarn integration:ng10:ivy + + - name: Integration Tests - ng11, Ivy off + run: yarn integration:ng11:ivy:off + + - name: Integration Tests - ng11, Ivy + run: yarn integration:ng11:ivy + + - name: Integration Tests - ng12, Ivy + run: yarn integration:ng12:ivy + + - name: Integration Tests - ng13, Ivy + run: yarn integration:ng13:ivy + + - name: Integration Tests - types + run: yarn test:types + + - name: Check the size of NGXS bundle + run: yarn bundlesize + + - name: Upload coverage results to Code Climate + run: | + curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > /tmp/cc-test-reporter + chmod +x /tmp/cc-test-reporter + /tmp/cc-test-reporter after-build --coverage-input-type lcov --exit-code 0 + env: + CC_TEST_REPORTER_ID: 3f4c9a9d57ded045e0f9ab5d23e5bbcbf709bb85637bea555f1233e72134b818 # TODO: better store it in secrets. Name the variable: CC_TEST_REPORTER_ID. Then delete this line and uncomment the nest one + # CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }} + + # TODO: uncommen after several test runs of the workflow + # - name: Publish development builds to all @ngxs packages + # run: | + # echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc + # yarn publish:dev diff --git a/.github/workflows/pr-validation.yml b/.github/workflows/pr-validation.yml new file mode 100644 index 000000000..cfe952788 --- /dev/null +++ b/.github/workflows/pr-validation.yml @@ -0,0 +1,137 @@ +# For more information see: +# - https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions +# - https://docs.github.com/en/actions/learn-github-actions/contexts#github-context + +name: pr-validation + +on: + pull_request: + +defaults: + run: + shell: bash + +concurrency: + group: ${{ github.head_ref }}.${{ github.sha }}.pr-validation + cancel-in-progress: true + +jobs: + premerge: + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [16.x] + + steps: + - name: Checkout sources + uses: actions/checkout@v3 + with: + fetch-depth: 0 + ref: ${{ github.event.pull_request.head.sha }} + + - name: Don't save Bash session history + run: unset HISTFILE + + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + check-latest: true + + - name: Configure kernel (increase watchers) + run: echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p + + - name: Get variables (branch name, commit hash, yarn cache directory,) + id: get-variables + run: | + echo "::set-output name=shortref::${GITHUB_REF#refs/*/}"; + echo "::set-output name=commitsha::$(echo ${GITHUB_SHA})"; + echo "::set-output name=yarncachedir::$(yarn cache dir)"; + + - name: Workspace cache + uses: actions/cache@v3 + id: workspace-cache + env: + cache-name: workspace-cache + with: + path: | + ~/.cache + ./node_modules + key: ${{ runner.os }}-node-${{ matrix.node-version }}-yarn-${{ hashFiles('**/yarn.lock') }}-branch-${{ steps.get-variables.outputs.shortref }}-workspace-${{ steps.get-variables.outputs.commitsha }} + restore-keys: | + ${{ runner.os }}-node-${{ matrix.node-version }}-yarn-${{ hashFiles('**/yarn.lock') }}-branch-${{ steps.get-variables.outputs.shortref }}-workspace- + ${{ runner.os }}-node-${{ matrix.node-version }}-yarn-${{ hashFiles('**/yarn.lock') }}-branch- + ${{ runner.os }}-node-${{ matrix.node-version }}-yarn- + ${{ runner.os }}- + + - name: Install project dependencies + run: yarn install --frozen-lockfile --non-interactive + + - name: Compile NGXS and create a pack + run: | + yarn build + yarn pack --filename ./dist/ngxs-core.tgz + + - name: Lint - TSLint + run: yarn lint + + - name: Lint - ESLint + run: yarn eslint + + - name: Unit Tests + run: yarn test:ci + + # - name: Integration Tests + # run: yarn test:ci:integration + + # - name: E2E Tests + # run: yarn test:ci:e2e + + # - name: Integration Tests - SSR + # run: yarn test:ci:integration:ssr + + - name: Integration Tests - ng7 + run: yarn integration:ng7 + + - name: Integration Tests - ng8 + run: yarn integration:ng8 + + - name: Integration Tests - ng9, Ivy off + run: yarn integration:ng9:ivy:off + + - name: Integration Tests - ng9, Ivy + run: yarn integration:ng9:ivy + + - name: Integration Tests - ng10, Ivy off + run: yarn integration:ng10:ivy:off + + - name: Integration Tests - ng10, Ivy + run: yarn integration:ng10:ivy + + - name: Integration Tests - ng11, Ivy off + run: yarn integration:ng11:ivy:off + + - name: Integration Tests - ng11, Ivy + run: yarn integration:ng11:ivy + + - name: Integration Tests - ng12, Ivy + run: yarn integration:ng12:ivy + + - name: Integration Tests - ng13, Ivy + run: yarn integration:ng13:ivy + + - name: Integration Tests - types + run: yarn test:types + + - name: Check the size of NGXS bundle + run: yarn bundlesize + + - name: Upload coverage results to Code Climate + run: | + curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > /tmp/cc-test-reporter + chmod +x /tmp/cc-test-reporter + /tmp/cc-test-reporter after-build --coverage-input-type lcov --exit-code 0 + env: + CC_TEST_REPORTER_ID: 3f4c9a9d57ded045e0f9ab5d23e5bbcbf709bb85637bea555f1233e72134b818 # TODO: better store it in secrets. Name the variable: CC_TEST_REPORTER_ID. Then delete this line and uncomment the nest one + # CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }} From 9cee7e1970185330a848ffd1a4fc690ed80185d0 Mon Sep 17 00:00:00 2001 From: rfprod Date: Wed, 8 Jun 2022 15:10:33 +0300 Subject: [PATCH 02/26] ci(cleanup): remove .npmrc after publishing packages - [x] add a cleanup command that removes .npmrc after publishing packages; --- .github/workflows/build- tagged.yml | 1 + .github/workflows/build-dev.yml | 1 + 2 files changed, 2 insertions(+) diff --git a/.github/workflows/build- tagged.yml b/.github/workflows/build- tagged.yml index 7be32bd20..9ba87e63a 100644 --- a/.github/workflows/build- tagged.yml +++ b/.github/workflows/build- tagged.yml @@ -144,3 +144,4 @@ jobs: # run: | # echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc # yarn publish:tagged + # find ~/.npmrc -exec shred -fuz {} + diff --git a/.github/workflows/build-dev.yml b/.github/workflows/build-dev.yml index 62cbdecb7..3afa02619 100644 --- a/.github/workflows/build-dev.yml +++ b/.github/workflows/build-dev.yml @@ -144,3 +144,4 @@ jobs: # run: | # echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc # yarn publish:dev + # find ~/.npmrc -exec shred -fuz {} + From 5858aeb5eeb5413d4d71d04dc5f0109f4dd6bc90 Mon Sep 17 00:00:00 2001 From: rfprod Date: Thu, 9 Jun 2022 00:49:57 +0300 Subject: [PATCH 03/26] ci(github): revise github actions ci workflows - [x] clean up workflows, add comments to justify suggestions; - [x] implement a reusable workflow that might be used later, add explanatory comments; --- .github/workflows/build- tagged.yml | 147 ------------ .github/workflows/get-variables.yml | 37 +++ .github/workflows/pr-validation.yml | 38 ++- .github/workflows/release.yml | 226 ++++++++++++++++++ .../workflows/{build-dev.yml => trunk.yml} | 28 ++- 5 files changed, 314 insertions(+), 162 deletions(-) delete mode 100644 .github/workflows/build- tagged.yml create mode 100644 .github/workflows/get-variables.yml create mode 100644 .github/workflows/release.yml rename .github/workflows/{build-dev.yml => trunk.yml} (72%) diff --git a/.github/workflows/build- tagged.yml b/.github/workflows/build- tagged.yml deleted file mode 100644 index 9ba87e63a..000000000 --- a/.github/workflows/build- tagged.yml +++ /dev/null @@ -1,147 +0,0 @@ -# For more information see: -# - https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions -# - https://docs.github.com/en/actions/learn-github-actions/contexts#github-context - -name: build-tagged - -on: - push: - branches: [master] - tags: ['v.*'] - -defaults: - run: - shell: bash - -concurrency: - group: ${{ github.ref_name }}.${{ github.sha }}.build-tagged - cancel-in-progress: true - -jobs: - test-build-deploy: - runs-on: ubuntu-latest - - strategy: - matrix: - node-version: [16.x] - - steps: - - name: Checkout sources - uses: actions/checkout@v3 - - - name: Don't save Bash session history - run: unset HISTFILE - - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v3 - with: - node-version: ${{ matrix.node-version }} - check-latest: true - - - name: Configure kernel (increase watchers) - run: echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p - - - name: Get variables (branch name, commit hash, yarn cache directory,) - id: get-variables - run: | - echo "::set-output name=shortref::${GITHUB_REF#refs/*/}"; - echo "::set-output name=commitsha::$(echo ${GITHUB_SHA})"; - echo "::set-output name=yarncachedir::$(yarn cache dir)"; - - - name: Workspace cache - uses: actions/cache@v3 - id: workspace-cache - env: - cache-name: workspace-cache - with: - path: | - ~/.cache - ./node_modules - key: ${{ runner.os }}-node-${{ matrix.node-version }}-yarn-${{ hashFiles('**/yarn.lock') }}-branch-${{ steps.get-variables.outputs.shortref }}-workspace-${{ steps.get-variables.outputs.commitsha }} - restore-keys: | - ${{ runner.os }}-node-${{ matrix.node-version }}-yarn-${{ hashFiles('**/yarn.lock') }}-branch-${{ steps.get-variables.outputs.shortref }}-workspace- - ${{ runner.os }}-node-${{ matrix.node-version }}-yarn-${{ hashFiles('**/yarn.lock') }}-branch- - ${{ runner.os }}-node-${{ matrix.node-version }}-yarn- - ${{ runner.os }}- - - # TODO: verify if this is needed at all - # - name: Set NPM global path - # run: echo 'prefix = ~/.npm' > ~/.npmrc - - - name: Install project dependencies - run: yarn install --frozen-lockfile --non-interactive - - - name: Compile NGXS and create a pack - run: | - yarn build - yarn pack --filename ./dist/ngxs-core.tgz - - - name: Lint - TSLint - run: yarn lint - - - name: Lint - ESLint - run: yarn eslint - - - name: Unit Tests - run: yarn test:ci - - # - name: Integration Tests - # run: yarn test:ci:integration - - # - name: E2E Tests - # run: yarn test:ci:e2e - - # - name: Integration Tests - SSR - # run: yarn test:ci:integration:ssr - - - name: Integration Tests - ng7 - run: yarn integration:ng7 - - - name: Integration Tests - ng8 - run: yarn integration:ng8 - - - name: Integration Tests - ng9, Ivy off - run: yarn integration:ng9:ivy:off - - - name: Integration Tests - ng9, Ivy - run: yarn integration:ng9:ivy - - - name: Integration Tests - ng10, Ivy off - run: yarn integration:ng10:ivy:off - - - name: Integration Tests - ng10, Ivy - run: yarn integration:ng10:ivy - - - name: Integration Tests - ng11, Ivy off - run: yarn integration:ng11:ivy:off - - - name: Integration Tests - ng11, Ivy - run: yarn integration:ng11:ivy - - - name: Integration Tests - ng12, Ivy - run: yarn integration:ng12:ivy - - - name: Integration Tests - ng13, Ivy - run: yarn integration:ng13:ivy - - - name: Integration Tests - types - run: yarn test:types - - - name: Check the size of NGXS bundle - run: yarn bundlesize - - - name: Upload coverage results to Code Climate - run: | - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > /tmp/cc-test-reporter - chmod +x /tmp/cc-test-reporter - /tmp/cc-test-reporter after-build --coverage-input-type lcov --exit-code 0 - env: - CC_TEST_REPORTER_ID: 3f4c9a9d57ded045e0f9ab5d23e5bbcbf709bb85637bea555f1233e72134b818 # TODO: better store it in secrets. Name the variable: CC_TEST_REPORTER_ID. Then delete this line and uncomment the nest one - # CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }} - - # TODO: uncommen after several test runs of the workflow - # - name: Publish tagged builds to all @ngxs packages - # run: | - # echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc - # yarn publish:tagged - # find ~/.npmrc -exec shred -fuz {} + diff --git a/.github/workflows/get-variables.yml b/.github/workflows/get-variables.yml new file mode 100644 index 000000000..1b04c5a0b --- /dev/null +++ b/.github/workflows/get-variables.yml @@ -0,0 +1,37 @@ +# For more information see: +# - https://docs.github.com/en/actions/using-workflows/reusing-workflows +# - https://docs.github.com/en/actions/using-workflows/reusing-workflows#limitations + +# Note: +# This workflow might be used after code is merged into the master branch. +# The workflow is references in other workflows like: ngxs/store/.github/workflows/get-variables.yml@master + +name: get-variables + +on: + workflow_call: + outputs: + shortref: + description: "Branch name" + value: ${{ jobs.get-variables.outputs.shortref }} + commitsha: + description: "GitHub commit SHA" + value: ${{ jobs.get-variables.outputs.commitsha }} + yarncachedir: + description: "Yarn cache directory" + value: ${{ jobs.get-variables.outputs.yarncachedir }} + +jobs: + get-variables: + name: Get variables (branch name, commit hash, yarn cache directory) + runs-on: ubuntu-latest + outputs: + shortref: ${{ steps.get-variables.outputs.shortref }} + commitsha: ${{ steps.get-variables.outputs.commitsha }} + yarncachedir: ${{ steps.get-variables.outputs.yarncachedir }} + steps: + - id: get-variables + run: | + echo "::set-output name=shortref::${GITHUB_REF#refs/*/}"; + echo "::set-output name=commitsha::$(echo ${GITHUB_SHA})"; + echo "::set-output name=yarncachedir::$(yarn cache dir)"; diff --git a/.github/workflows/pr-validation.yml b/.github/workflows/pr-validation.yml index cfe952788..16cf2ae93 100644 --- a/.github/workflows/pr-validation.yml +++ b/.github/workflows/pr-validation.yml @@ -16,8 +16,13 @@ concurrency: cancel-in-progress: true jobs: + ## the reusable job will work after the PR is merged and files are committed to the master branch + # get-variables: + # uses: ngxs/store/.github/workflows/get-variables.yml@master # <- references a reusable workflow file and a branch + premerge: runs-on: ubuntu-latest + # needs: get-variables # this can be uncommented after the reusable job works (see above) strategy: matrix: @@ -42,7 +47,8 @@ jobs: - name: Configure kernel (increase watchers) run: echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p - - name: Get variables (branch name, commit hash, yarn cache directory,) + # this step might be replaced with a reusable workflow get-variables.yml (see above) + - name: Get variables (branch name, commit hash, yarn cache directory) id: get-variables run: | echo "::set-output name=shortref::${GITHUB_REF#refs/*/}"; @@ -64,10 +70,18 @@ jobs: ${{ runner.os }}-node-${{ matrix.node-version }}-yarn-${{ hashFiles('**/yarn.lock') }}-branch- ${{ runner.os }}-node-${{ matrix.node-version }}-yarn- ${{ runner.os }}- + ## the above might be replaced with the commented code beneath if a reusable workflow get-variables.yml is used (see above) + # key: ${{ runner.os }}-node-${{ matrix.node-version }}-yarn-${{ hashFiles('**/yarn.lock') }}-branch-${{ needs.get-variables.outputs.shortref }}-workspace-${{ needs.get-variables.outputs.commitsha }} + # restore-keys: | + # ${{ runner.os }}-node-${{ matrix.node-version }}-yarn-${{ hashFiles('**/yarn.lock') }}-branch-${{ needs.get-variables.outputs.shortref }}-workspace- + # ${{ runner.os }}-node-${{ matrix.node-version }}-yarn-${{ hashFiles('**/yarn.lock') }}-branch- + # ${{ runner.os }}-node-${{ matrix.node-version }}-yarn- + # ${{ runner.os }}- - name: Install project dependencies run: yarn install --frozen-lockfile --non-interactive + # Is 'yarn pack --filename ./dist/ngxs-core.tgz' needed during premerge checks? - name: Compile NGXS and create a pack run: | yarn build @@ -82,12 +96,15 @@ jobs: - name: Unit Tests run: yarn test:ci + ## This step was commented in the CircleCI workflows config. # - name: Integration Tests # run: yarn test:ci:integration + ## This step was commented in the CircleCI workflows config. # - name: E2E Tests # run: yarn test:ci:e2e + ## This step was commented in the CircleCI workflows config. # - name: Integration Tests - SSR # run: yarn test:ci:integration:ssr @@ -127,11 +144,14 @@ jobs: - name: Check the size of NGXS bundle run: yarn bundlesize - - name: Upload coverage results to Code Climate - run: | - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > /tmp/cc-test-reporter - chmod +x /tmp/cc-test-reporter - /tmp/cc-test-reporter after-build --coverage-input-type lcov --exit-code 0 - env: - CC_TEST_REPORTER_ID: 3f4c9a9d57ded045e0f9ab5d23e5bbcbf709bb85637bea555f1233e72134b818 # TODO: better store it in secrets. Name the variable: CC_TEST_REPORTER_ID. Then delete this line and uncomment the nest one - # CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }} + ## Actually, this is probably not needed during premerge checks. + ## It makes sense to store test results only after testing already code merged into the trunk. + ## It does not seem to make sense to upload test results after each push to the branch that has not need merged into the trunk, there will be a lot of useless artifacts on Code Climate. + # - name: Upload coverage results to Code Climate + # run: | + # curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > /tmp/cc-test-reporter + # chmod +x /tmp/cc-test-reporter + # /tmp/cc-test-reporter after-build --coverage-input-type lcov --exit-code 0 + # env: + # CC_TEST_REPORTER_ID: 3f4c9a9d57ded045e0f9ab5d23e5bbcbf709bb85637bea555f1233e72134b818 # TODO: better store it in the repository secrets. Name the variable: CC_TEST_REPORTER_ID. Then delete this line and uncomment the next one + # # CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 000000000..62a606f77 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,226 @@ +# For more information see: +# - https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions +# - https://docs.github.com/en/actions/learn-github-actions/contexts#github-context + +name: release + +# on: +# push: +# branches: [master] +# tags: ['v.*'] +## Instead of the above, it is better to trigger the workflow when a release is manually created on GutHub via the releases page. +## The above was replicated based on the CircleCI workflows file which does not use the best practices when using GutHub with GitHub Actions CI. +on: + release: + types: + - created + +defaults: + run: + shell: bash + +concurrency: + group: ${{ github.ref_name }}.${{ github.sha }}.release + cancel-in-progress: true + +jobs: + ## the reusable job will work after the PR is merged and files are committed to the master branch + # get-variables: + # uses: ngxs/store/.github/workflows/get-variables.yml@master # <- references a reusable workflow file and a branch + + build-release_prod: + runs-on: ubuntu-latest + # needs: get-variables # this can be uncommented after the reusable job works (see above) + + strategy: + matrix: + node-version: [16.x] + + steps: + - name: Checkout sources + uses: actions/checkout@v3 + + - name: Don't save Bash session history + run: unset HISTFILE + + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + check-latest: true + + - name: Configure kernel (increase watchers) + run: echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p + + # this step might be replaced with a reusable workflow get-variables.yml (see above) + - name: Get variables (branch name, commit hash, yarn cache directory) + id: get-variables + run: | + echo "::set-output name=shortref::${GITHUB_REF#refs/*/}"; + echo "::set-output name=commitsha::$(echo ${GITHUB_SHA})"; + echo "::set-output name=yarncachedir::$(yarn cache dir)"; + + - name: Workspace cache + uses: actions/cache@v3 + id: workspace-cache + env: + cache-name: workspace-cache + with: + path: | + ~/.cache + ./node_modules + key: ${{ runner.os }}-node-${{ matrix.node-version }}-yarn-${{ hashFiles('**/yarn.lock') }}-branch-${{ steps.get-variables.outputs.shortref }}-workspace-${{ steps.get-variables.outputs.commitsha }} + restore-keys: | + ${{ runner.os }}-node-${{ matrix.node-version }}-yarn-${{ hashFiles('**/yarn.lock') }}-branch-${{ steps.get-variables.outputs.shortref }}-workspace- + ${{ runner.os }}-node-${{ matrix.node-version }}-yarn-${{ hashFiles('**/yarn.lock') }}-branch- + ${{ runner.os }}-node-${{ matrix.node-version }}-yarn- + ${{ runner.os }}- + ## the above might be replaced with the commented code beneath if a reusable workflow get-variables.yml is used (see above) + # key: ${{ runner.os }}-node-${{ matrix.node-version }}-yarn-${{ hashFiles('**/yarn.lock') }}-branch-${{ needs.get-variables.outputs.shortref }}-workspace-${{ needs.get-variables.outputs.commitsha }} + # restore-keys: | + # ${{ runner.os }}-node-${{ matrix.node-version }}-yarn-${{ hashFiles('**/yarn.lock') }}-branch-${{ needs.get-variables.outputs.shortref }}-workspace- + # ${{ runner.os }}-node-${{ matrix.node-version }}-yarn-${{ hashFiles('**/yarn.lock') }}-branch- + # ${{ runner.os }}-node-${{ matrix.node-version }}-yarn- + # ${{ runner.os }}- + + # TODO: verify if this is needed at all + # - name: Set NPM global path + # run: echo 'prefix = ~/.npm' > ~/.npmrc + + - name: Install project dependencies + run: yarn install --frozen-lockfile --non-interactive + + - name: Compile NGXS and create a pack + run: | + yarn build + yarn pack --filename ./dist/ngxs-core.tgz + + ## All steps marked with this comment don't seem to be needed for tagged builds (aka releases), because each tagged build will happen only after a respective dev build, + ## if releases are built off the trunk after dev builds. + ## Dev builds happen automatically when something is merged into the trunk (it should not be possible to push into the trunk directly) and there is no tag. + # - name: Lint - TSLint + # run: yarn lint + + ## All steps marked with this comment don't seem to be needed for tagged builds (aka releases), because each tagged build will happen only after a respective dev build, + ## if releases are built off the trunk after dev builds. + ## Dev builds happen automatically when something is merged into the trunk (it should not be possible to push into the trunk directly) and there is no tag. + # - name: Lint - ESLint + # run: yarn eslint + + ## All steps marked with this comment don't seem to be needed for tagged builds (aka releases), because each tagged build will happen only after a respective dev build, + ## if releases are built off the trunk after dev builds. + ## Dev builds happen automatically when something is merged into the trunk (it should not be possible to push into the trunk directly) and there is no tag. + # - name: Unit Tests + # run: yarn test:ci + + ## All steps marked with this comment don't seem to be needed for tagged builds (aka releases), because each tagged build will happen only after a respective dev build, + ## if releases are built off the trunk after dev builds. + ## Dev builds happen automatically when something is merged into the trunk (it should not be possible to push into the trunk directly) and there is no tag. + ## This step was commented in the CircleCI workflows config. + ## - name: Integration Tests + ## run: yarn test:ci:integration + + ## All steps marked with this comment don't seem to be needed for tagged builds (aka releases), because each tagged build will happen only after a respective dev build, + ## if releases are built off the trunk after dev builds. + ## Dev builds happen automatically when something is merged into the trunk (it should not be possible to push into the trunk directly) and there is no tag. + ## This step was commented in the CircleCI workflows config. + ## - name: E2E Tests + ## run: yarn test:ci:e2e + + ## All steps marked with this comment don't seem to be needed for tagged builds (aka releases), because each tagged build will happen only after a respective dev build, + ## if releases are built off the trunk after dev builds. + ## Dev builds happen automatically when something is merged into the trunk (it should not be possible to push into the trunk directly) and there is no tag. + ## This step was commented in the CircleCI workflows config. + ## - name: Integration Tests - SSR + ## run: yarn test:ci:integration:ssr + + ## All steps marked with this comment don't seem to be needed for tagged builds (aka releases), because each tagged build will happen only after a respective dev build, + ## if releases are built off the trunk after dev builds. + ## Dev builds happen automatically when something is merged into the trunk (it should not be possible to push into the trunk directly) and there is no tag. + # - name: Integration Tests - ng7 + # run: yarn integration:ng7 + + ## All steps marked with this comment don't seem to be needed for tagged builds (aka releases), because each tagged build will happen only after a respective dev build, + ## if releases are built off the trunk after dev builds. + ## Dev builds happen automatically when something is merged into the trunk (it should not be possible to push into the trunk directly) and there is no tag. + # - name: Integration Tests - ng8 + # run: yarn integration:ng8 + + ## All steps marked with this comment don't seem to be needed for tagged builds (aka releases), because each tagged build will happen only after a respective dev build, + ## if releases are built off the trunk after dev builds. + ## Dev builds happen automatically when something is merged into the trunk (it should not be possible to push into the trunk directly) and there is no tag. + # - name: Integration Tests - ng9, Ivy off + # run: yarn integration:ng9:ivy:off + + ## All steps marked with this comment don't seem to be needed for tagged builds (aka releases), because each tagged build will happen only after a respective dev build, + ## if releases are built off the trunk after dev builds. + ## Dev builds happen automatically when something is merged into the trunk (it should not be possible to push into the trunk directly) and there is no tag. + # - name: Integration Tests - ng9, Ivy + # run: yarn integration:ng9:ivy + + ## All steps marked with this comment don't seem to be needed for tagged builds (aka releases), because each tagged build will happen only after a respective dev build, + ## if releases are built off the trunk after dev builds. + ## Dev builds happen automatically when something is merged into the trunk (it should not be possible to push into the trunk directly) and there is no tag. + # - name: Integration Tests - ng10, Ivy off + # run: yarn integration:ng10:ivy:off + + ## All steps marked with this comment don't seem to be needed for tagged builds (aka releases), because each tagged build will happen only after a respective dev build, + ## if releases are built off the trunk after dev builds. + ## Dev builds happen automatically when something is merged into the trunk (it should not be possible to push into the trunk directly) and there is no tag. + # - name: Integration Tests - ng10, Ivy + # run: yarn integration:ng10:ivy + + ## All steps marked with this comment don't seem to be needed for tagged builds (aka releases), because each tagged build will happen only after a respective dev build, + ## if releases are built off the trunk after dev builds. + ## Dev builds happen automatically when something is merged into the trunk (it should not be possible to push into the trunk directly) and there is no tag. + # - name: Integration Tests - ng11, Ivy off + # run: yarn integration:ng11:ivy:off + + ## All steps marked with this comment don't seem to be needed for tagged builds (aka releases), because each tagged build will happen only after a respective dev build, + ## if releases are built off the trunk after dev builds. + ## Dev builds happen automatically when something is merged into the trunk (it should not be possible to push into the trunk directly) and there is no tag. + # - name: Integration Tests - ng11, Ivy + # run: yarn integration:ng11:ivy + + ## All steps marked with this comment don't seem to be needed for tagged builds (aka releases), because each tagged build will happen only after a respective dev build, + ## if releases are built off the trunk after dev builds. + ## Dev builds happen automatically when something is merged into the trunk (it should not be possible to push into the trunk directly) and there is no tag. + # - name: Integration Tests - ng12, Ivy + # run: yarn integration:ng12:ivy + + ## All steps marked with this comment don't seem to be needed for tagged builds (aka releases), because each tagged build will happen only after a respective dev build, + ## if releases are built off the trunk after dev builds. + ## Dev builds happen automatically when something is merged into the trunk (it should not be possible to push into the trunk directly) and there is no tag. + # - name: Integration Tests - ng13, Ivy + # run: yarn integration:ng13:ivy + + ## All steps marked with this comment don't seem to be needed for tagged builds (aka releases), because each tagged build will happen only after a respective dev build, + ## if releases are built off the trunk after dev builds. + ## Dev builds happen automatically when something is merged into the trunk (it should not be possible to push into the trunk directly) and there is no tag. + # - name: Integration Tests - types + # run: yarn test:types + + ## All steps marked with this comment don't seem to be needed for tagged builds (aka releases), because each tagged build will happen only after a respective dev build, + ## if releases are built off the trunk after dev builds. + ## Dev builds happen automatically when something is merged into the trunk (it should not be possible to push into the trunk directly) and there is no tag. + # - name: Check the size of NGXS bundle + # run: yarn bundlesize + + ## All steps marked with this comment don't seem to be needed for tagged builds (aka releases), because each tagged build will happen only after a respective dev build, + ## if releases are built off the trunk after dev builds. + ## Dev builds happen automatically when something is merged into the trunk (it should not be possible to push into the trunk directly) and there is no tag. + # - name: Upload coverage results to Code Climate + # run: | + # curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > /tmp/cc-test-reporter + # chmod +x /tmp/cc-test-reporter + # /tmp/cc-test-reporter after-build --coverage-input-type lcov --exit-code 0 + # env: + # CC_TEST_REPORTER_ID: 3f4c9a9d57ded045e0f9ab5d23e5bbcbf709bb85637bea555f1233e72134b818 # TODO: better store it in the repository secrets. Name the variable: CC_TEST_REPORTER_ID. Then delete this line and uncomment the next one + # # CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }} + + # TODO: uncommen after several test runs of the workflow + # - name: Production release - publish tagged builds to all @ngxs packages + # run: | + # echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc + # yarn publish:tagged + # find ~/.npmrc -exec shred -fuz {} + diff --git a/.github/workflows/build-dev.yml b/.github/workflows/trunk.yml similarity index 72% rename from .github/workflows/build-dev.yml rename to .github/workflows/trunk.yml index 3afa02619..e6d91ab5b 100644 --- a/.github/workflows/build-dev.yml +++ b/.github/workflows/trunk.yml @@ -2,7 +2,7 @@ # - https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions # - https://docs.github.com/en/actions/learn-github-actions/contexts#github-context -name: build-dev +name: trunk on: push: @@ -14,12 +14,17 @@ defaults: shell: bash concurrency: - group: ${{ github.ref_name }}.${{ github.sha }}.build-dev + group: ${{ github.ref_name }}.${{ github.sha }}.trunk cancel-in-progress: true jobs: - test-build-deploy: + ## the reusable job will work after the PR is merged and files are committed to the master branch + # get-variables: + # uses: ngxs/store/.github/workflows/get-variables.yml@master # <- references a reusable workflow file and a branch + + build-lint-test-release_dev: runs-on: ubuntu-latest + # needs: get-variables # this can be uncommented after the reusable job works (see above) strategy: matrix: @@ -41,7 +46,8 @@ jobs: - name: Configure kernel (increase watchers) run: echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p - - name: Get variables (branch name, commit hash, yarn cache directory,) + # this step might be replaced with a reusable workflow get-variables.yml (see above) + - name: Get variables (branch name, commit hash, yarn cache directory) id: get-variables run: | echo "::set-output name=shortref::${GITHUB_REF#refs/*/}"; @@ -63,6 +69,13 @@ jobs: ${{ runner.os }}-node-${{ matrix.node-version }}-yarn-${{ hashFiles('**/yarn.lock') }}-branch- ${{ runner.os }}-node-${{ matrix.node-version }}-yarn- ${{ runner.os }}- + ## the above might be replaced with the commented code beneath if a reusable workflow get-variables.yml is used (see above) + # key: ${{ runner.os }}-node-${{ matrix.node-version }}-yarn-${{ hashFiles('**/yarn.lock') }}-branch-${{ needs.get-variables.outputs.shortref }}-workspace-${{ needs.get-variables.outputs.commitsha }} + # restore-keys: | + # ${{ runner.os }}-node-${{ matrix.node-version }}-yarn-${{ hashFiles('**/yarn.lock') }}-branch-${{ needs.get-variables.outputs.shortref }}-workspace- + # ${{ runner.os }}-node-${{ matrix.node-version }}-yarn-${{ hashFiles('**/yarn.lock') }}-branch- + # ${{ runner.os }}-node-${{ matrix.node-version }}-yarn- + # ${{ runner.os }}- # TODO: verify if this is needed at all # - name: Set NPM global path @@ -85,12 +98,15 @@ jobs: - name: Unit Tests run: yarn test:ci + # This step was commented in the CircleCI workflows config. # - name: Integration Tests # run: yarn test:ci:integration + # This step was commented in the CircleCI workflows config. # - name: E2E Tests # run: yarn test:ci:e2e + # This step was commented in the CircleCI workflows config. # - name: Integration Tests - SSR # run: yarn test:ci:integration:ssr @@ -136,11 +152,11 @@ jobs: chmod +x /tmp/cc-test-reporter /tmp/cc-test-reporter after-build --coverage-input-type lcov --exit-code 0 env: - CC_TEST_REPORTER_ID: 3f4c9a9d57ded045e0f9ab5d23e5bbcbf709bb85637bea555f1233e72134b818 # TODO: better store it in secrets. Name the variable: CC_TEST_REPORTER_ID. Then delete this line and uncomment the nest one + CC_TEST_REPORTER_ID: 3f4c9a9d57ded045e0f9ab5d23e5bbcbf709bb85637bea555f1233e72134b818 # TODO: better store it in the repository secrets. Name the variable: CC_TEST_REPORTER_ID. Then delete this line and uncomment the next one # CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }} # TODO: uncommen after several test runs of the workflow - # - name: Publish development builds to all @ngxs packages + # - name: Development release - publish development builds to all @ngxs packages # run: | # echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc # yarn publish:dev From 4b5060675e33e014b3a03b3d53b6f408f7f2f9e5 Mon Sep 17 00:00:00 2001 From: Vadim Date: Fri, 10 Jun 2022 16:23:42 +0300 Subject: [PATCH 04/26] Update .github/workflows/get-variables.yml Co-authored-by: Mark Whitfeld --- .github/workflows/get-variables.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/get-variables.yml b/.github/workflows/get-variables.yml index 1b04c5a0b..4eee6638d 100644 --- a/.github/workflows/get-variables.yml +++ b/.github/workflows/get-variables.yml @@ -4,7 +4,7 @@ # Note: # This workflow might be used after code is merged into the master branch. -# The workflow is references in other workflows like: ngxs/store/.github/workflows/get-variables.yml@master +# The workflow is referenced in other workflows like: ngxs/store/.github/workflows/get-variables.yml@master name: get-variables From 5fb7e8d0f72ecedd553e12b59e998a8fc6112f36 Mon Sep 17 00:00:00 2001 From: Vadim Date: Fri, 10 Jun 2022 16:25:18 +0300 Subject: [PATCH 05/26] Update .github/workflows/pr-validation.yml Co-authored-by: Mark Whitfeld --- .github/workflows/pr-validation.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr-validation.yml b/.github/workflows/pr-validation.yml index 16cf2ae93..f7042febf 100644 --- a/.github/workflows/pr-validation.yml +++ b/.github/workflows/pr-validation.yml @@ -18,7 +18,7 @@ concurrency: jobs: ## the reusable job will work after the PR is merged and files are committed to the master branch # get-variables: - # uses: ngxs/store/.github/workflows/get-variables.yml@master # <- references a reusable workflow file and a branch + # uses: ./.github/workflows/get-variables.yml premerge: runs-on: ubuntu-latest From 5058adf7666d3154950196e543c5345a9ff1dd5b Mon Sep 17 00:00:00 2001 From: rfprod Date: Fri, 10 Jun 2022 16:28:10 +0300 Subject: [PATCH 06/26] ci(premerge): upload premerge unit test coverage results to code climate --- .github/workflows/pr-validation.yml | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/.github/workflows/pr-validation.yml b/.github/workflows/pr-validation.yml index f7042febf..c070cfa76 100644 --- a/.github/workflows/pr-validation.yml +++ b/.github/workflows/pr-validation.yml @@ -144,14 +144,11 @@ jobs: - name: Check the size of NGXS bundle run: yarn bundlesize - ## Actually, this is probably not needed during premerge checks. - ## It makes sense to store test results only after testing already code merged into the trunk. - ## It does not seem to make sense to upload test results after each push to the branch that has not need merged into the trunk, there will be a lot of useless artifacts on Code Climate. - # - name: Upload coverage results to Code Climate - # run: | - # curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > /tmp/cc-test-reporter - # chmod +x /tmp/cc-test-reporter - # /tmp/cc-test-reporter after-build --coverage-input-type lcov --exit-code 0 - # env: - # CC_TEST_REPORTER_ID: 3f4c9a9d57ded045e0f9ab5d23e5bbcbf709bb85637bea555f1233e72134b818 # TODO: better store it in the repository secrets. Name the variable: CC_TEST_REPORTER_ID. Then delete this line and uncomment the next one - # # CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }} + - name: Upload coverage results to Code Climate + run: | + curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > /tmp/cc-test-reporter + chmod +x /tmp/cc-test-reporter + /tmp/cc-test-reporter after-build --coverage-input-type lcov --exit-code 0 + env: + CC_TEST_REPORTER_ID: 3f4c9a9d57ded045e0f9ab5d23e5bbcbf709bb85637bea555f1233e72134b818 # TODO: better store it in the repository secrets. Name the variable: CC_TEST_REPORTER_ID. Then delete this line and uncomment the next one + # CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }} From 4ffe17f428ea641295a3c67b11ef45d5b6a60c80 Mon Sep 17 00:00:00 2001 From: rfprod Date: Fri, 10 Jun 2022 18:34:38 +0300 Subject: [PATCH 07/26] ci(dry): setup jobs with a reusable workflow, use matrix for scripts - [x] use a reusable workflow to setup all jobs; - [x] use a matrix strategy to parallelize scripts execution; --- .github/workflows/_setup.yml | 73 +++++++ .github/workflows/get-variables.yml | 37 ---- .github/workflows/pr-validation.yml | 186 +++++++----------- .github/workflows/release.yml | 289 ++++++++++------------------ .github/workflows/trunk.yml | 206 +++++++++----------- 5 files changed, 334 insertions(+), 457 deletions(-) create mode 100644 .github/workflows/_setup.yml delete mode 100644 .github/workflows/get-variables.yml diff --git a/.github/workflows/_setup.yml b/.github/workflows/_setup.yml new file mode 100644 index 000000000..0c6424bc7 --- /dev/null +++ b/.github/workflows/_setup.yml @@ -0,0 +1,73 @@ +# For more information see: +# - https://docs.github.com/en/actions/using-workflows/reusing-workflows +# - https://docs.github.com/en/actions/using-workflows/reusing-workflows#limitations + +# Note: +# This workflow might be used after code is merged into the master branch. +# The workflow is referenced in other workflows like: +# - ngxs/store/.github/workflows/setup.yml@master +# - ./.github/workflows/setup.yml + +name: setup + +on: + workflow_call: + inputs: + NODE_VERSION: + required: true + type: string + GITHUB_SHA: + required: true + type: string + GITHUB_REF: + required: true + type: string + +jobs: + setup: + runs-on: ubuntu-latest + + steps: + - name: Checkout sources + uses: actions/checkout@v3 + with: + fetch-depth: 0 + ref: ${{ inputs.GITHUB_SHA }} + + - name: Don't save Bash session history + run: unset HISTFILE + + - name: Use Node.js ${{ inputs.NODE_VERSION }} + uses: actions/setup-node@v3 + with: + node-version: ${{ inputs.NODE_VERSION }} + check-latest: true + + - name: Configure kernel (increase watchers) + run: echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p + + - name: Get variables (branch name, commit hash, yarn cache directory) + id: get-variables + run: | + echo "::set-output name=shortref::${inputs.GITHUB_REF#refs/*/}"; + echo "::set-output name=commitsha::$(echo ${inputs.GITHUB_SHA})"; + echo "::set-output name=yarncachedir::$(yarn cache dir)"; + + - name: Workspace cache + uses: actions/cache@v3 + id: workspace-cache + env: + cache-name: workspace-cache + with: + path: | + ~/.cache + ./node_modules + key: ${{ runner.os }}-node-${{ matrix.node-version }}-yarn-${{ hashFiles('**/yarn.lock') }}-branch-${{ steps.get-variables.outputs.shortref }}-workspace-${{ steps.get-variables.outputs.commitsha }} + restore-keys: | + ${{ runner.os }}-node-${{ matrix.node-version }}-yarn-${{ hashFiles('**/yarn.lock') }}-branch-${{ steps.get-variables.outputs.shortref }}-workspace- + ${{ runner.os }}-node-${{ matrix.node-version }}-yarn-${{ hashFiles('**/yarn.lock') }}-branch- + ${{ runner.os }}-node-${{ matrix.node-version }}-yarn- + ${{ runner.os }}- + + - name: Install project dependencies + run: yarn install --frozen-lockfile --non-interactive diff --git a/.github/workflows/get-variables.yml b/.github/workflows/get-variables.yml deleted file mode 100644 index 4eee6638d..000000000 --- a/.github/workflows/get-variables.yml +++ /dev/null @@ -1,37 +0,0 @@ -# For more information see: -# - https://docs.github.com/en/actions/using-workflows/reusing-workflows -# - https://docs.github.com/en/actions/using-workflows/reusing-workflows#limitations - -# Note: -# This workflow might be used after code is merged into the master branch. -# The workflow is referenced in other workflows like: ngxs/store/.github/workflows/get-variables.yml@master - -name: get-variables - -on: - workflow_call: - outputs: - shortref: - description: "Branch name" - value: ${{ jobs.get-variables.outputs.shortref }} - commitsha: - description: "GitHub commit SHA" - value: ${{ jobs.get-variables.outputs.commitsha }} - yarncachedir: - description: "Yarn cache directory" - value: ${{ jobs.get-variables.outputs.yarncachedir }} - -jobs: - get-variables: - name: Get variables (branch name, commit hash, yarn cache directory) - runs-on: ubuntu-latest - outputs: - shortref: ${{ steps.get-variables.outputs.shortref }} - commitsha: ${{ steps.get-variables.outputs.commitsha }} - yarncachedir: ${{ steps.get-variables.outputs.yarncachedir }} - steps: - - id: get-variables - run: | - echo "::set-output name=shortref::${GITHUB_REF#refs/*/}"; - echo "::set-output name=commitsha::$(echo ${GITHUB_SHA})"; - echo "::set-output name=yarncachedir::$(yarn cache dir)"; diff --git a/.github/workflows/pr-validation.yml b/.github/workflows/pr-validation.yml index c070cfa76..f55d22281 100644 --- a/.github/workflows/pr-validation.yml +++ b/.github/workflows/pr-validation.yml @@ -16,135 +16,45 @@ concurrency: cancel-in-progress: true jobs: - ## the reusable job will work after the PR is merged and files are committed to the master branch - # get-variables: - # uses: ./.github/workflows/get-variables.yml - - premerge: + premerge-build: runs-on: ubuntu-latest - # needs: get-variables # this can be uncommented after the reusable job works (see above) strategy: matrix: node-version: [16.x] steps: - - name: Checkout sources - uses: actions/checkout@v3 + - name: Setup + uses: ./.github/workflows/_setup.yml with: - fetch-depth: 0 - ref: ${{ github.event.pull_request.head.sha }} - - - name: Don't save Bash session history - run: unset HISTFILE + NODE_VERSION: ${{ matrix.node-version }} + GITHUB_SHA: ${{ github.event.pull_request.head.sha }} + GITHUB_REF: ${{ github.ref }} - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v3 - with: - node-version: ${{ matrix.node-version }} - check-latest: true + - name: Build NGXS + run: yarn build - - name: Configure kernel (increase watchers) - run: echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p + premerge-test: + runs-on: ubuntu-latest - # this step might be replaced with a reusable workflow get-variables.yml (see above) - - name: Get variables (branch name, commit hash, yarn cache directory) - id: get-variables - run: | - echo "::set-output name=shortref::${GITHUB_REF#refs/*/}"; - echo "::set-output name=commitsha::$(echo ${GITHUB_SHA})"; - echo "::set-output name=yarncachedir::$(yarn cache dir)"; + strategy: + matrix: + node-version: [16.x] + script: [lint, eslint, test:ci, test:types] - - name: Workspace cache - uses: actions/cache@v3 - id: workspace-cache - env: - cache-name: workspace-cache + steps: + - name: Setup + uses: ./.github/workflows/_setup.yml with: - path: | - ~/.cache - ./node_modules - key: ${{ runner.os }}-node-${{ matrix.node-version }}-yarn-${{ hashFiles('**/yarn.lock') }}-branch-${{ steps.get-variables.outputs.shortref }}-workspace-${{ steps.get-variables.outputs.commitsha }} - restore-keys: | - ${{ runner.os }}-node-${{ matrix.node-version }}-yarn-${{ hashFiles('**/yarn.lock') }}-branch-${{ steps.get-variables.outputs.shortref }}-workspace- - ${{ runner.os }}-node-${{ matrix.node-version }}-yarn-${{ hashFiles('**/yarn.lock') }}-branch- - ${{ runner.os }}-node-${{ matrix.node-version }}-yarn- - ${{ runner.os }}- - ## the above might be replaced with the commented code beneath if a reusable workflow get-variables.yml is used (see above) - # key: ${{ runner.os }}-node-${{ matrix.node-version }}-yarn-${{ hashFiles('**/yarn.lock') }}-branch-${{ needs.get-variables.outputs.shortref }}-workspace-${{ needs.get-variables.outputs.commitsha }} - # restore-keys: | - # ${{ runner.os }}-node-${{ matrix.node-version }}-yarn-${{ hashFiles('**/yarn.lock') }}-branch-${{ needs.get-variables.outputs.shortref }}-workspace- - # ${{ runner.os }}-node-${{ matrix.node-version }}-yarn-${{ hashFiles('**/yarn.lock') }}-branch- - # ${{ runner.os }}-node-${{ matrix.node-version }}-yarn- - # ${{ runner.os }}- - - - name: Install project dependencies - run: yarn install --frozen-lockfile --non-interactive - - # Is 'yarn pack --filename ./dist/ngxs-core.tgz' needed during premerge checks? - - name: Compile NGXS and create a pack - run: | - yarn build - yarn pack --filename ./dist/ngxs-core.tgz - - - name: Lint - TSLint - run: yarn lint - - - name: Lint - ESLint - run: yarn eslint - - - name: Unit Tests - run: yarn test:ci - - ## This step was commented in the CircleCI workflows config. - # - name: Integration Tests - # run: yarn test:ci:integration - - ## This step was commented in the CircleCI workflows config. - # - name: E2E Tests - # run: yarn test:ci:e2e - - ## This step was commented in the CircleCI workflows config. - # - name: Integration Tests - SSR - # run: yarn test:ci:integration:ssr - - - name: Integration Tests - ng7 - run: yarn integration:ng7 - - - name: Integration Tests - ng8 - run: yarn integration:ng8 - - - name: Integration Tests - ng9, Ivy off - run: yarn integration:ng9:ivy:off - - - name: Integration Tests - ng9, Ivy - run: yarn integration:ng9:ivy - - - name: Integration Tests - ng10, Ivy off - run: yarn integration:ng10:ivy:off - - - name: Integration Tests - ng10, Ivy - run: yarn integration:ng10:ivy - - - name: Integration Tests - ng11, Ivy off - run: yarn integration:ng11:ivy:off + NODE_VERSION: ${{ matrix.node-version }} + GITHUB_SHA: ${{ github.event.pull_request.head.sha }} + GITHUB_REF: ${{ github.ref }} - - name: Integration Tests - ng11, Ivy - run: yarn integration:ng11:ivy - - - name: Integration Tests - ng12, Ivy - run: yarn integration:ng12:ivy - - - name: Integration Tests - ng13, Ivy - run: yarn integration:ng13:ivy - - - name: Integration Tests - types - run: yarn test:types - - - name: Check the size of NGXS bundle - run: yarn bundlesize + - name: Run ${{ matrix.script }} + run: yarn ${{ matrix.script }} - name: Upload coverage results to Code Climate + if: ${{ matrix.script == 'test:ci' }} run: | curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > /tmp/cc-test-reporter chmod +x /tmp/cc-test-reporter @@ -152,3 +62,53 @@ jobs: env: CC_TEST_REPORTER_ID: 3f4c9a9d57ded045e0f9ab5d23e5bbcbf709bb85637bea555f1233e72134b818 # TODO: better store it in the repository secrets. Name the variable: CC_TEST_REPORTER_ID. Then delete this line and uncomment the next one # CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }} + + premerge-integration-test: + runs-on: ubuntu-latest + needs: premerge-build + + strategy: + matrix: + node-version: [16.x] + script: + - integration:ng7 + - integration:ng8 + - integration:ng9:ivy:off + - integration:ng9:ivy + - integration:ng10:ivy:off + - integration:ng10:ivy + - integration:ng11:ivy:off + - integration:ng11:ivy + - integration:ng12:ivy + - integration:ng13:ivy + + steps: + - name: Setup + uses: ./.github/workflows/_setup.yml + with: + NODE_VERSION: ${{ matrix.node-version }} + GITHUB_SHA: ${{ github.event.pull_request.head.sha }} + GITHUB_REF: ${{ github.ref }} + + - name: Run ${{ matrix.script }} + run: yarn ${{ matrix.script }} + + premerge-bundlesize: + runs-on: ubuntu-latest + needs: premerge-integration-test + + strategy: + matrix: + node-version: [16.x] + script: [bundlesize] + + steps: + - name: Setup + uses: ./.github/workflows/_setup.yml + with: + NODE_VERSION: ${{ matrix.node-version }} + GITHUB_SHA: ${{ github.event.pull_request.head.sha }} + GITHUB_REF: ${{ github.ref }} + + - name: Run ${{ matrix.script }} + run: yarn ${{ matrix.script }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 62a606f77..91f89c6b1 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -4,12 +4,6 @@ name: release -# on: -# push: -# branches: [master] -# tags: ['v.*'] -## Instead of the above, it is better to trigger the workflow when a release is manually created on GutHub via the releases page. -## The above was replicated based on the CircleCI workflows file which does not use the best practices when using GutHub with GitHub Actions CI. on: release: types: @@ -24,203 +18,118 @@ concurrency: cancel-in-progress: true jobs: - ## the reusable job will work after the PR is merged and files are committed to the master branch - # get-variables: - # uses: ngxs/store/.github/workflows/get-variables.yml@master # <- references a reusable workflow file and a branch - - build-release_prod: + release-build: runs-on: ubuntu-latest - # needs: get-variables # this can be uncommented after the reusable job works (see above) strategy: matrix: node-version: [16.x] steps: - - name: Checkout sources - uses: actions/checkout@v3 + - name: Setup + uses: ./.github/workflows/_setup.yml + with: + NODE_VERSION: ${{ matrix.node-version }} + GITHUB_SHA: ${{ github.sha }} + GITHUB_REF: ${{ github.ref }} - - name: Don't save Bash session history - run: unset HISTFILE + - name: Build NGXS + run: yarn build - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v3 + release-test: + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [16.x] + script: [lint, eslint, test:ci, test:types] + + steps: + - name: Setup + uses: ./.github/workflows/_setup.yml with: - node-version: ${{ matrix.node-version }} - check-latest: true + NODE_VERSION: ${{ matrix.node-version }} + GITHUB_SHA: ${{ github.sha }} + GITHUB_REF: ${{ github.ref }} - - name: Configure kernel (increase watchers) - run: echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p + - name: Run ${{ matrix.script }} + run: yarn ${{ matrix.script }} - # this step might be replaced with a reusable workflow get-variables.yml (see above) - - name: Get variables (branch name, commit hash, yarn cache directory) - id: get-variables + - name: Upload coverage results to Code Climate + if: ${{ matrix.script == 'test:ci' }} run: | - echo "::set-output name=shortref::${GITHUB_REF#refs/*/}"; - echo "::set-output name=commitsha::$(echo ${GITHUB_SHA})"; - echo "::set-output name=yarncachedir::$(yarn cache dir)"; - - - name: Workspace cache - uses: actions/cache@v3 - id: workspace-cache + curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > /tmp/cc-test-reporter + chmod +x /tmp/cc-test-reporter + /tmp/cc-test-reporter after-build --coverage-input-type lcov --exit-code 0 env: - cache-name: workspace-cache + CC_TEST_REPORTER_ID: 3f4c9a9d57ded045e0f9ab5d23e5bbcbf709bb85637bea555f1233e72134b818 # TODO: better store it in the repository secrets. Name the variable: CC_TEST_REPORTER_ID. Then delete this line and uncomment the next one + # CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }} + + release-integration-test: + runs-on: ubuntu-latest + needs: release-build + + strategy: + matrix: + node-version: [16.x] + script: + - integration:ng7 + - integration:ng8 + - integration:ng9:ivy:off + - integration:ng9:ivy + - integration:ng10:ivy:off + - integration:ng10:ivy + - integration:ng11:ivy:off + - integration:ng11:ivy + - integration:ng12:ivy + - integration:ng13:ivy + + steps: + - name: Setup + uses: ./.github/workflows/_setup.yml with: - path: | - ~/.cache - ./node_modules - key: ${{ runner.os }}-node-${{ matrix.node-version }}-yarn-${{ hashFiles('**/yarn.lock') }}-branch-${{ steps.get-variables.outputs.shortref }}-workspace-${{ steps.get-variables.outputs.commitsha }} - restore-keys: | - ${{ runner.os }}-node-${{ matrix.node-version }}-yarn-${{ hashFiles('**/yarn.lock') }}-branch-${{ steps.get-variables.outputs.shortref }}-workspace- - ${{ runner.os }}-node-${{ matrix.node-version }}-yarn-${{ hashFiles('**/yarn.lock') }}-branch- - ${{ runner.os }}-node-${{ matrix.node-version }}-yarn- - ${{ runner.os }}- - ## the above might be replaced with the commented code beneath if a reusable workflow get-variables.yml is used (see above) - # key: ${{ runner.os }}-node-${{ matrix.node-version }}-yarn-${{ hashFiles('**/yarn.lock') }}-branch-${{ needs.get-variables.outputs.shortref }}-workspace-${{ needs.get-variables.outputs.commitsha }} - # restore-keys: | - # ${{ runner.os }}-node-${{ matrix.node-version }}-yarn-${{ hashFiles('**/yarn.lock') }}-branch-${{ needs.get-variables.outputs.shortref }}-workspace- - # ${{ runner.os }}-node-${{ matrix.node-version }}-yarn-${{ hashFiles('**/yarn.lock') }}-branch- - # ${{ runner.os }}-node-${{ matrix.node-version }}-yarn- - # ${{ runner.os }}- - - # TODO: verify if this is needed at all - # - name: Set NPM global path - # run: echo 'prefix = ~/.npm' > ~/.npmrc - - - name: Install project dependencies - run: yarn install --frozen-lockfile --non-interactive - - - name: Compile NGXS and create a pack + NODE_VERSION: ${{ matrix.node-version }} + GITHUB_SHA: ${{ github.sha }} + GITHUB_REF: ${{ github.ref }} + + - name: Run ${{ matrix.script }} + run: yarn ${{ matrix.script }} + + release-bundlesize: + runs-on: ubuntu-latest + needs: release-integration-test + + strategy: + matrix: + node-version: [16.x] + script: [bundlesize] + + steps: + - name: Setup + uses: ./.github/workflows/_setup.yml + with: + NODE_VERSION: ${{ matrix.node-version }} + GITHUB_SHA: ${{ github.sha }} + GITHUB_REF: ${{ github.ref }} + + - name: Run ${{ matrix.script }} + run: yarn ${{ matrix.script }} + + release-publish: + runs-on: ubuntu-latest + environment: npm-publish + needs: [release-build, release-test, release-integration-test, release-bundlesize] + + steps: + - name: Setup + uses: ./.github/workflows/_setup.yml + with: + NODE_VERSION: 16.x + GITHUB_SHA: ${{ github.sha }} + GITHUB_REF: ${{ github.ref }} + + - name: Production release - publish tagged builds to all @ngxs packages run: | - yarn build - yarn pack --filename ./dist/ngxs-core.tgz - - ## All steps marked with this comment don't seem to be needed for tagged builds (aka releases), because each tagged build will happen only after a respective dev build, - ## if releases are built off the trunk after dev builds. - ## Dev builds happen automatically when something is merged into the trunk (it should not be possible to push into the trunk directly) and there is no tag. - # - name: Lint - TSLint - # run: yarn lint - - ## All steps marked with this comment don't seem to be needed for tagged builds (aka releases), because each tagged build will happen only after a respective dev build, - ## if releases are built off the trunk after dev builds. - ## Dev builds happen automatically when something is merged into the trunk (it should not be possible to push into the trunk directly) and there is no tag. - # - name: Lint - ESLint - # run: yarn eslint - - ## All steps marked with this comment don't seem to be needed for tagged builds (aka releases), because each tagged build will happen only after a respective dev build, - ## if releases are built off the trunk after dev builds. - ## Dev builds happen automatically when something is merged into the trunk (it should not be possible to push into the trunk directly) and there is no tag. - # - name: Unit Tests - # run: yarn test:ci - - ## All steps marked with this comment don't seem to be needed for tagged builds (aka releases), because each tagged build will happen only after a respective dev build, - ## if releases are built off the trunk after dev builds. - ## Dev builds happen automatically when something is merged into the trunk (it should not be possible to push into the trunk directly) and there is no tag. - ## This step was commented in the CircleCI workflows config. - ## - name: Integration Tests - ## run: yarn test:ci:integration - - ## All steps marked with this comment don't seem to be needed for tagged builds (aka releases), because each tagged build will happen only after a respective dev build, - ## if releases are built off the trunk after dev builds. - ## Dev builds happen automatically when something is merged into the trunk (it should not be possible to push into the trunk directly) and there is no tag. - ## This step was commented in the CircleCI workflows config. - ## - name: E2E Tests - ## run: yarn test:ci:e2e - - ## All steps marked with this comment don't seem to be needed for tagged builds (aka releases), because each tagged build will happen only after a respective dev build, - ## if releases are built off the trunk after dev builds. - ## Dev builds happen automatically when something is merged into the trunk (it should not be possible to push into the trunk directly) and there is no tag. - ## This step was commented in the CircleCI workflows config. - ## - name: Integration Tests - SSR - ## run: yarn test:ci:integration:ssr - - ## All steps marked with this comment don't seem to be needed for tagged builds (aka releases), because each tagged build will happen only after a respective dev build, - ## if releases are built off the trunk after dev builds. - ## Dev builds happen automatically when something is merged into the trunk (it should not be possible to push into the trunk directly) and there is no tag. - # - name: Integration Tests - ng7 - # run: yarn integration:ng7 - - ## All steps marked with this comment don't seem to be needed for tagged builds (aka releases), because each tagged build will happen only after a respective dev build, - ## if releases are built off the trunk after dev builds. - ## Dev builds happen automatically when something is merged into the trunk (it should not be possible to push into the trunk directly) and there is no tag. - # - name: Integration Tests - ng8 - # run: yarn integration:ng8 - - ## All steps marked with this comment don't seem to be needed for tagged builds (aka releases), because each tagged build will happen only after a respective dev build, - ## if releases are built off the trunk after dev builds. - ## Dev builds happen automatically when something is merged into the trunk (it should not be possible to push into the trunk directly) and there is no tag. - # - name: Integration Tests - ng9, Ivy off - # run: yarn integration:ng9:ivy:off - - ## All steps marked with this comment don't seem to be needed for tagged builds (aka releases), because each tagged build will happen only after a respective dev build, - ## if releases are built off the trunk after dev builds. - ## Dev builds happen automatically when something is merged into the trunk (it should not be possible to push into the trunk directly) and there is no tag. - # - name: Integration Tests - ng9, Ivy - # run: yarn integration:ng9:ivy - - ## All steps marked with this comment don't seem to be needed for tagged builds (aka releases), because each tagged build will happen only after a respective dev build, - ## if releases are built off the trunk after dev builds. - ## Dev builds happen automatically when something is merged into the trunk (it should not be possible to push into the trunk directly) and there is no tag. - # - name: Integration Tests - ng10, Ivy off - # run: yarn integration:ng10:ivy:off - - ## All steps marked with this comment don't seem to be needed for tagged builds (aka releases), because each tagged build will happen only after a respective dev build, - ## if releases are built off the trunk after dev builds. - ## Dev builds happen automatically when something is merged into the trunk (it should not be possible to push into the trunk directly) and there is no tag. - # - name: Integration Tests - ng10, Ivy - # run: yarn integration:ng10:ivy - - ## All steps marked with this comment don't seem to be needed for tagged builds (aka releases), because each tagged build will happen only after a respective dev build, - ## if releases are built off the trunk after dev builds. - ## Dev builds happen automatically when something is merged into the trunk (it should not be possible to push into the trunk directly) and there is no tag. - # - name: Integration Tests - ng11, Ivy off - # run: yarn integration:ng11:ivy:off - - ## All steps marked with this comment don't seem to be needed for tagged builds (aka releases), because each tagged build will happen only after a respective dev build, - ## if releases are built off the trunk after dev builds. - ## Dev builds happen automatically when something is merged into the trunk (it should not be possible to push into the trunk directly) and there is no tag. - # - name: Integration Tests - ng11, Ivy - # run: yarn integration:ng11:ivy - - ## All steps marked with this comment don't seem to be needed for tagged builds (aka releases), because each tagged build will happen only after a respective dev build, - ## if releases are built off the trunk after dev builds. - ## Dev builds happen automatically when something is merged into the trunk (it should not be possible to push into the trunk directly) and there is no tag. - # - name: Integration Tests - ng12, Ivy - # run: yarn integration:ng12:ivy - - ## All steps marked with this comment don't seem to be needed for tagged builds (aka releases), because each tagged build will happen only after a respective dev build, - ## if releases are built off the trunk after dev builds. - ## Dev builds happen automatically when something is merged into the trunk (it should not be possible to push into the trunk directly) and there is no tag. - # - name: Integration Tests - ng13, Ivy - # run: yarn integration:ng13:ivy - - ## All steps marked with this comment don't seem to be needed for tagged builds (aka releases), because each tagged build will happen only after a respective dev build, - ## if releases are built off the trunk after dev builds. - ## Dev builds happen automatically when something is merged into the trunk (it should not be possible to push into the trunk directly) and there is no tag. - # - name: Integration Tests - types - # run: yarn test:types - - ## All steps marked with this comment don't seem to be needed for tagged builds (aka releases), because each tagged build will happen only after a respective dev build, - ## if releases are built off the trunk after dev builds. - ## Dev builds happen automatically when something is merged into the trunk (it should not be possible to push into the trunk directly) and there is no tag. - # - name: Check the size of NGXS bundle - # run: yarn bundlesize - - ## All steps marked with this comment don't seem to be needed for tagged builds (aka releases), because each tagged build will happen only after a respective dev build, - ## if releases are built off the trunk after dev builds. - ## Dev builds happen automatically when something is merged into the trunk (it should not be possible to push into the trunk directly) and there is no tag. - # - name: Upload coverage results to Code Climate - # run: | - # curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > /tmp/cc-test-reporter - # chmod +x /tmp/cc-test-reporter - # /tmp/cc-test-reporter after-build --coverage-input-type lcov --exit-code 0 - # env: - # CC_TEST_REPORTER_ID: 3f4c9a9d57ded045e0f9ab5d23e5bbcbf709bb85637bea555f1233e72134b818 # TODO: better store it in the repository secrets. Name the variable: CC_TEST_REPORTER_ID. Then delete this line and uncomment the next one - # # CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }} - - # TODO: uncommen after several test runs of the workflow - # - name: Production release - publish tagged builds to all @ngxs packages - # run: | - # echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc - # yarn publish:tagged - # find ~/.npmrc -exec shred -fuz {} + + echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc + yarn publish:tagged + find ~/.npmrc -exec shred -fuz {} + diff --git a/.github/workflows/trunk.yml b/.github/workflows/trunk.yml index e6d91ab5b..66489c794 100644 --- a/.github/workflows/trunk.yml +++ b/.github/workflows/trunk.yml @@ -18,146 +18,118 @@ concurrency: cancel-in-progress: true jobs: - ## the reusable job will work after the PR is merged and files are committed to the master branch - # get-variables: - # uses: ngxs/store/.github/workflows/get-variables.yml@master # <- references a reusable workflow file and a branch - - build-lint-test-release_dev: + trunk-build: runs-on: ubuntu-latest - # needs: get-variables # this can be uncommented after the reusable job works (see above) strategy: matrix: node-version: [16.x] steps: - - name: Checkout sources - uses: actions/checkout@v3 - - - name: Don't save Bash session history - run: unset HISTFILE - - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v3 + - name: Setup + uses: ./.github/workflows/_setup.yml with: - node-version: ${{ matrix.node-version }} - check-latest: true + NODE_VERSION: ${{ matrix.node-version }} + GITHUB_SHA: ${{ github.sha }} + GITHUB_REF: ${{ github.ref }} - - name: Configure kernel (increase watchers) - run: echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p + - name: Build NGXS + run: yarn build - # this step might be replaced with a reusable workflow get-variables.yml (see above) - - name: Get variables (branch name, commit hash, yarn cache directory) - id: get-variables - run: | - echo "::set-output name=shortref::${GITHUB_REF#refs/*/}"; - echo "::set-output name=commitsha::$(echo ${GITHUB_SHA})"; - echo "::set-output name=yarncachedir::$(yarn cache dir)"; - - - name: Workspace cache - uses: actions/cache@v3 - id: workspace-cache - env: - cache-name: workspace-cache - with: - path: | - ~/.cache - ./node_modules - key: ${{ runner.os }}-node-${{ matrix.node-version }}-yarn-${{ hashFiles('**/yarn.lock') }}-branch-${{ steps.get-variables.outputs.shortref }}-workspace-${{ steps.get-variables.outputs.commitsha }} - restore-keys: | - ${{ runner.os }}-node-${{ matrix.node-version }}-yarn-${{ hashFiles('**/yarn.lock') }}-branch-${{ steps.get-variables.outputs.shortref }}-workspace- - ${{ runner.os }}-node-${{ matrix.node-version }}-yarn-${{ hashFiles('**/yarn.lock') }}-branch- - ${{ runner.os }}-node-${{ matrix.node-version }}-yarn- - ${{ runner.os }}- - ## the above might be replaced with the commented code beneath if a reusable workflow get-variables.yml is used (see above) - # key: ${{ runner.os }}-node-${{ matrix.node-version }}-yarn-${{ hashFiles('**/yarn.lock') }}-branch-${{ needs.get-variables.outputs.shortref }}-workspace-${{ needs.get-variables.outputs.commitsha }} - # restore-keys: | - # ${{ runner.os }}-node-${{ matrix.node-version }}-yarn-${{ hashFiles('**/yarn.lock') }}-branch-${{ needs.get-variables.outputs.shortref }}-workspace- - # ${{ runner.os }}-node-${{ matrix.node-version }}-yarn-${{ hashFiles('**/yarn.lock') }}-branch- - # ${{ runner.os }}-node-${{ matrix.node-version }}-yarn- - # ${{ runner.os }}- - - # TODO: verify if this is needed at all - # - name: Set NPM global path - # run: echo 'prefix = ~/.npm' > ~/.npmrc - - - name: Install project dependencies - run: yarn install --frozen-lockfile --non-interactive - - - name: Compile NGXS and create a pack - run: | - yarn build - yarn pack --filename ./dist/ngxs-core.tgz - - - name: Lint - TSLint - run: yarn lint - - - name: Lint - ESLint - run: yarn eslint - - - name: Unit Tests - run: yarn test:ci - - # This step was commented in the CircleCI workflows config. - # - name: Integration Tests - # run: yarn test:ci:integration + trunk-test: + runs-on: ubuntu-latest - # This step was commented in the CircleCI workflows config. - # - name: E2E Tests - # run: yarn test:ci:e2e + strategy: + matrix: + node-version: [16.x] + script: [lint, eslint, test:ci, test:types] - # This step was commented in the CircleCI workflows config. - # - name: Integration Tests - SSR - # run: yarn test:ci:integration:ssr + steps: + - name: Setup + uses: ./.github/workflows/_setup.yml + with: + NODE_VERSION: ${{ matrix.node-version }} + GITHUB_SHA: ${{ github.sha }} + GITHUB_REF: ${{ github.ref }} - - name: Integration Tests - ng7 - run: yarn integration:ng7 + - name: Run ${{ matrix.script }} + run: yarn ${{ matrix.script }} - - name: Integration Tests - ng8 - run: yarn integration:ng8 + - name: Upload coverage results to Code Climate + if: ${{ matrix.script == 'test:ci' }} + run: | + curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > /tmp/cc-test-reporter + chmod +x /tmp/cc-test-reporter + /tmp/cc-test-reporter after-build --coverage-input-type lcov --exit-code 0 + env: + CC_TEST_REPORTER_ID: 3f4c9a9d57ded045e0f9ab5d23e5bbcbf709bb85637bea555f1233e72134b818 # TODO: better store it in the repository secrets. Name the variable: CC_TEST_REPORTER_ID. Then delete this line and uncomment the next one + # CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }} - - name: Integration Tests - ng9, Ivy off - run: yarn integration:ng9:ivy:off + trunk-integration-test: + runs-on: ubuntu-latest + needs: trunk-build - - name: Integration Tests - ng9, Ivy - run: yarn integration:ng9:ivy + strategy: + matrix: + node-version: [16.x] + script: + - integration:ng7 + - integration:ng8 + - integration:ng9:ivy:off + - integration:ng9:ivy + - integration:ng10:ivy:off + - integration:ng10:ivy + - integration:ng11:ivy:off + - integration:ng11:ivy + - integration:ng12:ivy + - integration:ng13:ivy - - name: Integration Tests - ng10, Ivy off - run: yarn integration:ng10:ivy:off + steps: + - name: Setup + uses: ./.github/workflows/_setup.yml + with: + NODE_VERSION: ${{ matrix.node-version }} + GITHUB_SHA: ${{ github.sha }} + GITHUB_REF: ${{ github.ref }} - - name: Integration Tests - ng10, Ivy - run: yarn integration:ng10:ivy + - name: Run ${{ matrix.script }} + run: yarn ${{ matrix.script }} - - name: Integration Tests - ng11, Ivy off - run: yarn integration:ng11:ivy:off + trunk-bundlesize: + runs-on: ubuntu-latest + needs: trunk-integration-test - - name: Integration Tests - ng11, Ivy - run: yarn integration:ng11:ivy + strategy: + matrix: + node-version: [16.x] + script: [bundlesize] - - name: Integration Tests - ng12, Ivy - run: yarn integration:ng12:ivy + steps: + - name: Setup + uses: ./.github/workflows/_setup.yml + with: + NODE_VERSION: ${{ matrix.node-version }} + GITHUB_SHA: ${{ github.sha }} + GITHUB_REF: ${{ github.ref }} - - name: Integration Tests - ng13, Ivy - run: yarn integration:ng13:ivy + - name: Run ${{ matrix.script }} + run: yarn ${{ matrix.script }} - - name: Integration Tests - types - run: yarn test:types + trunk-publish: + runs-on: ubuntu-latest + environment: npm-publish + needs: [trunk-build, trunk-test, trunk-integration-test, trunk-bundlesize] - - name: Check the size of NGXS bundle - run: yarn bundlesize + steps: + - name: Setup + uses: ./.github/workflows/_setup.yml + with: + NODE_VERSION: 16.x + GITHUB_SHA: ${{ github.sha }} + GITHUB_REF: ${{ github.ref }} - - name: Upload coverage results to Code Climate + - name: Development release - publish development builds to all @ngxs packages run: | - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > /tmp/cc-test-reporter - chmod +x /tmp/cc-test-reporter - /tmp/cc-test-reporter after-build --coverage-input-type lcov --exit-code 0 - env: - CC_TEST_REPORTER_ID: 3f4c9a9d57ded045e0f9ab5d23e5bbcbf709bb85637bea555f1233e72134b818 # TODO: better store it in the repository secrets. Name the variable: CC_TEST_REPORTER_ID. Then delete this line and uncomment the next one - # CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }} - - # TODO: uncommen after several test runs of the workflow - # - name: Development release - publish development builds to all @ngxs packages - # run: | - # echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc - # yarn publish:dev - # find ~/.npmrc -exec shred -fuz {} + + echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc + yarn publish:dev + find ~/.npmrc -exec shred -fuz {} + From 0a08b13b66aea44cfad8ffd7be4726382cfc2877 Mon Sep 17 00:00:00 2001 From: rfprod Date: Sat, 11 Jun 2022 13:14:38 +0300 Subject: [PATCH 08/26] ci(logging): echo explanation of the 'find ... shred ...' command --- .github/workflows/release.yml | 1 + .github/workflows/trunk.yml | 1 + 2 files changed, 2 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 91f89c6b1..f9b61c4a0 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -132,4 +132,5 @@ jobs: run: | echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc yarn publish:tagged + echo "Security: remove ~/.npmrc from the runner overwriting it with zeros several times." find ~/.npmrc -exec shred -fuz {} + diff --git a/.github/workflows/trunk.yml b/.github/workflows/trunk.yml index 66489c794..cff77768f 100644 --- a/.github/workflows/trunk.yml +++ b/.github/workflows/trunk.yml @@ -132,4 +132,5 @@ jobs: run: | echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc yarn publish:dev + echo "Security: remove ~/.npmrc from the runner overwriting it with zeros several times." find ~/.npmrc -exec shred -fuz {} + From edff7ffc3ac641b2111717e23c69c75a4d3ad065 Mon Sep 17 00:00:00 2001 From: rfprod Date: Sat, 11 Jun 2022 17:08:07 +0300 Subject: [PATCH 09/26] ci(artifacts): check build artifacts workflow - [x] add a reusable workflow to check for build artifacts; --- .github/workflows/_check-build-artifacts.yml | 41 ++++++++++++++++++++ .github/workflows/_setup.yml | 8 ++-- .github/workflows/pr-validation.yml | 6 +-- .github/workflows/release.yml | 9 ++--- .github/workflows/trunk.yml | 9 ++--- 5 files changed, 54 insertions(+), 19 deletions(-) create mode 100644 .github/workflows/_check-build-artifacts.yml diff --git a/.github/workflows/_check-build-artifacts.yml b/.github/workflows/_check-build-artifacts.yml new file mode 100644 index 000000000..ac8da50c0 --- /dev/null +++ b/.github/workflows/_check-build-artifacts.yml @@ -0,0 +1,41 @@ +# For more information see: +# - https://docs.github.com/en/actions/using-workflows/reusing-workflows +# - https://docs.github.com/en/actions/using-workflows/reusing-workflows#limitations + +# Note: +# The workflow can be referenced in other workflows like: +# - ngxs/store/.github/workflows/_check-build-artifacts.yml@master +# - ./.github/workflows/_check-build-artifacts.yml + +name: check-build-artifacts + +on: + workflow_call: + +jobs: + check-build-artifacts: + runs-on: ubuntu-latest + + steps: + - name: Check @ngxs build artifacts + run: | + echo "Making sure the build artifact directories exist." + [[ -d $DEVTOOLS_PLUG_ART ]] && echo "$DEVTOOLS_PLUG_ART $OK" || echo "$DEVTOOLS_PLUG_ART $FAILURE" exit 1 + [[ -d $FORM_PLUG_ART ]] && echo "$FORM_PLUG_ART $OK" || echo "$DEVTOOLS_PLUG_ART $FAILURE" exit 1 + [[ -d $HMR_PLUG_ART ]] && echo "$HMR_PLUG_ART $OK" || echo "$HMR_PLUG_ART $FAILURE" exit 1 + [[ -d $LOGGER_PLUG_ART ]] && echo "$LOGGER_PLUG_ART $OK" || echo "$LOGGER_PLUG_ART $FAILURE" exit 1 + [[ -d $ROUTER_PLUG_ART ]] && echo "$ROUTER_PLUG_ART $OK" || echo "$ROUTER_PLUG_ART $FAILURE" exit 1 + [[ -d $STORAGE_PLUG_ART ]] && echo "$STORAGE_PLUG_ART $OK" || echo "$STORAGE_PLUG_ART $FAILURE" exit 1 + [[ -d $STORE_ART ]] && echo "$STORE_ART $OK" || echo "$STORE_ART $FAILURE" exit 1 + [[ -d $WEBSOCKET_PLUG_ART ]] && echo "$WEBSOCKET_PLUG_ART $OK" || echo "$WEBSOCKET_PLUG_ART $FAILURE" exit 1 + env: + OK: 'exists' + FAILURE: 'does not exist' + DEVTOOLS_PLUG_ART: './@ngxs/devtools-plugin' + FORM_PLUG_ART: './@ngxs/form-plugin' + HMR_PLUG_ART: './@ngxs/hmr-plugin' + LOGGER_PLUG_ART: './@ngxs/logger-plugin' + ROUTER_PLUG_ART: './@ngxs/router-plugin' + STORAGE_PLUG_ART: './@ngxs/storage-plugin' + STORE_ART: './@ngxs/store' + WEBSOCKET_PLUG_ART: './@ngxs/websocket-plugin' diff --git a/.github/workflows/_setup.yml b/.github/workflows/_setup.yml index 0c6424bc7..246a7e509 100644 --- a/.github/workflows/_setup.yml +++ b/.github/workflows/_setup.yml @@ -3,10 +3,9 @@ # - https://docs.github.com/en/actions/using-workflows/reusing-workflows#limitations # Note: -# This workflow might be used after code is merged into the master branch. -# The workflow is referenced in other workflows like: -# - ngxs/store/.github/workflows/setup.yml@master -# - ./.github/workflows/setup.yml +# The workflow can be referenced in other workflows like: +# - ngxs/store/.github/workflows/_setup.yml@master +# - ./.github/workflows/_setup.yml name: setup @@ -62,6 +61,7 @@ jobs: path: | ~/.cache ./node_modules + ./@ngxs key: ${{ runner.os }}-node-${{ matrix.node-version }}-yarn-${{ hashFiles('**/yarn.lock') }}-branch-${{ steps.get-variables.outputs.shortref }}-workspace-${{ steps.get-variables.outputs.commitsha }} restore-keys: | ${{ runner.os }}-node-${{ matrix.node-version }}-yarn-${{ hashFiles('**/yarn.lock') }}-branch-${{ steps.get-variables.outputs.shortref }}-workspace- diff --git a/.github/workflows/pr-validation.yml b/.github/workflows/pr-validation.yml index f55d22281..cadb36b67 100644 --- a/.github/workflows/pr-validation.yml +++ b/.github/workflows/pr-validation.yml @@ -19,15 +19,11 @@ jobs: premerge-build: runs-on: ubuntu-latest - strategy: - matrix: - node-version: [16.x] - steps: - name: Setup uses: ./.github/workflows/_setup.yml with: - NODE_VERSION: ${{ matrix.node-version }} + NODE_VERSION: 16.x GITHUB_SHA: ${{ github.event.pull_request.head.sha }} GITHUB_REF: ${{ github.ref }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f9b61c4a0..3ab95c37e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -21,15 +21,11 @@ jobs: release-build: runs-on: ubuntu-latest - strategy: - matrix: - node-version: [16.x] - steps: - name: Setup uses: ./.github/workflows/_setup.yml with: - NODE_VERSION: ${{ matrix.node-version }} + NODE_VERSION: 16.x GITHUB_SHA: ${{ github.sha }} GITHUB_REF: ${{ github.ref }} @@ -128,6 +124,9 @@ jobs: GITHUB_SHA: ${{ github.sha }} GITHUB_REF: ${{ github.ref }} + - name: Check @ngxs build artifacts + uses: ./.github/workflows/_check-artifacts.yml + - name: Production release - publish tagged builds to all @ngxs packages run: | echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc diff --git a/.github/workflows/trunk.yml b/.github/workflows/trunk.yml index cff77768f..514c96f20 100644 --- a/.github/workflows/trunk.yml +++ b/.github/workflows/trunk.yml @@ -21,15 +21,11 @@ jobs: trunk-build: runs-on: ubuntu-latest - strategy: - matrix: - node-version: [16.x] - steps: - name: Setup uses: ./.github/workflows/_setup.yml with: - NODE_VERSION: ${{ matrix.node-version }} + NODE_VERSION: 16.x GITHUB_SHA: ${{ github.sha }} GITHUB_REF: ${{ github.ref }} @@ -128,6 +124,9 @@ jobs: GITHUB_SHA: ${{ github.sha }} GITHUB_REF: ${{ github.ref }} + - name: Check @ngxs build artifacts + uses: ./.github/workflows/_check-artifacts.yml + - name: Development release - publish development builds to all @ngxs packages run: | echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc From 9130bb84c61da54b24277fb932ffeda8ec71abae Mon Sep 17 00:00:00 2001 From: rfprod Date: Sat, 11 Jun 2022 21:06:29 +0300 Subject: [PATCH 10/26] ci(setup): fix setup workflow - get node version from inputs --- .github/workflows/_setup.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/_setup.yml b/.github/workflows/_setup.yml index 246a7e509..cc0073c6a 100644 --- a/.github/workflows/_setup.yml +++ b/.github/workflows/_setup.yml @@ -62,11 +62,11 @@ jobs: ~/.cache ./node_modules ./@ngxs - key: ${{ runner.os }}-node-${{ matrix.node-version }}-yarn-${{ hashFiles('**/yarn.lock') }}-branch-${{ steps.get-variables.outputs.shortref }}-workspace-${{ steps.get-variables.outputs.commitsha }} + key: ${{ runner.os }}-node-${{ inputs.NODE_VERSION }}-yarn-${{ hashFiles('**/yarn.lock') }}-branch-${{ steps.get-variables.outputs.shortref }}-workspace-${{ steps.get-variables.outputs.commitsha }} restore-keys: | - ${{ runner.os }}-node-${{ matrix.node-version }}-yarn-${{ hashFiles('**/yarn.lock') }}-branch-${{ steps.get-variables.outputs.shortref }}-workspace- - ${{ runner.os }}-node-${{ matrix.node-version }}-yarn-${{ hashFiles('**/yarn.lock') }}-branch- - ${{ runner.os }}-node-${{ matrix.node-version }}-yarn- + ${{ runner.os }}-node-${{ inputs.NODE_VERSION }}-yarn-${{ hashFiles('**/yarn.lock') }}-branch-${{ steps.get-variables.outputs.shortref }}-workspace- + ${{ runner.os }}-node-${{ inputs.NODE_VERSION }}-yarn-${{ hashFiles('**/yarn.lock') }}-branch- + ${{ runner.os }}-node-${{ inputs.NODE_VERSION }}-yarn- ${{ runner.os }}- - name: Install project dependencies From f63ad6cb5607f507e5b4232e943ebde71ee2794e Mon Sep 17 00:00:00 2001 From: rfprod Date: Sat, 11 Jun 2022 21:48:58 +0300 Subject: [PATCH 11/26] ci(artifacts): save app/integrations dists to workspace cache --- .github/workflows/_setup.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/_setup.yml b/.github/workflows/_setup.yml index cc0073c6a..ebc2b920b 100644 --- a/.github/workflows/_setup.yml +++ b/.github/workflows/_setup.yml @@ -62,6 +62,10 @@ jobs: ~/.cache ./node_modules ./@ngxs + ./app/integrations/hello-world-ng11-ivy/dist-integration + ./app/integrations/hello-world-ng12-ivy/dist-integration + ./app/integrations/hello-world-ng13-ivy/dist-integration + ./app/integrations/hello-world-ng14-ivy/dist-integration key: ${{ runner.os }}-node-${{ inputs.NODE_VERSION }}-yarn-${{ hashFiles('**/yarn.lock') }}-branch-${{ steps.get-variables.outputs.shortref }}-workspace-${{ steps.get-variables.outputs.commitsha }} restore-keys: | ${{ runner.os }}-node-${{ inputs.NODE_VERSION }}-yarn-${{ hashFiles('**/yarn.lock') }}-branch-${{ steps.get-variables.outputs.shortref }}-workspace- From 1d6db8bf2109b0904e33f2af7bac0ba8ccdec42d Mon Sep 17 00:00:00 2001 From: rfprod Date: Sat, 11 Jun 2022 22:15:49 +0300 Subject: [PATCH 12/26] ci(actions): convert reusable workflows to composite actions --- .github/actions/check-build-artifacts.yml | 36 +++++++++ .github/actions/setup.yml | 73 +++++++++++++++++++ .github/workflows/_check-build-artifacts.yml | 41 ----------- .github/workflows/_setup.yml | 77 -------------------- .github/workflows/pr-validation.yml | 8 +- .github/workflows/release.yml | 12 +-- .github/workflows/trunk.yml | 12 +-- 7 files changed, 125 insertions(+), 134 deletions(-) create mode 100644 .github/actions/check-build-artifacts.yml create mode 100644 .github/actions/setup.yml delete mode 100644 .github/workflows/_check-build-artifacts.yml delete mode 100644 .github/workflows/_setup.yml diff --git a/.github/actions/check-build-artifacts.yml b/.github/actions/check-build-artifacts.yml new file mode 100644 index 000000000..c8d687fa9 --- /dev/null +++ b/.github/actions/check-build-artifacts.yml @@ -0,0 +1,36 @@ +# For more information see: +# - https://docs.github.com/en/actions/using-workflows/reusing-workflows +# - https://docs.github.com/en/actions/using-workflows/reusing-workflows#limitations + +# Note: +# The workflow can be referenced in other workflows like: +# - ngxs/store/.github/actions/check-build-artifacts.yml@master +# - ./.github/actions/check-build-artifacts.yml + +name: check-build-artifacts + +runs: + using: 'composite' + steps: + - name: Check @ngxs build artifacts + run: | + echo "Making sure the build artifact directories exist." + [[ -d $DEVTOOLS_PLUG_ART ]] && echo "$DEVTOOLS_PLUG_ART $OK" || echo "$DEVTOOLS_PLUG_ART $FAILURE" exit 1 + [[ -d $FORM_PLUG_ART ]] && echo "$FORM_PLUG_ART $OK" || echo "$DEVTOOLS_PLUG_ART $FAILURE" exit 1 + [[ -d $HMR_PLUG_ART ]] && echo "$HMR_PLUG_ART $OK" || echo "$HMR_PLUG_ART $FAILURE" exit 1 + [[ -d $LOGGER_PLUG_ART ]] && echo "$LOGGER_PLUG_ART $OK" || echo "$LOGGER_PLUG_ART $FAILURE" exit 1 + [[ -d $ROUTER_PLUG_ART ]] && echo "$ROUTER_PLUG_ART $OK" || echo "$ROUTER_PLUG_ART $FAILURE" exit 1 + [[ -d $STORAGE_PLUG_ART ]] && echo "$STORAGE_PLUG_ART $OK" || echo "$STORAGE_PLUG_ART $FAILURE" exit 1 + [[ -d $STORE_ART ]] && echo "$STORE_ART $OK" || echo "$STORE_ART $FAILURE" exit 1 + [[ -d $WEBSOCKET_PLUG_ART ]] && echo "$WEBSOCKET_PLUG_ART $OK" || echo "$WEBSOCKET_PLUG_ART $FAILURE" exit 1 + env: + OK: 'exists' + FAILURE: 'does not exist' + DEVTOOLS_PLUG_ART: './@ngxs/devtools-plugin' + FORM_PLUG_ART: './@ngxs/form-plugin' + HMR_PLUG_ART: './@ngxs/hmr-plugin' + LOGGER_PLUG_ART: './@ngxs/logger-plugin' + ROUTER_PLUG_ART: './@ngxs/router-plugin' + STORAGE_PLUG_ART: './@ngxs/storage-plugin' + STORE_ART: './@ngxs/store' + WEBSOCKET_PLUG_ART: './@ngxs/websocket-plugin' diff --git a/.github/actions/setup.yml b/.github/actions/setup.yml new file mode 100644 index 000000000..dd8595841 --- /dev/null +++ b/.github/actions/setup.yml @@ -0,0 +1,73 @@ +# For more information see: +# - https://docs.github.com/en/actions/using-workflows/reusing-workflows +# - https://docs.github.com/en/actions/using-workflows/reusing-workflows#limitations + +# Note: +# The workflow can be referenced in other workflows like: +# - ngxs/store/.github/workflows/_setup.yml@master +# - ./.github/workflows/_setup.yml + +name: setup + +inputs: + NODE_VERSION: + required: true + type: string + GITHUB_SHA: + required: true + type: string + GITHUB_REF: + required: true + type: string + +runs: + using: 'composite' + steps: + - name: Checkout sources + uses: actions/checkout@v3 + with: + fetch-depth: 0 + ref: ${{ inputs.GITHUB_SHA }} + + - name: Don't save Bash session history + run: unset HISTFILE + + - name: Use Node.js ${{ inputs.NODE_VERSION }} + uses: actions/setup-node@v3 + with: + node-version: ${{ inputs.NODE_VERSION }} + check-latest: true + + - name: Configure kernel (increase watchers) + run: echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p + + - name: Get variables (branch name, commit hash, yarn cache directory) + id: get-variables + run: | + echo "::set-output name=shortref::${inputs.GITHUB_REF#refs/*/}"; + echo "::set-output name=commitsha::$(echo ${inputs.GITHUB_SHA})"; + echo "::set-output name=yarncachedir::$(yarn cache dir)"; + + - name: Workspace cache + uses: actions/cache@v3 + id: workspace-cache + env: + cache-name: workspace-cache + with: + path: | + ~/.cache + ./node_modules + ./@ngxs + ./app/integrations/hello-world-ng11-ivy/dist-integration + ./app/integrations/hello-world-ng12-ivy/dist-integration + ./app/integrations/hello-world-ng13-ivy/dist-integration + ./app/integrations/hello-world-ng14-ivy/dist-integration + key: ${{ runner.os }}-node-${{ inputs.NODE_VERSION }}-yarn-${{ hashFiles('**/yarn.lock') }}-branch-${{ steps.get-variables.outputs.shortref }}-workspace-${{ steps.get-variables.outputs.commitsha }} + restore-keys: | + ${{ runner.os }}-node-${{ inputs.NODE_VERSION }}-yarn-${{ hashFiles('**/yarn.lock') }}-branch-${{ steps.get-variables.outputs.shortref }}-workspace- + ${{ runner.os }}-node-${{ inputs.NODE_VERSION }}-yarn-${{ hashFiles('**/yarn.lock') }}-branch- + ${{ runner.os }}-node-${{ inputs.NODE_VERSION }}-yarn- + ${{ runner.os }}- + + - name: Install project dependencies + run: yarn install --frozen-lockfile --non-interactive diff --git a/.github/workflows/_check-build-artifacts.yml b/.github/workflows/_check-build-artifacts.yml deleted file mode 100644 index ac8da50c0..000000000 --- a/.github/workflows/_check-build-artifacts.yml +++ /dev/null @@ -1,41 +0,0 @@ -# For more information see: -# - https://docs.github.com/en/actions/using-workflows/reusing-workflows -# - https://docs.github.com/en/actions/using-workflows/reusing-workflows#limitations - -# Note: -# The workflow can be referenced in other workflows like: -# - ngxs/store/.github/workflows/_check-build-artifacts.yml@master -# - ./.github/workflows/_check-build-artifacts.yml - -name: check-build-artifacts - -on: - workflow_call: - -jobs: - check-build-artifacts: - runs-on: ubuntu-latest - - steps: - - name: Check @ngxs build artifacts - run: | - echo "Making sure the build artifact directories exist." - [[ -d $DEVTOOLS_PLUG_ART ]] && echo "$DEVTOOLS_PLUG_ART $OK" || echo "$DEVTOOLS_PLUG_ART $FAILURE" exit 1 - [[ -d $FORM_PLUG_ART ]] && echo "$FORM_PLUG_ART $OK" || echo "$DEVTOOLS_PLUG_ART $FAILURE" exit 1 - [[ -d $HMR_PLUG_ART ]] && echo "$HMR_PLUG_ART $OK" || echo "$HMR_PLUG_ART $FAILURE" exit 1 - [[ -d $LOGGER_PLUG_ART ]] && echo "$LOGGER_PLUG_ART $OK" || echo "$LOGGER_PLUG_ART $FAILURE" exit 1 - [[ -d $ROUTER_PLUG_ART ]] && echo "$ROUTER_PLUG_ART $OK" || echo "$ROUTER_PLUG_ART $FAILURE" exit 1 - [[ -d $STORAGE_PLUG_ART ]] && echo "$STORAGE_PLUG_ART $OK" || echo "$STORAGE_PLUG_ART $FAILURE" exit 1 - [[ -d $STORE_ART ]] && echo "$STORE_ART $OK" || echo "$STORE_ART $FAILURE" exit 1 - [[ -d $WEBSOCKET_PLUG_ART ]] && echo "$WEBSOCKET_PLUG_ART $OK" || echo "$WEBSOCKET_PLUG_ART $FAILURE" exit 1 - env: - OK: 'exists' - FAILURE: 'does not exist' - DEVTOOLS_PLUG_ART: './@ngxs/devtools-plugin' - FORM_PLUG_ART: './@ngxs/form-plugin' - HMR_PLUG_ART: './@ngxs/hmr-plugin' - LOGGER_PLUG_ART: './@ngxs/logger-plugin' - ROUTER_PLUG_ART: './@ngxs/router-plugin' - STORAGE_PLUG_ART: './@ngxs/storage-plugin' - STORE_ART: './@ngxs/store' - WEBSOCKET_PLUG_ART: './@ngxs/websocket-plugin' diff --git a/.github/workflows/_setup.yml b/.github/workflows/_setup.yml deleted file mode 100644 index ebc2b920b..000000000 --- a/.github/workflows/_setup.yml +++ /dev/null @@ -1,77 +0,0 @@ -# For more information see: -# - https://docs.github.com/en/actions/using-workflows/reusing-workflows -# - https://docs.github.com/en/actions/using-workflows/reusing-workflows#limitations - -# Note: -# The workflow can be referenced in other workflows like: -# - ngxs/store/.github/workflows/_setup.yml@master -# - ./.github/workflows/_setup.yml - -name: setup - -on: - workflow_call: - inputs: - NODE_VERSION: - required: true - type: string - GITHUB_SHA: - required: true - type: string - GITHUB_REF: - required: true - type: string - -jobs: - setup: - runs-on: ubuntu-latest - - steps: - - name: Checkout sources - uses: actions/checkout@v3 - with: - fetch-depth: 0 - ref: ${{ inputs.GITHUB_SHA }} - - - name: Don't save Bash session history - run: unset HISTFILE - - - name: Use Node.js ${{ inputs.NODE_VERSION }} - uses: actions/setup-node@v3 - with: - node-version: ${{ inputs.NODE_VERSION }} - check-latest: true - - - name: Configure kernel (increase watchers) - run: echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p - - - name: Get variables (branch name, commit hash, yarn cache directory) - id: get-variables - run: | - echo "::set-output name=shortref::${inputs.GITHUB_REF#refs/*/}"; - echo "::set-output name=commitsha::$(echo ${inputs.GITHUB_SHA})"; - echo "::set-output name=yarncachedir::$(yarn cache dir)"; - - - name: Workspace cache - uses: actions/cache@v3 - id: workspace-cache - env: - cache-name: workspace-cache - with: - path: | - ~/.cache - ./node_modules - ./@ngxs - ./app/integrations/hello-world-ng11-ivy/dist-integration - ./app/integrations/hello-world-ng12-ivy/dist-integration - ./app/integrations/hello-world-ng13-ivy/dist-integration - ./app/integrations/hello-world-ng14-ivy/dist-integration - key: ${{ runner.os }}-node-${{ inputs.NODE_VERSION }}-yarn-${{ hashFiles('**/yarn.lock') }}-branch-${{ steps.get-variables.outputs.shortref }}-workspace-${{ steps.get-variables.outputs.commitsha }} - restore-keys: | - ${{ runner.os }}-node-${{ inputs.NODE_VERSION }}-yarn-${{ hashFiles('**/yarn.lock') }}-branch-${{ steps.get-variables.outputs.shortref }}-workspace- - ${{ runner.os }}-node-${{ inputs.NODE_VERSION }}-yarn-${{ hashFiles('**/yarn.lock') }}-branch- - ${{ runner.os }}-node-${{ inputs.NODE_VERSION }}-yarn- - ${{ runner.os }}- - - - name: Install project dependencies - run: yarn install --frozen-lockfile --non-interactive diff --git a/.github/workflows/pr-validation.yml b/.github/workflows/pr-validation.yml index cadb36b67..71404f4d1 100644 --- a/.github/workflows/pr-validation.yml +++ b/.github/workflows/pr-validation.yml @@ -21,7 +21,7 @@ jobs: steps: - name: Setup - uses: ./.github/workflows/_setup.yml + uses: ./.github/actions/setup.yml with: NODE_VERSION: 16.x GITHUB_SHA: ${{ github.event.pull_request.head.sha }} @@ -40,7 +40,7 @@ jobs: steps: - name: Setup - uses: ./.github/workflows/_setup.yml + uses: ./.github/actions/setup.yml with: NODE_VERSION: ${{ matrix.node-version }} GITHUB_SHA: ${{ github.event.pull_request.head.sha }} @@ -80,7 +80,7 @@ jobs: steps: - name: Setup - uses: ./.github/workflows/_setup.yml + uses: ./.github/actions/setup.yml with: NODE_VERSION: ${{ matrix.node-version }} GITHUB_SHA: ${{ github.event.pull_request.head.sha }} @@ -100,7 +100,7 @@ jobs: steps: - name: Setup - uses: ./.github/workflows/_setup.yml + uses: ./.github/actions/setup.yml with: NODE_VERSION: ${{ matrix.node-version }} GITHUB_SHA: ${{ github.event.pull_request.head.sha }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3ab95c37e..40ff7b365 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -23,7 +23,7 @@ jobs: steps: - name: Setup - uses: ./.github/workflows/_setup.yml + uses: ./.github/actions/setup.yml with: NODE_VERSION: 16.x GITHUB_SHA: ${{ github.sha }} @@ -42,7 +42,7 @@ jobs: steps: - name: Setup - uses: ./.github/workflows/_setup.yml + uses: ./.github/actions/setup.yml with: NODE_VERSION: ${{ matrix.node-version }} GITHUB_SHA: ${{ github.sha }} @@ -82,7 +82,7 @@ jobs: steps: - name: Setup - uses: ./.github/workflows/_setup.yml + uses: ./.github/actions/setup.yml with: NODE_VERSION: ${{ matrix.node-version }} GITHUB_SHA: ${{ github.sha }} @@ -102,7 +102,7 @@ jobs: steps: - name: Setup - uses: ./.github/workflows/_setup.yml + uses: ./.github/actions/setup.yml with: NODE_VERSION: ${{ matrix.node-version }} GITHUB_SHA: ${{ github.sha }} @@ -118,14 +118,14 @@ jobs: steps: - name: Setup - uses: ./.github/workflows/_setup.yml + uses: ./.github/actions/setup.yml with: NODE_VERSION: 16.x GITHUB_SHA: ${{ github.sha }} GITHUB_REF: ${{ github.ref }} - name: Check @ngxs build artifacts - uses: ./.github/workflows/_check-artifacts.yml + uses: ./.github/actions/check-artifacts.yml - name: Production release - publish tagged builds to all @ngxs packages run: | diff --git a/.github/workflows/trunk.yml b/.github/workflows/trunk.yml index 514c96f20..58927f184 100644 --- a/.github/workflows/trunk.yml +++ b/.github/workflows/trunk.yml @@ -23,7 +23,7 @@ jobs: steps: - name: Setup - uses: ./.github/workflows/_setup.yml + uses: ./.github/actions/setup.yml with: NODE_VERSION: 16.x GITHUB_SHA: ${{ github.sha }} @@ -42,7 +42,7 @@ jobs: steps: - name: Setup - uses: ./.github/workflows/_setup.yml + uses: ./.github/actions/setup.yml with: NODE_VERSION: ${{ matrix.node-version }} GITHUB_SHA: ${{ github.sha }} @@ -82,7 +82,7 @@ jobs: steps: - name: Setup - uses: ./.github/workflows/_setup.yml + uses: ./.github/actions/setup.yml with: NODE_VERSION: ${{ matrix.node-version }} GITHUB_SHA: ${{ github.sha }} @@ -102,7 +102,7 @@ jobs: steps: - name: Setup - uses: ./.github/workflows/_setup.yml + uses: ./.github/actions/setup.yml with: NODE_VERSION: ${{ matrix.node-version }} GITHUB_SHA: ${{ github.sha }} @@ -118,14 +118,14 @@ jobs: steps: - name: Setup - uses: ./.github/workflows/_setup.yml + uses: ./.github/actions/setup.yml with: NODE_VERSION: 16.x GITHUB_SHA: ${{ github.sha }} GITHUB_REF: ${{ github.ref }} - name: Check @ngxs build artifacts - uses: ./.github/workflows/_check-artifacts.yml + uses: ./.github/actions/check-artifacts.yml - name: Development release - publish development builds to all @ngxs packages run: | From 2de8269761f22fcbbf78e31b3d708addc6fe89f9 Mon Sep 17 00:00:00 2001 From: rfprod Date: Sat, 11 Jun 2022 23:02:39 +0300 Subject: [PATCH 13/26] ci(actions): fix composite actions --- .../action.yml} | 7 ++++--- .../actions/{setup.yml => setup/action.yml} | 18 ++++++++++++------ .github/workflows/pr-validation.yml | 8 ++++---- .github/workflows/release.yml | 12 ++++++------ .github/workflows/trunk.yml | 12 ++++++------ 5 files changed, 32 insertions(+), 25 deletions(-) rename .github/actions/{check-build-artifacts.yml => check-build-artifacts/action.yml} (90%) rename .github/actions/{setup.yml => setup/action.yml} (88%) diff --git a/.github/actions/check-build-artifacts.yml b/.github/actions/check-build-artifacts/action.yml similarity index 90% rename from .github/actions/check-build-artifacts.yml rename to .github/actions/check-build-artifacts/action.yml index c8d687fa9..07df94172 100644 --- a/.github/actions/check-build-artifacts.yml +++ b/.github/actions/check-build-artifacts/action.yml @@ -4,15 +4,16 @@ # Note: # The workflow can be referenced in other workflows like: -# - ngxs/store/.github/actions/check-build-artifacts.yml@master -# - ./.github/actions/check-build-artifacts.yml +# - ngxs/store/.github/actions/check-build-artifacts +# - ./.github/actions/check-build-artifacts name: check-build-artifacts - +description: Ensure the build artifact directories exist runs: using: 'composite' steps: - name: Check @ngxs build artifacts + shell: bash run: | echo "Making sure the build artifact directories exist." [[ -d $DEVTOOLS_PLUG_ART ]] && echo "$DEVTOOLS_PLUG_ART $OK" || echo "$DEVTOOLS_PLUG_ART $FAILURE" exit 1 diff --git a/.github/actions/setup.yml b/.github/actions/setup/action.yml similarity index 88% rename from .github/actions/setup.yml rename to .github/actions/setup/action.yml index dd8595841..e716cbc80 100644 --- a/.github/actions/setup.yml +++ b/.github/actions/setup/action.yml @@ -8,17 +8,20 @@ # - ./.github/workflows/_setup.yml name: setup - +description: Set up environment inputs: NODE_VERSION: + description: Node version required: true - type: string + default: 16.x GITHUB_SHA: + description: Branch name required: true - type: string + default: ${{ github.sha }} GITHUB_REF: + description: Commit hash required: true - type: string + default: ${{ github.ref }} runs: using: 'composite' @@ -30,6 +33,7 @@ runs: ref: ${{ inputs.GITHUB_SHA }} - name: Don't save Bash session history + shell: bash run: unset HISTFILE - name: Use Node.js ${{ inputs.NODE_VERSION }} @@ -39,14 +43,15 @@ runs: check-latest: true - name: Configure kernel (increase watchers) + shell: bash run: echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p - - name: Get variables (branch name, commit hash, yarn cache directory) + - name: Get variables (branch name, commit hash) + shell: bash id: get-variables run: | echo "::set-output name=shortref::${inputs.GITHUB_REF#refs/*/}"; echo "::set-output name=commitsha::$(echo ${inputs.GITHUB_SHA})"; - echo "::set-output name=yarncachedir::$(yarn cache dir)"; - name: Workspace cache uses: actions/cache@v3 @@ -70,4 +75,5 @@ runs: ${{ runner.os }}- - name: Install project dependencies + shell: bash run: yarn install --frozen-lockfile --non-interactive diff --git a/.github/workflows/pr-validation.yml b/.github/workflows/pr-validation.yml index 71404f4d1..8908a028f 100644 --- a/.github/workflows/pr-validation.yml +++ b/.github/workflows/pr-validation.yml @@ -21,7 +21,7 @@ jobs: steps: - name: Setup - uses: ./.github/actions/setup.yml + uses: ./.github/actions/setup with: NODE_VERSION: 16.x GITHUB_SHA: ${{ github.event.pull_request.head.sha }} @@ -40,7 +40,7 @@ jobs: steps: - name: Setup - uses: ./.github/actions/setup.yml + uses: ./.github/actions/setup with: NODE_VERSION: ${{ matrix.node-version }} GITHUB_SHA: ${{ github.event.pull_request.head.sha }} @@ -80,7 +80,7 @@ jobs: steps: - name: Setup - uses: ./.github/actions/setup.yml + uses: ./.github/actions/setup with: NODE_VERSION: ${{ matrix.node-version }} GITHUB_SHA: ${{ github.event.pull_request.head.sha }} @@ -100,7 +100,7 @@ jobs: steps: - name: Setup - uses: ./.github/actions/setup.yml + uses: ./.github/actions/setup with: NODE_VERSION: ${{ matrix.node-version }} GITHUB_SHA: ${{ github.event.pull_request.head.sha }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 40ff7b365..2d0bff1d8 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -23,7 +23,7 @@ jobs: steps: - name: Setup - uses: ./.github/actions/setup.yml + uses: ./.github/actions/setup with: NODE_VERSION: 16.x GITHUB_SHA: ${{ github.sha }} @@ -42,7 +42,7 @@ jobs: steps: - name: Setup - uses: ./.github/actions/setup.yml + uses: ./.github/actions/setup with: NODE_VERSION: ${{ matrix.node-version }} GITHUB_SHA: ${{ github.sha }} @@ -82,7 +82,7 @@ jobs: steps: - name: Setup - uses: ./.github/actions/setup.yml + uses: ./.github/actions/setup with: NODE_VERSION: ${{ matrix.node-version }} GITHUB_SHA: ${{ github.sha }} @@ -102,7 +102,7 @@ jobs: steps: - name: Setup - uses: ./.github/actions/setup.yml + uses: ./.github/actions/setup with: NODE_VERSION: ${{ matrix.node-version }} GITHUB_SHA: ${{ github.sha }} @@ -118,14 +118,14 @@ jobs: steps: - name: Setup - uses: ./.github/actions/setup.yml + uses: ./.github/actions/setup with: NODE_VERSION: 16.x GITHUB_SHA: ${{ github.sha }} GITHUB_REF: ${{ github.ref }} - name: Check @ngxs build artifacts - uses: ./.github/actions/check-artifacts.yml + uses: ./.github/actions/check-build-artifacts - name: Production release - publish tagged builds to all @ngxs packages run: | diff --git a/.github/workflows/trunk.yml b/.github/workflows/trunk.yml index 58927f184..61be6dee7 100644 --- a/.github/workflows/trunk.yml +++ b/.github/workflows/trunk.yml @@ -23,7 +23,7 @@ jobs: steps: - name: Setup - uses: ./.github/actions/setup.yml + uses: ./.github/actions/setup with: NODE_VERSION: 16.x GITHUB_SHA: ${{ github.sha }} @@ -42,7 +42,7 @@ jobs: steps: - name: Setup - uses: ./.github/actions/setup.yml + uses: ./.github/actions/setup with: NODE_VERSION: ${{ matrix.node-version }} GITHUB_SHA: ${{ github.sha }} @@ -82,7 +82,7 @@ jobs: steps: - name: Setup - uses: ./.github/actions/setup.yml + uses: ./.github/actions/setup with: NODE_VERSION: ${{ matrix.node-version }} GITHUB_SHA: ${{ github.sha }} @@ -102,7 +102,7 @@ jobs: steps: - name: Setup - uses: ./.github/actions/setup.yml + uses: ./.github/actions/setup with: NODE_VERSION: ${{ matrix.node-version }} GITHUB_SHA: ${{ github.sha }} @@ -118,14 +118,14 @@ jobs: steps: - name: Setup - uses: ./.github/actions/setup.yml + uses: ./.github/actions/setup with: NODE_VERSION: 16.x GITHUB_SHA: ${{ github.sha }} GITHUB_REF: ${{ github.ref }} - name: Check @ngxs build artifacts - uses: ./.github/actions/check-artifacts.yml + uses: ./.github/actions/check-build-artifacts - name: Development release - publish development builds to all @ngxs packages run: | From 4f6c5851c60113dff1f49641ba96af97de0c92d6 Mon Sep 17 00:00:00 2001 From: rfprod Date: Sat, 11 Jun 2022 23:15:15 +0300 Subject: [PATCH 14/26] ci(actions): update comments in action configs --- .github/actions/check-build-artifacts/action.yml | 7 +++---- .github/actions/setup/action.yml | 7 +++---- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/.github/actions/check-build-artifacts/action.yml b/.github/actions/check-build-artifacts/action.yml index 07df94172..c9e378878 100644 --- a/.github/actions/check-build-artifacts/action.yml +++ b/.github/actions/check-build-artifacts/action.yml @@ -1,9 +1,8 @@ # For more information see: -# - https://docs.github.com/en/actions/using-workflows/reusing-workflows -# - https://docs.github.com/en/actions/using-workflows/reusing-workflows#limitations +# - https://docs.github.com/en/actions/creating-actions/creating-a-composite-action +# - https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions#outputsoutput_id -# Note: -# The workflow can be referenced in other workflows like: +# The action can be referenced in workflows like: # - ngxs/store/.github/actions/check-build-artifacts # - ./.github/actions/check-build-artifacts diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml index e716cbc80..8c712170b 100644 --- a/.github/actions/setup/action.yml +++ b/.github/actions/setup/action.yml @@ -1,9 +1,8 @@ # For more information see: -# - https://docs.github.com/en/actions/using-workflows/reusing-workflows -# - https://docs.github.com/en/actions/using-workflows/reusing-workflows#limitations +# - https://docs.github.com/en/actions/creating-actions/creating-a-composite-action +# - https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions#outputsoutput_id -# Note: -# The workflow can be referenced in other workflows like: +# The action can be referenced in workflows like: # - ngxs/store/.github/workflows/_setup.yml@master # - ./.github/workflows/_setup.yml From 600c29778820a967b7d3ae458af8d0befde2bd31 Mon Sep 17 00:00:00 2001 From: rfprod Date: Sat, 11 Jun 2022 23:46:41 +0300 Subject: [PATCH 15/26] ci(docs): fix comments in composite actions --- .github/actions/check-build-artifacts/action.yml | 2 +- .github/actions/setup/action.yml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/actions/check-build-artifacts/action.yml b/.github/actions/check-build-artifacts/action.yml index c9e378878..c6c281749 100644 --- a/.github/actions/check-build-artifacts/action.yml +++ b/.github/actions/check-build-artifacts/action.yml @@ -3,7 +3,7 @@ # - https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions#outputsoutput_id # The action can be referenced in workflows like: -# - ngxs/store/.github/actions/check-build-artifacts +# - ngxs/store/.github/actions/check-build-artifacts@master # - ./.github/actions/check-build-artifacts name: check-build-artifacts diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml index 8c712170b..528cb7fe4 100644 --- a/.github/actions/setup/action.yml +++ b/.github/actions/setup/action.yml @@ -3,8 +3,8 @@ # - https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions#outputsoutput_id # The action can be referenced in workflows like: -# - ngxs/store/.github/workflows/_setup.yml@master -# - ./.github/workflows/_setup.yml +# - ngxs/store/.github/actions/setup@master +# - ./.github/actions/setup name: setup description: Set up environment From 2dd5a47f7e9450b74bd4b4d785a1b765e24ab67b Mon Sep 17 00:00:00 2001 From: rfprod Date: Sun, 12 Jun 2022 23:54:34 +0300 Subject: [PATCH 16/26] ci(syntax): fix yaml syntax errors --- .github/workflows/pr-validation.yml | 22 +++++++++++----------- .github/workflows/release.yml | 22 +++++++++++----------- .github/workflows/trunk.yml | 22 +++++++++++----------- 3 files changed, 33 insertions(+), 33 deletions(-) diff --git a/.github/workflows/pr-validation.yml b/.github/workflows/pr-validation.yml index 8908a028f..78b6ca821 100644 --- a/.github/workflows/pr-validation.yml +++ b/.github/workflows/pr-validation.yml @@ -36,7 +36,7 @@ jobs: strategy: matrix: node-version: [16.x] - script: [lint, eslint, test:ci, test:types] + script: [lint, eslint, 'test:ci', 'test:types'] steps: - name: Setup @@ -67,16 +67,16 @@ jobs: matrix: node-version: [16.x] script: - - integration:ng7 - - integration:ng8 - - integration:ng9:ivy:off - - integration:ng9:ivy - - integration:ng10:ivy:off - - integration:ng10:ivy - - integration:ng11:ivy:off - - integration:ng11:ivy - - integration:ng12:ivy - - integration:ng13:ivy + - 'integration:ng7' + - 'integration:ng8' + - 'integration:ng9:ivy:off' + - 'integration:ng9:ivy' + - 'integration:ng10:ivy:off' + - 'integration:ng10:ivy' + - 'integration:ng11:ivy:off' + - 'integration:ng11:ivy' + - 'integration:ng12:ivy' + - 'integration:ng13:ivy' steps: - name: Setup diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2d0bff1d8..fb9632dfe 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -38,7 +38,7 @@ jobs: strategy: matrix: node-version: [16.x] - script: [lint, eslint, test:ci, test:types] + script: [lint, eslint, 'test:ci', 'test:types'] steps: - name: Setup @@ -69,16 +69,16 @@ jobs: matrix: node-version: [16.x] script: - - integration:ng7 - - integration:ng8 - - integration:ng9:ivy:off - - integration:ng9:ivy - - integration:ng10:ivy:off - - integration:ng10:ivy - - integration:ng11:ivy:off - - integration:ng11:ivy - - integration:ng12:ivy - - integration:ng13:ivy + - 'integration:ng7' + - 'integration:ng8' + - 'integration:ng9:ivy:off' + - 'integration:ng9:ivy' + - 'integration:ng10:ivy:off' + - 'integration:ng10:ivy' + - 'integration:ng11:ivy:off' + - 'integration:ng11:ivy' + - 'integration:ng12:ivy' + - 'integration:ng13:ivy' steps: - name: Setup diff --git a/.github/workflows/trunk.yml b/.github/workflows/trunk.yml index 61be6dee7..f49d61dd3 100644 --- a/.github/workflows/trunk.yml +++ b/.github/workflows/trunk.yml @@ -38,7 +38,7 @@ jobs: strategy: matrix: node-version: [16.x] - script: [lint, eslint, test:ci, test:types] + script: [lint, eslint, 'test:ci', 'test:types'] steps: - name: Setup @@ -69,16 +69,16 @@ jobs: matrix: node-version: [16.x] script: - - integration:ng7 - - integration:ng8 - - integration:ng9:ivy:off - - integration:ng9:ivy - - integration:ng10:ivy:off - - integration:ng10:ivy - - integration:ng11:ivy:off - - integration:ng11:ivy - - integration:ng12:ivy - - integration:ng13:ivy + - 'integration:ng7' + - 'integration:ng8' + - 'integration:ng9:ivy:off' + - 'integration:ng9:ivy' + - 'integration:ng10:ivy:off' + - 'integration:ng10:ivy' + - 'integration:ng11:ivy:off' + - 'integration:ng11:ivy' + - 'integration:ng12:ivy' + - 'integration:ng13:ivy' steps: - name: Setup From b8c308696d104cdd2e0bf1dca0148341bd6448e1 Mon Sep 17 00:00:00 2001 From: rfprod Date: Mon, 13 Jun 2022 00:05:13 +0300 Subject: [PATCH 17/26] ci(checkout): checkout sources before calling the setup action --- .github/actions/setup/action.yml | 12 +++++++----- .github/workflows/pr-validation.yml | 24 ++++++++++++++++++++++++ .github/workflows/release.yml | 15 +++++++++++++++ .github/workflows/trunk.yml | 15 +++++++++++++++ 4 files changed, 61 insertions(+), 5 deletions(-) diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml index 528cb7fe4..bfb0a1a20 100644 --- a/.github/actions/setup/action.yml +++ b/.github/actions/setup/action.yml @@ -25,11 +25,13 @@ inputs: runs: using: 'composite' steps: - - name: Checkout sources - uses: actions/checkout@v3 - with: - fetch-depth: 0 - ref: ${{ inputs.GITHUB_SHA }} + # This action should be called in the parent workflow before this composite action. + # Composite action, as well as any other files, can not be referenced by a relative path before the sources are checked out. + # - name: Checkout sources + # uses: actions/checkout@v3 + # with: + # fetch-depth: 0 + # ref: ${{ inputs.GITHUB_SHA }} - name: Don't save Bash session history shell: bash diff --git a/.github/workflows/pr-validation.yml b/.github/workflows/pr-validation.yml index 78b6ca821..3cabce37c 100644 --- a/.github/workflows/pr-validation.yml +++ b/.github/workflows/pr-validation.yml @@ -20,6 +20,12 @@ jobs: runs-on: ubuntu-latest steps: + - name: Checkout sources + uses: actions/checkout@v3 + with: + fetch-depth: 0 + ref: ${{ github.event.pull_request.head.sha }} + - name: Setup uses: ./.github/actions/setup with: @@ -39,6 +45,12 @@ jobs: script: [lint, eslint, 'test:ci', 'test:types'] steps: + - name: Checkout sources + uses: actions/checkout@v3 + with: + fetch-depth: 0 + ref: ${{ github.event.pull_request.head.sha }} + - name: Setup uses: ./.github/actions/setup with: @@ -79,6 +91,12 @@ jobs: - 'integration:ng13:ivy' steps: + - name: Checkout sources + uses: actions/checkout@v3 + with: + fetch-depth: 0 + ref: ${{ github.event.pull_request.head.sha }} + - name: Setup uses: ./.github/actions/setup with: @@ -99,6 +117,12 @@ jobs: script: [bundlesize] steps: + - name: Checkout sources + uses: actions/checkout@v3 + with: + fetch-depth: 0 + ref: ${{ github.event.pull_request.head.sha }} + - name: Setup uses: ./.github/actions/setup with: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index fb9632dfe..b6012f10b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -22,6 +22,9 @@ jobs: runs-on: ubuntu-latest steps: + - name: Checkout sources + uses: actions/checkout@v3 + - name: Setup uses: ./.github/actions/setup with: @@ -41,6 +44,9 @@ jobs: script: [lint, eslint, 'test:ci', 'test:types'] steps: + - name: Checkout sources + uses: actions/checkout@v3 + - name: Setup uses: ./.github/actions/setup with: @@ -81,6 +87,9 @@ jobs: - 'integration:ng13:ivy' steps: + - name: Checkout sources + uses: actions/checkout@v3 + - name: Setup uses: ./.github/actions/setup with: @@ -101,6 +110,9 @@ jobs: script: [bundlesize] steps: + - name: Checkout sources + uses: actions/checkout@v3 + - name: Setup uses: ./.github/actions/setup with: @@ -117,6 +129,9 @@ jobs: needs: [release-build, release-test, release-integration-test, release-bundlesize] steps: + - name: Checkout sources + uses: actions/checkout@v3 + - name: Setup uses: ./.github/actions/setup with: diff --git a/.github/workflows/trunk.yml b/.github/workflows/trunk.yml index f49d61dd3..530abbf83 100644 --- a/.github/workflows/trunk.yml +++ b/.github/workflows/trunk.yml @@ -22,6 +22,9 @@ jobs: runs-on: ubuntu-latest steps: + - name: Checkout sources + uses: actions/checkout@v3 + - name: Setup uses: ./.github/actions/setup with: @@ -41,6 +44,9 @@ jobs: script: [lint, eslint, 'test:ci', 'test:types'] steps: + - name: Checkout sources + uses: actions/checkout@v3 + - name: Setup uses: ./.github/actions/setup with: @@ -81,6 +87,9 @@ jobs: - 'integration:ng13:ivy' steps: + - name: Checkout sources + uses: actions/checkout@v3 + - name: Setup uses: ./.github/actions/setup with: @@ -101,6 +110,9 @@ jobs: script: [bundlesize] steps: + - name: Checkout sources + uses: actions/checkout@v3 + - name: Setup uses: ./.github/actions/setup with: @@ -117,6 +129,9 @@ jobs: needs: [trunk-build, trunk-test, trunk-integration-test, trunk-bundlesize] steps: + - name: Checkout sources + uses: actions/checkout@v3 + - name: Setup uses: ./.github/actions/setup with: From d242816c4efe567fbb4c316118e233244f309b3b Mon Sep 17 00:00:00 2001 From: rfprod Date: Mon, 13 Jun 2022 00:20:56 +0300 Subject: [PATCH 18/26] ci(inputs): fix the setup action inputs --- .github/actions/setup/action.yml | 10 +++++----- .github/workflows/pr-validation.yml | 8 ++++---- .github/workflows/release.yml | 10 +++++----- .github/workflows/trunk.yml | 10 +++++----- 4 files changed, 19 insertions(+), 19 deletions(-) diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml index bfb0a1a20..ec2b75886 100644 --- a/.github/actions/setup/action.yml +++ b/.github/actions/setup/action.yml @@ -13,14 +13,14 @@ inputs: description: Node version required: true default: 16.x - GITHUB_SHA: + GITHUB_REF_NAME: description: Branch name required: true - default: ${{ github.sha }} - GITHUB_REF: + default: ${{ github.ref_name }} + GITHUB_SHA: description: Commit hash required: true - default: ${{ github.ref }} + default: ${{ github.sha }} runs: using: 'composite' @@ -51,7 +51,7 @@ runs: shell: bash id: get-variables run: | - echo "::set-output name=shortref::${inputs.GITHUB_REF#refs/*/}"; + echo "::set-output name=shortref::${inputs.GITHUB_REF_NAME}"; echo "::set-output name=commitsha::$(echo ${inputs.GITHUB_SHA})"; - name: Workspace cache diff --git a/.github/workflows/pr-validation.yml b/.github/workflows/pr-validation.yml index 3cabce37c..ce035ffae 100644 --- a/.github/workflows/pr-validation.yml +++ b/.github/workflows/pr-validation.yml @@ -30,8 +30,8 @@ jobs: uses: ./.github/actions/setup with: NODE_VERSION: 16.x + GITHUB_REF_NAME: ${{ github.ref_name }} GITHUB_SHA: ${{ github.event.pull_request.head.sha }} - GITHUB_REF: ${{ github.ref }} - name: Build NGXS run: yarn build @@ -55,8 +55,8 @@ jobs: uses: ./.github/actions/setup with: NODE_VERSION: ${{ matrix.node-version }} + GITHUB_REF_NAME: ${{ github.ref_name }} GITHUB_SHA: ${{ github.event.pull_request.head.sha }} - GITHUB_REF: ${{ github.ref }} - name: Run ${{ matrix.script }} run: yarn ${{ matrix.script }} @@ -101,8 +101,8 @@ jobs: uses: ./.github/actions/setup with: NODE_VERSION: ${{ matrix.node-version }} + GITHUB_REF_NAME: ${{ github.ref_name }} GITHUB_SHA: ${{ github.event.pull_request.head.sha }} - GITHUB_REF: ${{ github.ref }} - name: Run ${{ matrix.script }} run: yarn ${{ matrix.script }} @@ -127,8 +127,8 @@ jobs: uses: ./.github/actions/setup with: NODE_VERSION: ${{ matrix.node-version }} + GITHUB_REF_NAME: ${{ github.ref_name }} GITHUB_SHA: ${{ github.event.pull_request.head.sha }} - GITHUB_REF: ${{ github.ref }} - name: Run ${{ matrix.script }} run: yarn ${{ matrix.script }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b6012f10b..b8a59f6af 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -29,8 +29,8 @@ jobs: uses: ./.github/actions/setup with: NODE_VERSION: 16.x + GITHUB_REF_NAME: ${{ github.ref_name }} GITHUB_SHA: ${{ github.sha }} - GITHUB_REF: ${{ github.ref }} - name: Build NGXS run: yarn build @@ -51,8 +51,8 @@ jobs: uses: ./.github/actions/setup with: NODE_VERSION: ${{ matrix.node-version }} + GITHUB_REF_NAME: ${{ github.ref_name }} GITHUB_SHA: ${{ github.sha }} - GITHUB_REF: ${{ github.ref }} - name: Run ${{ matrix.script }} run: yarn ${{ matrix.script }} @@ -94,8 +94,8 @@ jobs: uses: ./.github/actions/setup with: NODE_VERSION: ${{ matrix.node-version }} + GITHUB_REF_NAME: ${{ github.ref_name }} GITHUB_SHA: ${{ github.sha }} - GITHUB_REF: ${{ github.ref }} - name: Run ${{ matrix.script }} run: yarn ${{ matrix.script }} @@ -117,8 +117,8 @@ jobs: uses: ./.github/actions/setup with: NODE_VERSION: ${{ matrix.node-version }} + GITHUB_REF_NAME: ${{ github.ref_name }} GITHUB_SHA: ${{ github.sha }} - GITHUB_REF: ${{ github.ref }} - name: Run ${{ matrix.script }} run: yarn ${{ matrix.script }} @@ -136,8 +136,8 @@ jobs: uses: ./.github/actions/setup with: NODE_VERSION: 16.x + GITHUB_REF_NAME: ${{ github.ref_name }} GITHUB_SHA: ${{ github.sha }} - GITHUB_REF: ${{ github.ref }} - name: Check @ngxs build artifacts uses: ./.github/actions/check-build-artifacts diff --git a/.github/workflows/trunk.yml b/.github/workflows/trunk.yml index 530abbf83..ad6dea523 100644 --- a/.github/workflows/trunk.yml +++ b/.github/workflows/trunk.yml @@ -29,8 +29,8 @@ jobs: uses: ./.github/actions/setup with: NODE_VERSION: 16.x + GITHUB_REF_NAME: ${{ github.ref_name }} GITHUB_SHA: ${{ github.sha }} - GITHUB_REF: ${{ github.ref }} - name: Build NGXS run: yarn build @@ -51,8 +51,8 @@ jobs: uses: ./.github/actions/setup with: NODE_VERSION: ${{ matrix.node-version }} + GITHUB_REF_NAME: ${{ github.ref_name }} GITHUB_SHA: ${{ github.sha }} - GITHUB_REF: ${{ github.ref }} - name: Run ${{ matrix.script }} run: yarn ${{ matrix.script }} @@ -94,8 +94,8 @@ jobs: uses: ./.github/actions/setup with: NODE_VERSION: ${{ matrix.node-version }} + GITHUB_REF_NAME: ${{ github.ref_name }} GITHUB_SHA: ${{ github.sha }} - GITHUB_REF: ${{ github.ref }} - name: Run ${{ matrix.script }} run: yarn ${{ matrix.script }} @@ -117,8 +117,8 @@ jobs: uses: ./.github/actions/setup with: NODE_VERSION: ${{ matrix.node-version }} + GITHUB_REF_NAME: ${{ github.ref_name }} GITHUB_SHA: ${{ github.sha }} - GITHUB_REF: ${{ github.ref }} - name: Run ${{ matrix.script }} run: yarn ${{ matrix.script }} @@ -136,8 +136,8 @@ jobs: uses: ./.github/actions/setup with: NODE_VERSION: 16.x + GITHUB_REF_NAME: ${{ github.ref_name }} GITHUB_SHA: ${{ github.sha }} - GITHUB_REF: ${{ github.ref }} - name: Check @ngxs build artifacts uses: ./.github/actions/check-build-artifacts From c0d9f05a9c8cf998d3227f690c2cf692073b1e36 Mon Sep 17 00:00:00 2001 From: rfprod Date: Mon, 13 Jun 2022 00:23:58 +0300 Subject: [PATCH 19/26] ci(syntax): fix the setup action syntax --- .github/actions/setup/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml index ec2b75886..7a6d0a84b 100644 --- a/.github/actions/setup/action.yml +++ b/.github/actions/setup/action.yml @@ -51,7 +51,7 @@ runs: shell: bash id: get-variables run: | - echo "::set-output name=shortref::${inputs.GITHUB_REF_NAME}"; + echo "::set-output name=shortref::$(echo ${inputs.GITHUB_REF_NAME})"; echo "::set-output name=commitsha::$(echo ${inputs.GITHUB_SHA})"; - name: Workspace cache From 7603b47b8a68977c6862adac37b6fbafc62fd488 Mon Sep 17 00:00:00 2001 From: rfprod Date: Mon, 13 Jun 2022 00:29:10 +0300 Subject: [PATCH 20/26] ci(test): test:types needs *-build, move it to integration-test --- .github/workflows/pr-validation.yml | 3 ++- .github/workflows/release.yml | 3 ++- .github/workflows/trunk.yml | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pr-validation.yml b/.github/workflows/pr-validation.yml index ce035ffae..bcb5bab02 100644 --- a/.github/workflows/pr-validation.yml +++ b/.github/workflows/pr-validation.yml @@ -42,7 +42,7 @@ jobs: strategy: matrix: node-version: [16.x] - script: [lint, eslint, 'test:ci', 'test:types'] + script: [lint, eslint, 'test:ci'] steps: - name: Checkout sources @@ -89,6 +89,7 @@ jobs: - 'integration:ng11:ivy' - 'integration:ng12:ivy' - 'integration:ng13:ivy' + - 'test:types' steps: - name: Checkout sources diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b8a59f6af..ffa0fc444 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -41,7 +41,7 @@ jobs: strategy: matrix: node-version: [16.x] - script: [lint, eslint, 'test:ci', 'test:types'] + script: [lint, eslint, 'test:ci'] steps: - name: Checkout sources @@ -85,6 +85,7 @@ jobs: - 'integration:ng11:ivy' - 'integration:ng12:ivy' - 'integration:ng13:ivy' + - 'test:types' steps: - name: Checkout sources diff --git a/.github/workflows/trunk.yml b/.github/workflows/trunk.yml index ad6dea523..8151ccc21 100644 --- a/.github/workflows/trunk.yml +++ b/.github/workflows/trunk.yml @@ -41,7 +41,7 @@ jobs: strategy: matrix: node-version: [16.x] - script: [lint, eslint, 'test:ci', 'test:types'] + script: [lint, eslint, 'test:ci'] steps: - name: Checkout sources @@ -85,6 +85,7 @@ jobs: - 'integration:ng11:ivy' - 'integration:ng12:ivy' - 'integration:ng13:ivy' + - 'test:types' steps: - name: Checkout sources From 4bee88bbbd95a2579612bbcd3a2cdd006ebe6505 Mon Sep 17 00:00:00 2001 From: rfprod Date: Mon, 13 Jun 2022 00:33:39 +0300 Subject: [PATCH 21/26] ci(cache): fix workspace cache paths --- .github/actions/setup/action.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml index 7a6d0a84b..26467d85e 100644 --- a/.github/actions/setup/action.yml +++ b/.github/actions/setup/action.yml @@ -64,10 +64,10 @@ runs: ~/.cache ./node_modules ./@ngxs - ./app/integrations/hello-world-ng11-ivy/dist-integration - ./app/integrations/hello-world-ng12-ivy/dist-integration - ./app/integrations/hello-world-ng13-ivy/dist-integration - ./app/integrations/hello-world-ng14-ivy/dist-integration + ./integrations/hello-world-ng11-ivy/dist-integration + ./integrations/hello-world-ng12-ivy/dist-integration + ./integrations/hello-world-ng13-ivy/dist-integration + ./integrations/hello-world-ng14-ivy/dist-integration key: ${{ runner.os }}-node-${{ inputs.NODE_VERSION }}-yarn-${{ hashFiles('**/yarn.lock') }}-branch-${{ steps.get-variables.outputs.shortref }}-workspace-${{ steps.get-variables.outputs.commitsha }} restore-keys: | ${{ runner.os }}-node-${{ inputs.NODE_VERSION }}-yarn-${{ hashFiles('**/yarn.lock') }}-branch-${{ steps.get-variables.outputs.shortref }}-workspace- From 95c30349721a4e1797ac0377b6237f1661d1554b Mon Sep 17 00:00:00 2001 From: rfprod Date: Mon, 13 Jun 2022 00:50:28 +0300 Subject: [PATCH 22/26] ci(cache): exclude node_modules in the integrations dir from cache --- .github/actions/setup/action.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml index 26467d85e..c76b8bb05 100644 --- a/.github/actions/setup/action.yml +++ b/.github/actions/setup/action.yml @@ -64,6 +64,7 @@ runs: ~/.cache ./node_modules ./@ngxs + !./integrations/**/node_modules ./integrations/hello-world-ng11-ivy/dist-integration ./integrations/hello-world-ng12-ivy/dist-integration ./integrations/hello-world-ng13-ivy/dist-integration From 8b5350042144494471337dc4257e7490f47fec80 Mon Sep 17 00:00:00 2001 From: rfprod Date: Mon, 13 Jun 2022 01:24:15 +0300 Subject: [PATCH 23/26] ci(cache): fix workspace cache, remove unneeded code --- .github/actions/setup/action.yml | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml index c76b8bb05..20b08a0ca 100644 --- a/.github/actions/setup/action.yml +++ b/.github/actions/setup/action.yml @@ -25,14 +25,6 @@ inputs: runs: using: 'composite' steps: - # This action should be called in the parent workflow before this composite action. - # Composite action, as well as any other files, can not be referenced by a relative path before the sources are checked out. - # - name: Checkout sources - # uses: actions/checkout@v3 - # with: - # fetch-depth: 0 - # ref: ${{ inputs.GITHUB_SHA }} - - name: Don't save Bash session history shell: bash run: unset HISTFILE @@ -47,13 +39,6 @@ runs: shell: bash run: echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p - - name: Get variables (branch name, commit hash) - shell: bash - id: get-variables - run: | - echo "::set-output name=shortref::$(echo ${inputs.GITHUB_REF_NAME})"; - echo "::set-output name=commitsha::$(echo ${inputs.GITHUB_SHA})"; - - name: Workspace cache uses: actions/cache@v3 id: workspace-cache @@ -64,14 +49,13 @@ runs: ~/.cache ./node_modules ./@ngxs - !./integrations/**/node_modules ./integrations/hello-world-ng11-ivy/dist-integration ./integrations/hello-world-ng12-ivy/dist-integration ./integrations/hello-world-ng13-ivy/dist-integration ./integrations/hello-world-ng14-ivy/dist-integration - key: ${{ runner.os }}-node-${{ inputs.NODE_VERSION }}-yarn-${{ hashFiles('**/yarn.lock') }}-branch-${{ steps.get-variables.outputs.shortref }}-workspace-${{ steps.get-variables.outputs.commitsha }} + key: ${{ runner.os }}-node-${{ inputs.NODE_VERSION }}-yarn-${{ hashFiles('**/yarn.lock') }}-branch-${{ inputs.GITHUB_REF_NAME }}-sha-${{ inputs.GITHUB_SHA }} restore-keys: | - ${{ runner.os }}-node-${{ inputs.NODE_VERSION }}-yarn-${{ hashFiles('**/yarn.lock') }}-branch-${{ steps.get-variables.outputs.shortref }}-workspace- + ${{ runner.os }}-node-${{ inputs.NODE_VERSION }}-yarn-${{ hashFiles('**/yarn.lock') }}-branch-${{ inputs.GITHUB_REF_NAME }}-sha- ${{ runner.os }}-node-${{ inputs.NODE_VERSION }}-yarn-${{ hashFiles('**/yarn.lock') }}-branch- ${{ runner.os }}-node-${{ inputs.NODE_VERSION }}-yarn- ${{ runner.os }}- From a75f815fa21671a1cd047d744af53a667a0085de Mon Sep 17 00:00:00 2001 From: rfprod Date: Mon, 13 Jun 2022 02:19:27 +0300 Subject: [PATCH 24/26] ci(cache): fix workspace cache - [x] all actions must required build so that cache is correct; --- .github/actions/setup/action.yml | 18 ++++++++--------- .github/workflows/pr-validation.yml | 25 ++++++++++++----------- .github/workflows/release.yml | 31 +++++++++++++++-------------- .github/workflows/trunk.yml | 31 +++++++++++++++-------------- 4 files changed, 54 insertions(+), 51 deletions(-) diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml index 20b08a0ca..a3ccbea6b 100644 --- a/.github/actions/setup/action.yml +++ b/.github/actions/setup/action.yml @@ -9,15 +9,15 @@ name: setup description: Set up environment inputs: - NODE_VERSION: + node-version: description: Node version required: true default: 16.x - GITHUB_REF_NAME: + github-ref-name: description: Branch name required: true default: ${{ github.ref_name }} - GITHUB_SHA: + github-sha: description: Commit hash required: true default: ${{ github.sha }} @@ -29,10 +29,10 @@ runs: shell: bash run: unset HISTFILE - - name: Use Node.js ${{ inputs.NODE_VERSION }} + - name: Use Node.js ${{ inputs.node-version }} uses: actions/setup-node@v3 with: - node-version: ${{ inputs.NODE_VERSION }} + node-version: ${{ inputs.node-version }} check-latest: true - name: Configure kernel (increase watchers) @@ -53,11 +53,11 @@ runs: ./integrations/hello-world-ng12-ivy/dist-integration ./integrations/hello-world-ng13-ivy/dist-integration ./integrations/hello-world-ng14-ivy/dist-integration - key: ${{ runner.os }}-node-${{ inputs.NODE_VERSION }}-yarn-${{ hashFiles('**/yarn.lock') }}-branch-${{ inputs.GITHUB_REF_NAME }}-sha-${{ inputs.GITHUB_SHA }} + key: ${{ runner.os }}-node-${{ inputs.node-version }}-yarn-${{ hashFiles('**/yarn.lock') }}-branch-${{ inputs.github-ref-name }}-sha-${{ inputs.github-sha }} restore-keys: | - ${{ runner.os }}-node-${{ inputs.NODE_VERSION }}-yarn-${{ hashFiles('**/yarn.lock') }}-branch-${{ inputs.GITHUB_REF_NAME }}-sha- - ${{ runner.os }}-node-${{ inputs.NODE_VERSION }}-yarn-${{ hashFiles('**/yarn.lock') }}-branch- - ${{ runner.os }}-node-${{ inputs.NODE_VERSION }}-yarn- + ${{ runner.os }}-node-${{ inputs.node-version }}-yarn-${{ hashFiles('**/yarn.lock') }}-branch-${{ inputs.github-ref-name }}-sha- + ${{ runner.os }}-node-${{ inputs.node-version }}-yarn-${{ hashFiles('**/yarn.lock') }}-branch- + ${{ runner.os }}-node-${{ inputs.node-version }}-yarn- ${{ runner.os }}- - name: Install project dependencies diff --git a/.github/workflows/pr-validation.yml b/.github/workflows/pr-validation.yml index bcb5bab02..1059c146b 100644 --- a/.github/workflows/pr-validation.yml +++ b/.github/workflows/pr-validation.yml @@ -29,15 +29,16 @@ jobs: - name: Setup uses: ./.github/actions/setup with: - NODE_VERSION: 16.x - GITHUB_REF_NAME: ${{ github.ref_name }} - GITHUB_SHA: ${{ github.event.pull_request.head.sha }} + node-version: 16.x + github-ref-name: ${{ github.ref_name }} + github-sha: ${{ github.event.pull_request.head.sha }} - name: Build NGXS run: yarn build premerge-test: runs-on: ubuntu-latest + needs: premerge-build strategy: matrix: @@ -54,9 +55,9 @@ jobs: - name: Setup uses: ./.github/actions/setup with: - NODE_VERSION: ${{ matrix.node-version }} - GITHUB_REF_NAME: ${{ github.ref_name }} - GITHUB_SHA: ${{ github.event.pull_request.head.sha }} + node-version: ${{ matrix.node-version }} + github-ref-name: ${{ github.ref_name }} + github-sha: ${{ github.event.pull_request.head.sha }} - name: Run ${{ matrix.script }} run: yarn ${{ matrix.script }} @@ -101,9 +102,9 @@ jobs: - name: Setup uses: ./.github/actions/setup with: - NODE_VERSION: ${{ matrix.node-version }} - GITHUB_REF_NAME: ${{ github.ref_name }} - GITHUB_SHA: ${{ github.event.pull_request.head.sha }} + node-version: ${{ matrix.node-version }} + github-ref-name: ${{ github.ref_name }} + github-sha: ${{ github.event.pull_request.head.sha }} - name: Run ${{ matrix.script }} run: yarn ${{ matrix.script }} @@ -127,9 +128,9 @@ jobs: - name: Setup uses: ./.github/actions/setup with: - NODE_VERSION: ${{ matrix.node-version }} - GITHUB_REF_NAME: ${{ github.ref_name }} - GITHUB_SHA: ${{ github.event.pull_request.head.sha }} + node-version: ${{ matrix.node-version }} + github-ref-name: ${{ github.ref_name }} + github-sha: ${{ github.event.pull_request.head.sha }} - name: Run ${{ matrix.script }} run: yarn ${{ matrix.script }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ffa0fc444..c626a3aa3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -28,15 +28,16 @@ jobs: - name: Setup uses: ./.github/actions/setup with: - NODE_VERSION: 16.x - GITHUB_REF_NAME: ${{ github.ref_name }} - GITHUB_SHA: ${{ github.sha }} + node-version: 16.x + github-ref-name: ${{ github.ref_name }} + github-sha: ${{ github.sha }} - name: Build NGXS run: yarn build release-test: runs-on: ubuntu-latest + needs: release-build strategy: matrix: @@ -50,9 +51,9 @@ jobs: - name: Setup uses: ./.github/actions/setup with: - NODE_VERSION: ${{ matrix.node-version }} - GITHUB_REF_NAME: ${{ github.ref_name }} - GITHUB_SHA: ${{ github.sha }} + node-version: ${{ matrix.node-version }} + github-ref-name: ${{ github.ref_name }} + github-sha: ${{ github.sha }} - name: Run ${{ matrix.script }} run: yarn ${{ matrix.script }} @@ -94,9 +95,9 @@ jobs: - name: Setup uses: ./.github/actions/setup with: - NODE_VERSION: ${{ matrix.node-version }} - GITHUB_REF_NAME: ${{ github.ref_name }} - GITHUB_SHA: ${{ github.sha }} + node-version: ${{ matrix.node-version }} + github-ref-name: ${{ github.ref_name }} + github-sha: ${{ github.sha }} - name: Run ${{ matrix.script }} run: yarn ${{ matrix.script }} @@ -117,9 +118,9 @@ jobs: - name: Setup uses: ./.github/actions/setup with: - NODE_VERSION: ${{ matrix.node-version }} - GITHUB_REF_NAME: ${{ github.ref_name }} - GITHUB_SHA: ${{ github.sha }} + node-version: ${{ matrix.node-version }} + github-ref-name: ${{ github.ref_name }} + github-sha: ${{ github.sha }} - name: Run ${{ matrix.script }} run: yarn ${{ matrix.script }} @@ -136,9 +137,9 @@ jobs: - name: Setup uses: ./.github/actions/setup with: - NODE_VERSION: 16.x - GITHUB_REF_NAME: ${{ github.ref_name }} - GITHUB_SHA: ${{ github.sha }} + node-version: 16.x + github-ref-name: ${{ github.ref_name }} + github-sha: ${{ github.sha }} - name: Check @ngxs build artifacts uses: ./.github/actions/check-build-artifacts diff --git a/.github/workflows/trunk.yml b/.github/workflows/trunk.yml index 8151ccc21..958161fff 100644 --- a/.github/workflows/trunk.yml +++ b/.github/workflows/trunk.yml @@ -28,15 +28,16 @@ jobs: - name: Setup uses: ./.github/actions/setup with: - NODE_VERSION: 16.x - GITHUB_REF_NAME: ${{ github.ref_name }} - GITHUB_SHA: ${{ github.sha }} + node-version: 16.x + github-ref-name: ${{ github.ref_name }} + github-sha: ${{ github.sha }} - name: Build NGXS run: yarn build trunk-test: runs-on: ubuntu-latest + needs: trunk-build strategy: matrix: @@ -50,9 +51,9 @@ jobs: - name: Setup uses: ./.github/actions/setup with: - NODE_VERSION: ${{ matrix.node-version }} - GITHUB_REF_NAME: ${{ github.ref_name }} - GITHUB_SHA: ${{ github.sha }} + node-version: ${{ matrix.node-version }} + github-ref-name: ${{ github.ref_name }} + github-sha: ${{ github.sha }} - name: Run ${{ matrix.script }} run: yarn ${{ matrix.script }} @@ -94,9 +95,9 @@ jobs: - name: Setup uses: ./.github/actions/setup with: - NODE_VERSION: ${{ matrix.node-version }} - GITHUB_REF_NAME: ${{ github.ref_name }} - GITHUB_SHA: ${{ github.sha }} + node-version: ${{ matrix.node-version }} + github-ref-name: ${{ github.ref_name }} + github-sha: ${{ github.sha }} - name: Run ${{ matrix.script }} run: yarn ${{ matrix.script }} @@ -117,9 +118,9 @@ jobs: - name: Setup uses: ./.github/actions/setup with: - NODE_VERSION: ${{ matrix.node-version }} - GITHUB_REF_NAME: ${{ github.ref_name }} - GITHUB_SHA: ${{ github.sha }} + node-version: ${{ matrix.node-version }} + github-ref-name: ${{ github.ref_name }} + github-sha: ${{ github.sha }} - name: Run ${{ matrix.script }} run: yarn ${{ matrix.script }} @@ -136,9 +137,9 @@ jobs: - name: Setup uses: ./.github/actions/setup with: - NODE_VERSION: 16.x - GITHUB_REF_NAME: ${{ github.ref_name }} - GITHUB_SHA: ${{ github.sha }} + node-version: 16.x + github-ref-name: ${{ github.ref_name }} + github-sha: ${{ github.sha }} - name: Check @ngxs build artifacts uses: ./.github/actions/check-build-artifacts From b3ba642d1280dbd918babc9b266a7bd44ab0e0d0 Mon Sep 17 00:00:00 2001 From: rfprod Date: Mon, 13 Jun 2022 23:40:10 +0300 Subject: [PATCH 25/26] ci(actions): add composite actions to upload/download artifacts - [x] add two composite actions to upload/download integration test artifacts; --- .../actions/check-build-artifacts/action.yml | 1 + .../action.yml | 43 +++++++++++++++++++ .github/actions/setup/action.yml | 1 + .../action.yml | 34 +++++++++++++++ .github/workflows/pr-validation.yml | 10 +++++ .github/workflows/release.yml | 10 +++++ .github/workflows/trunk.yml | 13 ++++++ 7 files changed, 112 insertions(+) create mode 100644 .github/actions/download-integration-test-artifacts/action.yml create mode 100644 .github/actions/upload-integration-test-artifact/action.yml diff --git a/.github/actions/check-build-artifacts/action.yml b/.github/actions/check-build-artifacts/action.yml index c6c281749..b2514b3d4 100644 --- a/.github/actions/check-build-artifacts/action.yml +++ b/.github/actions/check-build-artifacts/action.yml @@ -8,6 +8,7 @@ name: check-build-artifacts description: Ensure the build artifact directories exist + runs: using: 'composite' steps: diff --git a/.github/actions/download-integration-test-artifacts/action.yml b/.github/actions/download-integration-test-artifacts/action.yml new file mode 100644 index 000000000..8106917dd --- /dev/null +++ b/.github/actions/download-integration-test-artifacts/action.yml @@ -0,0 +1,43 @@ +# For more information see: +# - https://docs.github.com/en/actions/creating-actions/creating-a-composite-action +# - https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions#outputsoutput_id + +# The action can be referenced in workflows like: +# - ngxs/store/.github/actions/download-integration-test-artifacts@master +# - ./.github/actions/download-integration-test-artifacts + +name: download-integration-test-artifact +description: Downloads all integration test artifacts with names such as 'hello-world-ng11-ivy'. + +inputs: + path: + description: A path to download the artifacts. + required: true + default: './integrations' + +runs: + using: 'composite' + steps: + - name: Download hello-world-ng11-ivy artifacts + uses: actions/download-artifact@v3 + with: + name: hello-world-ng11-ivy + path: ${{ inputs.path }} + + - name: Download hello-world-ng12-ivy artifacts + uses: actions/download-artifact@v3 + with: + name: hello-world-ng12-ivy + path: ${{ inputs.path }} + + - name: Download hello-world-ng13-ivy artifacts + uses: actions/download-artifact@v3 + with: + name: hello-world-ng13-ivy + path: ${{ inputs.path }} + + - name: Download hello-world-ng14-ivy artifacts + uses: actions/download-artifact@v3 + with: + name: hello-world-ng14-ivy + path: ${{ inputs.path }} diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml index a3ccbea6b..9f0101198 100644 --- a/.github/actions/setup/action.yml +++ b/.github/actions/setup/action.yml @@ -8,6 +8,7 @@ name: setup description: Set up environment + inputs: node-version: description: Node version diff --git a/.github/actions/upload-integration-test-artifact/action.yml b/.github/actions/upload-integration-test-artifact/action.yml new file mode 100644 index 000000000..cb0504009 --- /dev/null +++ b/.github/actions/upload-integration-test-artifact/action.yml @@ -0,0 +1,34 @@ +# For more information see: +# - https://docs.github.com/en/actions/creating-actions/creating-a-composite-action +# - https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions#outputsoutput_id + +# The action can be referenced in workflows like: +# - ngxs/store/.github/actions/upload-integration-test-artifact@master +# - ./.github/actions/upload-integration-test-artifact + +name: upload-integration-test-artifact +description: Upload an integration test artifact with a name such as 'hello-world-ng11-ivy'. + +inputs: + script: + description: A script with a name such as 'integration:ng11:ivy' that generates an integration test artifact. + required: true + +runs: + using: 'composite' + steps: + - name: Generate an artifact name + id: artifact-name + shell: bash + run: | + echo "Replace colons with dashes, substring 'integration' with a substring 'hello-world'. Example result: hello-world-ng11-ivy" + echo "::set-output name=value::$(echo ${SCRIPT} | sed -r "s/:/-/g" | sed -r "s/integration/hello-world/g")" + env: + SCRIPT: ${{ inputs.script }} + + - name: Upload ${{ inputs.script }} artifact + uses: actions/upload-artifact@v3 + with: + name: ${{ steps.artifact-name.outputs.value }} + path: ./integrations/**/dist-integration/main.*.js + retention-days: 1 diff --git a/.github/workflows/pr-validation.yml b/.github/workflows/pr-validation.yml index 1059c146b..437c8ffb3 100644 --- a/.github/workflows/pr-validation.yml +++ b/.github/workflows/pr-validation.yml @@ -90,6 +90,7 @@ jobs: - 'integration:ng11:ivy' - 'integration:ng12:ivy' - 'integration:ng13:ivy' + - 'integration:ng14:ivy' - 'test:types' steps: @@ -109,6 +110,12 @@ jobs: - name: Run ${{ matrix.script }} run: yarn ${{ matrix.script }} + - name: Upload an integration test artifact + if: ${{ matrix.script == 'integration:ng11:ivy' || matrix.script == 'integration:ng12:ivy' || matrix.script == 'integration:ng13:ivy' || matrix.script == 'integration:ng14:ivy' }} + uses: ./.github/actions/upload-integration-test-artifact + with: + script: ${{ matrix.script }} + premerge-bundlesize: runs-on: ubuntu-latest needs: premerge-integration-test @@ -132,5 +139,8 @@ jobs: github-ref-name: ${{ github.ref_name }} github-sha: ${{ github.event.pull_request.head.sha }} + - name: Download integration test artifacts + uses: ./.github/actions/download-integration-test-artifacts + - name: Run ${{ matrix.script }} run: yarn ${{ matrix.script }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c626a3aa3..63bc67831 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -86,6 +86,7 @@ jobs: - 'integration:ng11:ivy' - 'integration:ng12:ivy' - 'integration:ng13:ivy' + - 'integration:ng14:ivy' - 'test:types' steps: @@ -102,6 +103,12 @@ jobs: - name: Run ${{ matrix.script }} run: yarn ${{ matrix.script }} + - name: Upload an integration test artifact + if: ${{ matrix.script == 'integration:ng11:ivy' || matrix.script == 'integration:ng12:ivy' || matrix.script == 'integration:ng13:ivy' || matrix.script == 'integration:ng14:ivy' }} + uses: ./.github/actions/upload-integration-test-artifact + with: + script: ${{ matrix.script }} + release-bundlesize: runs-on: ubuntu-latest needs: release-integration-test @@ -125,6 +132,9 @@ jobs: - name: Run ${{ matrix.script }} run: yarn ${{ matrix.script }} + - name: Download integration test artifacts + uses: ./.github/actions/download-integration-test-artifacts + release-publish: runs-on: ubuntu-latest environment: npm-publish diff --git a/.github/workflows/trunk.yml b/.github/workflows/trunk.yml index 958161fff..a635c2200 100644 --- a/.github/workflows/trunk.yml +++ b/.github/workflows/trunk.yml @@ -86,6 +86,7 @@ jobs: - 'integration:ng11:ivy' - 'integration:ng12:ivy' - 'integration:ng13:ivy' + - 'integration:ng14:ivy' - 'test:types' steps: @@ -102,6 +103,12 @@ jobs: - name: Run ${{ matrix.script }} run: yarn ${{ matrix.script }} + - name: Upload an integration test artifact + if: ${{ matrix.script == 'integration:ng11:ivy' || matrix.script == 'integration:ng12:ivy' || matrix.script == 'integration:ng13:ivy' || matrix.script == 'integration:ng14:ivy' }} + uses: ./.github/actions/upload-integration-test-artifact + with: + script: ${{ matrix.script }} + trunk-bundlesize: runs-on: ubuntu-latest needs: trunk-integration-test @@ -125,6 +132,9 @@ jobs: - name: Run ${{ matrix.script }} run: yarn ${{ matrix.script }} + - name: Download integration test artifacts + uses: ./.github/actions/download-integration-test-artifacts + trunk-publish: runs-on: ubuntu-latest environment: npm-publish @@ -150,3 +160,6 @@ jobs: yarn publish:dev echo "Security: remove ~/.npmrc from the runner overwriting it with zeros several times." find ~/.npmrc -exec shred -fuz {} + + + - name: Run ${{ matrix.script }} + run: yarn ${{ matrix.script }} From 5eb6e7c7fb3ec6d982d2eb998afdd41a15e0002e Mon Sep 17 00:00:00 2001 From: Mark Whitfeld Date: Wed, 15 Jun 2022 09:52:30 +0200 Subject: [PATCH 26/26] fix: bundlesize step order (release & trunk) --- .github/workflows/release.yml | 6 +++--- .github/workflows/trunk.yml | 9 +++------ 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 63bc67831..31dcf5dd1 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -129,12 +129,12 @@ jobs: github-ref-name: ${{ github.ref_name }} github-sha: ${{ github.sha }} - - name: Run ${{ matrix.script }} - run: yarn ${{ matrix.script }} - - name: Download integration test artifacts uses: ./.github/actions/download-integration-test-artifacts + - name: Run ${{ matrix.script }} + run: yarn ${{ matrix.script }} + release-publish: runs-on: ubuntu-latest environment: npm-publish diff --git a/.github/workflows/trunk.yml b/.github/workflows/trunk.yml index a635c2200..630529a41 100644 --- a/.github/workflows/trunk.yml +++ b/.github/workflows/trunk.yml @@ -129,12 +129,12 @@ jobs: github-ref-name: ${{ github.ref_name }} github-sha: ${{ github.sha }} - - name: Run ${{ matrix.script }} - run: yarn ${{ matrix.script }} - - name: Download integration test artifacts uses: ./.github/actions/download-integration-test-artifacts + - name: Run ${{ matrix.script }} + run: yarn ${{ matrix.script }} + trunk-publish: runs-on: ubuntu-latest environment: npm-publish @@ -160,6 +160,3 @@ jobs: yarn publish:dev echo "Security: remove ~/.npmrc from the runner overwriting it with zeros several times." find ~/.npmrc -exec shred -fuz {} + - - - name: Run ${{ matrix.script }} - run: yarn ${{ matrix.script }}