Skip to content

Commit

Permalink
ci: remove artifact name inputs
Browse files Browse the repository at this point in the history
  • Loading branch information
davidlj95 committed Jul 22, 2024
1 parent 1339a93 commit efde006
Show file tree
Hide file tree
Showing 10 changed files with 63 additions and 141 deletions.
23 changes: 0 additions & 23 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@ jobs:
build:
name: Build
uses: ./.github/workflows/reusable-build.yml
with:
dist-artifact-name: ngx-meta-dist
dist-artifact-name-coverage-suffix: -coverage
tsc-artifact-name: ngx-meta-tsc
test:
name: Test
uses: ./.github/workflows/reusable-test.yml
Expand All @@ -30,42 +26,26 @@ jobs:
needs: build
name: API Extractor
uses: ./.github/workflows/reusable-api-extractor.yml
with:
tsc-artifact-name: ngx-meta-tsc
api-docs-artifact-name: ngx-meta-api-docs
example-apps:
needs: build
name: Example apps
uses: ./.github/workflows/reusable-example-apps.yml
with:
dist-artifact-name: ngx-meta-dist
dist-artifact-name-coverage-suffix: -coverage
example-app-artifact-name-prefix: ngx-meta-example-app-
example-app-artifact-name-coverage-suffix: -coverage
e2e:
needs: example-apps
name: E2E
uses: ./.github/workflows/reusable-e2e.yml
with:
example-app-artifact-name-prefix: ngx-meta-example-app-
example-app-artifact-name-coverage-suffix: -coverage
secrets:
codecov-token: ${{ secrets.CODECOV_TOKEN }}
bundle-size:
needs: example-apps
name: Bundle size
uses: ./.github/workflows/reusable-bundle-size.yml
with:
example-app-artifact-name-prefix: ngx-meta-example-app-
bundle-size-artifact-name-prefix: ngx-meta-bundle-size-
permissions:
checks: write
release:
name: Release
needs: e2e
uses: ./.github/workflows/reusable-release.yml
with:
dist-artifact-name: ngx-meta-dist
secrets:
npm-token: ${{ secrets.NPM_TOKEN }}
github-token-pr: ${{ secrets.PR_GH_TOKEN }}
Expand All @@ -78,9 +58,6 @@ jobs:
name: Docs
needs: [api-extractor, bundle-size]
uses: ./.github/workflows/reusable-docs.yml
with:
api-docs-artifact-name: ngx-meta-api-docs
bundle-size-artifact-name-prefix: ngx-meta-bundle-size-
secrets:
cloudflare-account-id: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
cloudflare-api-token: ${{ secrets.CLOUDFLARE_API_TOKEN }}
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/pull-request-completed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ permissions:
pull-requests: write

env:
#👇 Keep in sync with pull request workflow
BUNDLE_SIZE_ARTIFACT_NAME_PREFIX: ngx-meta-bundle-size-
#👇 Keep in sync with bundle size reusable workflow
#👇 Keep in sync with bundle size workflow
BUNDLE_SIZE_ARTIFACT_NAME_SUFFIX: -bundle-size
#👇 Keep in sync with bundle size workflow
BUNDLE_SIZE_COMMENT_ID_PREFIX: bundle-size-comment-

