diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml new file mode 100644 index 00000000..d7abb16a --- /dev/null +++ b/.github/actions/setup/action.yml @@ -0,0 +1,22 @@ +name: setup +jobs: + setup: + runs-on: ubuntu-latest + steps: + - name: Derive appropriate SHAs for base and head for `nx affected` commands + uses: nrwl/nx-set-shas@v3 + with: + main-branch-name: 'master' + + - run: | + echo "BASE: ${{ env.NX_BASE }}" + echo "HEAD: ${{ env.NX_HEAD }}" + + - name: Installing Node.js 19.x + uses: actions/setup-node@v3 + with: + node-version: 19.x + cache: 'yarn' + + - name: Installing dependencies + run: yarn install --frozen-lockfile diff --git a/.github/conf/setup.yml b/.github/conf/setup.yml deleted file mode 100644 index f6a0d8e5..00000000 --- a/.github/conf/setup.yml +++ /dev/null @@ -1,23 +0,0 @@ -# basic configuration - -- uses: actions/checkout@v3 - with: - fetch-depth: 0 - -- name: Derive appropriate SHAs for base and head for `nx affected` commands - uses: nrwl/nx-set-shas@v3 - with: - main-branch-name: 'master' - -- run: | - echo "BASE: ${{ env.NX_BASE }}" - echo "HEAD: ${{ env.NX_HEAD }}" - -- name: Installing Node.js 19.x - uses: actions/setup-node@v3 - with: - node-version: 19.x - cache: 'yarn' - -- name: Installing dependencies - run: yarn install --frozen-lockfile diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index def26392..fafbc84b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -3,9 +3,11 @@ on: pull_request: branches: - master + - ci-testing push: branches: - master + - ci-testing workflow_call: permissions: @@ -16,19 +18,22 @@ jobs: name: Creating a Production Build runs-on: ubuntu-latest steps: + - name: Check out repository + uses: actions/checkout@v4 + - name: using setup script - uses: ./.github/conf/setup.yml + uses: ./.github/actions/setup - name: Creating a Production Build run: yarn dlx nx run root:build - build-storybook: name: Building and deploying storybook runs-on: ubuntu-latest steps: + - uses: actions/checkout@v4 + - name: using setup script - uses: ./.github/conf/setup.yml - - uses: actions/checkout@v3 + uses: ./.github/actions/setup/action.yml - name: Building storybook run: yarn dlx nx run ui:storybook:build diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index bd8811c9..7d6d9fba 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -3,9 +3,11 @@ on: pull_request: branches: - master + - ci-testing push: branches: - master + - ci-testing workflow_call: permissions: @@ -19,6 +21,10 @@ jobs: name: Pushing workflow to build branch runs-on: ubuntu-latest steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + - name: using setup script uses: ./.github/conf/setup.yml diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 9a9ac9e9..e077679a 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -3,9 +3,11 @@ on: pull_request: branches: - master + - ci-testing push: branches: - master + - ci-testing permissions: contents: write @@ -14,6 +16,10 @@ jobs: name: Linting project runs-on: ubuntu-latest steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + - name: using setup script uses: ./.github/conf/setup.yml diff --git a/.github/workflows/setup.yml b/.github/workflows/setup.yml new file mode 100644 index 00000000..136472d0 --- /dev/null +++ b/.github/workflows/setup.yml @@ -0,0 +1,26 @@ +name: setup + +on: + workflow_call: + +jobs: + setup: + runs-on: ubuntu-latest + steps: + - name: Derive appropriate SHAs for base and head for `nx affected` commands + uses: nrwl/nx-set-shas@v3 + with: + main-branch-name: 'master' + + - run: | + echo "BASE: ${{ env.NX_BASE }}" + echo "HEAD: ${{ env.NX_HEAD }}" + + - name: Installing Node.js 19.x + uses: actions/setup-node@v3 + with: + node-version: 19.x + cache: 'yarn' + + - name: Installing dependencies + run: yarn install --frozen-lockfile diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 893d0480..b87bbc10 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -3,9 +3,11 @@ on: pull_request: branches: - master + - ci-testing push: branches: - master + - ci-testing permissions: contents: write @@ -13,12 +15,17 @@ jobs: build-storybook: uses: ./.github/workflows/build.yml test-storybook: + name: testing storybook needs: [build-storybook] runs-on: ubuntu-latest steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + - name: using setup script - uses: ./.github/conf/setup.yml + uses: Gearonix/code-gear/.github/conf/setup.yml - name: Testing storybook in production run: yarn dlx nx run ui:storybook:test:production @@ -26,5 +33,9 @@ jobs: name: testing project runs-on: ubuntu-latest steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + - name: using setup script - uses: ./.github/conf/setup.yml + uses: Gearonix/code-gear/.github/conf/setup.yml