jobs:
Expand All @@ -34,7 +34,7 @@ jobs:
- name: Download bundle size analysis results
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4
with:
name: ${{ env.BUNDLE_SIZE_ARTIFACT_NAME_PREFIX }}${{ matrix.app-name }}
name: ngx-meta${{ env.BUNDLE_SIZE_ARTIFACT_NAME_SUFFIX }}-${{ matrix.app-name }}
#👇 Need to specify it, otherwise, `run-id` argument won't be taken into account
# https://github.com/actions/download-artifact/tree/v4.1.4#:~:text=current%20workflow%20run.-,github%2Dtoken%3A,-%23%20The%20repository
github-token: ${{ secrets.GITHUB_TOKEN }}
Expand Down
21 changes: 0 additions & 21 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@ jobs:
build:
name: Build
uses: ./.github/workflows/reusable-build.yml
with:
dist-artifact-name: ngx-meta-dist
dist-artifact-name-coverage-suffix: -coverage
tsc-artifact-name: ngx-meta-tsc
test:
name: Test
uses: ./.github/workflows/reusable-test.yml
Expand All @@ -27,41 +23,24 @@ jobs:
needs: build
name: API Extractor
uses: ./.github/workflows/reusable-api-extractor.yml
with:
tsc-artifact-name: ngx-meta-tsc
api-docs-artifact-name: ngx-meta-api-docs
example-apps:
needs: build
name: Example apps
uses: ./.github/workflows/reusable-example-apps.yml
with:
dist-artifact-name: ngx-meta-dist
dist-artifact-name-coverage-suffix: -coverage
example-app-artifact-name-prefix: ngx-meta-example-app-
example-app-artifact-name-coverage-suffix: -coverage
e2e:
needs: example-apps
name: E2E
uses: ./.github/workflows/reusable-e2e.yml
with:
example-app-artifact-name-prefix: ngx-meta-example-app-
example-app-artifact-name-coverage-suffix: -coverage
secrets:
codecov-token: ${{ secrets.CODECOV_TOKEN }}
bundle-size:
needs: example-apps
name: Bundle size
uses: ./.github/workflows/reusable-bundle-size.yml
with:
example-app-artifact-name-prefix: ngx-meta-example-app-
bundle-size-artifact-name-prefix: ngx-meta-bundle-size-
docs:
needs: [api-extractor, bundle-size]
name: Docs
uses: ./.github/workflows/reusable-docs.yml
with:
api-docs-artifact-name: ngx-meta-api-docs
bundle-size-artifact-name-prefix: ngx-meta-bundle-size-
secrets:
cloudflare-account-id: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
cloudflare-api-token: ${{ secrets.CLOUDFLARE_API_TOKEN }}
Expand Down
23 changes: 9 additions & 14 deletions .github/workflows/reusable-api-extractor.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
name: API Extractor
on:
workflow_call:
inputs:
tsc-artifact-name:
description: Artifact name containing built lib
type: string
required: false
api-docs-artifact-name:
description: Artifact name containing markdown docs output
type: string
required: true

env:
API_EXTRACTOR_ARTIFACT_NAME: ngx-meta-api-extractor
# 👇 Keep in sync with build workflow
TSC_ARTIFACT_NAME_SUFFIX: -tsc
API_EXTRACTOR_ARTIFACT_NAME_SUFFIX: -api-extractor
# 👇 Keep in sync with docs workflow
API_DOCS_ARTIFACT_NAME_SUFFIX: -api-docs

jobs:
api-extractor:
Expand All @@ -25,7 +20,7 @@ jobs:
- name: Download tsc output files
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4
with:
name: ${{ inputs.tsc-artifact-name }}
name: ngx-meta${{ env.TSC_ARTIFACT_NAME_SUFFIX }}
path: projects/ngx-meta/out
- name: Setup
uses: ./.github/actions/setup
Expand All @@ -34,7 +29,7 @@ jobs:
- name: Upload API Extractor JSON docs
uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4
with:
name: ${{ env.API_EXTRACTOR_ARTIFACT_NAME }}
name: ngx-meta${{ env.API_EXTRACTOR_ARTIFACT_NAME_SUFFIX }}
path: projects/ngx-meta/api-extractor/*.api.json
retention-days: 5

Expand All @@ -49,7 +44,7 @@ jobs:
- name: Download API Extractor JSON docs
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4
with:
name: ${{ env.API_EXTRACTOR_ARTIFACT_NAME }}
name: ngx-meta${{ env.API_EXTRACTOR_ARTIFACT_NAME_SUFFIX }}
path: projects/ngx-meta/api-extractor
- name: Setup
uses: ./.github/actions/setup
Expand All @@ -58,6 +53,6 @@ jobs:
- name: Upload API Documenter generated markdown docs
uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4
with:
name: ${{ inputs.api-docs-artifact-name }}
name: ngx-meta${{ env.API_DOCS_ARTIFACT_NAME_SUFFIX }}
path: projects/ngx-meta/docs/content/api
retention-days: 5
27 changes: 11 additions & 16 deletions .github/workflows/reusable-build.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,14 @@
name: Build
on:
workflow_call:
inputs:
dist-artifact-name:
description: Name for artifact containing lib dist files
type: string
required: true
dist-artifact-name-coverage-suffix:
description: Name suffix for artifact containing lib dist files instrumented for code coverage tracking
type: string
required: true
tsc-artifact-name:
description: Name for artifact containing lib tsc output files
type: string
required: true

env:
# 👇 Keep in sync with release and example apps workflow
DIST_ARTIFACT_NAME_SUFFIX: -dist
# 👇 Keep in sync with example apps workflow
COVERAGE_ARTIFACT_NAME_SUFFIX: -coverage
# 👇 Keep in sync with API Extractor workflow
TSC_ARTIFACT_NAME_SUFFIX: -tsc

jobs:
build:
Expand All @@ -35,15 +30,15 @@ jobs:
- name: Upload distribution files
uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4
with:
name: ${{ inputs.dist-artifact-name }}
name: ngx-meta${{ env.DIST_ARTIFACT_NAME_SUFFIX }}
path: projects/ngx-meta/dist
retention-days: 5
- name: Instrument for coverage
run: pnpm run ngx-meta:instrument-for-coverage
- name: Upload distribution files with coverage instrumentation
uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4
with:
name: ${{ inputs.dist-artifact-name }}${{ inputs.dist-artifact-name-coverage-suffix }}
name: ngx-meta${{ env.DIST_ARTIFACT_NAME_SUFFIX }}${{ env.COVERAGE_ARTIFACT_NAME_SUFFIX }}
path: projects/ngx-meta/dist
retention-days: 5

Expand All @@ -61,6 +56,6 @@ jobs:
- name: Upload compiled JS files
uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4
with:
name: ${{ inputs.tsc-artifact-name }}
name: ngx-meta${{ env.TSC_ARTIFACT_NAME_SUFFIX }}
path: projects/ngx-meta/out
retention-days: 5
21 changes: 8 additions & 13 deletions .github/workflows/reusable-bundle-size.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,20 @@
name: Bundle size
on:
workflow_call:
inputs:
example-app-artifact-name-prefix:
description: Artifact name prefix containing built example apps
required: true
type: string
bundle-size-artifact-name-prefix:
description: Artifact name prefix where bundle size info is stored
required: true
type: string

#permissions:
# 👇 Needed for main bundle size check store only
# checks: write

env:
# 👇 Keep in sync with on bundle size completed workflow
# 👇 Keep in sync with pull request completed workflow
BUNDLE_SIZE_COMMENT_ID_PREFIX: bundle-size-comment-
BUNDLE_SIZE_CHECK_RUN_NAME_PREFIX: ngx-meta-bundle-size-
BUNDLE_SIZE_DIR: projects/ngx-meta/bundle-size
# 👇 Keep in sync with example apps workflow
EXAMPLE_APP_ARTIFACT_NAME_SUFFIX: -example-app
# 👇 Keep in sync with pull request completed and docs workflow
BUNDLE_SIZE_ARTIFACT_NAME_SUFFIX: -bundle-size

jobs:
analysis:
Expand All @@ -41,7 +36,7 @@ jobs:
- name: Download example app distribution files
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4
with:
name: ${{ inputs.example-app-artifact-name-prefix }}${{ matrix.app-name }}
name: ngx-meta${{ env.EXAMPLE_APP_ARTIFACT_NAME_SUFFIX }}-${{ matrix.app-name }}
path: ${{ env.EXAMPLE_APP_DIR }}
- name: Setup pnpm
uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # v4.0.0
Expand Down Expand Up @@ -92,7 +87,7 @@ jobs:
- name: Upload bundle size analysis results
uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4
with:
name: ${{ inputs.bundle-size-artifact-name-prefix }}${{ matrix.app-name }}
name: ngx-meta${{ env.BUNDLE_SIZE_ARTIFACT_NAME_SUFFIX }}-${{ matrix.app-name }}
path: ${{ env.BUNDLE_SIZE_DIR }}/${{ env.OUTPUT_DIR }}
retention-days: 5

Expand All @@ -109,7 +104,7 @@ jobs:
- name: Download main bundle analysis results
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4
with:
name: ${{ inputs.bundle-size-artifact-name-prefix }}${{ matrix.app-name }}
name: ngx-meta${{ env.BUNDLE_SIZE_ARTIFACT_NAME_SUFFIX }}-${{ matrix.app-name }}
- name: Create check run
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7
with:
Expand Down
21 changes: 8 additions & 13 deletions .github/workflows/reusable-docs.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
name: Docs
on:
workflow_call:
inputs:
api-docs-artifact-name:
description: Artifact name containing API reference markdown docs
type: string
required: true
bundle-size-artifact-name-prefix:
description: Artifact name prefix containing bundle size info
type: string
required: true
secrets:
cloudflare-account-id:
required: true
Expand All @@ -18,6 +9,10 @@ on:

env:
DOCS_DIR: projects/ngx-meta/docs
# 👇 Keep in sync with API Extractor workflow
API_DOCS_ARTIFACT_NAME_SUFFIX: -api-docs
# 👇 Keep in sync with pull request completed workflow
BUNDLE_SIZE_ARTIFACT_NAME_SUFFIX: -bundle-size

permissions:
deployments: write
Expand All @@ -42,18 +37,18 @@ jobs:
- name: Download API reference docs
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4
with:
name: ${{ inputs.api-docs-artifact-name }}
name: ngx-meta${{ env.API_DOCS_ARTIFACT_NAME_SUFFIX }}
path: projects/ngx-meta/docs/content/api
- name: Download bundle size info
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4
with:
pattern: ${{ inputs.bundle-size-artifact-name-prefix }}*
pattern: ngx-meta${{ env.BUNDLE_SIZE_ARTIFACT_NAME-SUFFIX }}*
- name: Copy reports into directories
working-directory: .
run: |
# shellcheck disable=SC2001
for artifact_dir in "${{ inputs.bundle-size-artifact-name-prefix }}"*; do
app_name="$(echo "$artifact_dir" | sed "s/^${{ inputs.bundle-size-artifact-name-prefix }}//")"
for artifact_dir in "ngx-meta${{ env.BUNDLE_SIZE_ARTIFACT_NAME_PREFIX }}"*; do
app_name="$(echo "$artifact_dir" | sed "s/^ngx-meta${{ env.BUNDLE_SIZE_ARTIFACT_NAME_SUFFIX }}-//")"
bundle_size_app_dir="projects/ngx-meta/bundle-size/out/$app_name"
mkdir -p "$bundle_size_app_dir"
cp "$artifact_dir/bundle-size-report.md" "$bundle_size_app_dir"
Expand Down
15 changes: 5 additions & 10 deletions .github/workflows/reusable-e2e.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
name: E2E
on:
workflow_call:
inputs:
example-app-artifact-name-prefix:
description: Artifact name prefix containing built example apps
required: true
type: string
example-app-artifact-name-coverage-suffix:
description: Artifact name suffix used to indicate example app is instrumented to track for coverage
required: true
type: string
secrets:
codecov-token:
description: Token to use to upload coverage to Codecov. Can be empty for forks https://about.codecov.io/blog/january-product-update-updating-the-codecov-ci-uploaders-to-the-codecov-cli/
Expand All @@ -18,6 +9,10 @@ on:
env:
E2E_DIR: projects/ngx-meta/e2e
COVERAGE_DIR: coverage/ngx-meta
# 👇 Keep in sync with example apps workflow
COVERAGE_ARTIFACT_NAME_SUFFIX: -coverage
# 👇 Keep in sync with example apps workflow
EXAMPLE_APP_ARTIFACT_NAME_SUFFIX: -example-app

jobs:
e2e:
Expand All @@ -38,7 +33,7 @@ jobs:
- name: Download example app with coverage instrumentation
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4
with:
name: ${{ inputs.example-app-artifact-name-prefix }}${{ matrix.app-name }}${{ inputs.example-app-artifact-name-coverage-suffix }}
name: ngx-meta${{ env.EXAMPLE_APP_ARTIFACT_NAME_SUFFIX }}-${{ matrix.app-name }}${{ env.COVERAGE_ARTIFACT_NAME_SUFFIX }}
path: ${{ env.EXAMPLE_APP_DIR }}
- name: Setup pnpm
uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # v4.0.0
Expand Down
Loading

0 comments on commit efde006

Please sign in to comment.