From 20275de19e97d4d76f46f9384258b2c3098b2919 Mon Sep 17 00:00:00 2001 From: Giles Westwood Date: Thu, 4 May 2023 13:18:04 +0100 Subject: [PATCH 1/4] feat: shift left prettier --- .pre-commit-config.yaml | 48 ++++++++++++++++++++++++++++++++++++----- 1 file changed, 43 insertions(+), 5 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index a38908552b..fbebca6177 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.3.0 + rev: v4.4.0 hooks: - id: check-added-large-files name: check for added large files @@ -8,15 +8,53 @@ repos: entry: check-added-large-files language: python stages: [commit, push, manual] + exclude: ^tx - - repo: local # Use a local repository + - id: check-executables-have-shebangs + name: check that executables have shebangs + description: ensures that (non-binary) executables have a shebang. + entry: check-executables-have-shebangs + language: python + types: [text, executable] + stages: [commit, push, manual] + + - id: check-yaml + name: check yaml + description: checks yaml files for parseable syntax. + entry: check-yaml + args: ['--allow-multiple-documents'] + language: python + exclude: '.ytt.yaml$' + types: [yaml] + + - repo: https://github.com/pre-commit/mirrors-prettier + rev: 'v2.7.1' + hooks: + - id: prettier + types_or: [css, javascript] + + - repo: local hooks: - id: actionlint - name: Lint GitHub Actions workflow files - description: Runs actionlint to lint GitHub Actions workflow files + name: actionlint entry: actionlint language: golang additional_dependencies: [github.com/rhysd/actionlint/cmd/actionlint@v1.6.23] - types: ['yaml'] + types: [yaml] files: '^.github/workflows/' + +########## +# pre-commit-ci config + +ci: + autofix_commit_msg: | + [pre-commit.ci] auto fixes from pre-commit.com hooks + + for more information, see https://pre-commit.ci + autofix_prs: true + autoupdate_branch: '' + autoupdate_commit_msg: '[pre-commit.ci] pre-commit autoupdate' + autoupdate_schedule: weekly + skip: [] + submodules: false From 129643a9d3e72bba9c26458e9d2e9ee44f5b5a22 Mon Sep 17 00:00:00 2001 From: Giles Westwood Date: Thu, 4 May 2023 13:18:34 +0100 Subject: [PATCH 2/4] fix: remove execute bit --- .tx/config_20230220084312.bak | 0 shellkit_bootstrap.sh | 0 2 files changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 .tx/config_20230220084312.bak mode change 100755 => 100644 shellkit_bootstrap.sh diff --git a/.tx/config_20230220084312.bak b/.tx/config_20230220084312.bak old mode 100755 new mode 100644 diff --git a/shellkit_bootstrap.sh b/shellkit_bootstrap.sh old mode 100755 new mode 100644 From b73d4c2ad54402e9b8b8f0616373943e774487ad Mon Sep 17 00:00:00 2001 From: Giles Westwood Date: Thu, 4 May 2023 13:20:27 +0100 Subject: [PATCH 3/4] fix: ignore formmating in github actions --- .prettierignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.prettierignore b/.prettierignore index 5a0a23f045..959502052b 100644 --- a/.prettierignore +++ b/.prettierignore @@ -3,4 +3,5 @@ package-lock.json dist .angulardoc.json .vscode/* -.angular/* \ No newline at end of file +.angular/* +.github/* From d2191c5149bc304062f9a06924ce545d0bef4fd8 Mon Sep 17 00:00:00 2001 From: Giles Westwood Date: Thu, 4 May 2023 15:19:42 +0100 Subject: [PATCH 4/4] feat: full build test release pipeline --- .github/workflows/bld_all.yml | 52 ++++++--- .github/workflows/bld_all_yarn.yml | 27 +++++ .github/workflows/bld_maven.yml | 72 ++++++++---- .github/workflows/bld_yarn.yml | 36 ++++++ .github/workflows/build_test_release_tag.yml | 115 +++++++++++++++++++ .github/workflows/commit.yml | 19 +++ .github/workflows/format_i18n.yml | 22 ++++ .github/workflows/format_prettier.yml | 22 ++++ .github/workflows/init.yml | 18 --- .github/workflows/lint.yml | 32 ++++++ .github/workflows/pr.yml | 29 +++++ .github/workflows/prettier-linter.yml | 23 ---- .github/workflows/prod.yml | 18 --- .github/workflows/pushdev.yml | 28 +++++ .github/workflows/pushmain.yml | 29 +++++ .github/workflows/qa.yml | 18 --- .github/workflows/rel_tag.yml | 91 +++++++++++++++ .github/workflows/sandbox.yml | 18 --- .github/workflows/storybook.yml | 34 ------ .github/workflows/tests.yml | 17 --- .github/workflows/unit_tests.yml | 17 +++ 21 files changed, 554 insertions(+), 183 deletions(-) create mode 100644 .github/workflows/bld_all_yarn.yml create mode 100644 .github/workflows/bld_yarn.yml create mode 100644 .github/workflows/build_test_release_tag.yml create mode 100644 .github/workflows/commit.yml create mode 100644 .github/workflows/format_i18n.yml create mode 100644 .github/workflows/format_prettier.yml delete mode 100644 .github/workflows/init.yml create mode 100644 .github/workflows/lint.yml create mode 100644 .github/workflows/pr.yml delete mode 100644 .github/workflows/prettier-linter.yml delete mode 100644 .github/workflows/prod.yml create mode 100644 .github/workflows/pushdev.yml create mode 100644 .github/workflows/pushmain.yml delete mode 100644 .github/workflows/qa.yml create mode 100644 .github/workflows/rel_tag.yml delete mode 100644 .github/workflows/sandbox.yml delete mode 100644 .github/workflows/storybook.yml delete mode 100644 .github/workflows/tests.yml create mode 100644 .github/workflows/unit_tests.yml diff --git a/.github/workflows/bld_all.yml b/.github/workflows/bld_all.yml index bca3417890..5a0413bc8e 100644 --- a/.github/workflows/bld_all.yml +++ b/.github/workflows/bld_all.yml @@ -1,5 +1,7 @@ name: bld_all +#NOTE: this deploys assets as well as builds + permissions: checks: write contents: read @@ -10,29 +12,47 @@ on: workflow_call: inputs: version_tag: - description: 'version tag to use' + description: 'Version tag to use: (bump must also be set to none to keep a specific version' + required: false + default: 'latest' + type: string + bump: + description: 'whether to bump the version number by a major minor patch' required: false - default: 'next_tag' + default: 'patch' type: string - git_checkout: - description: 'branch or tag to checkout for building' + ref: + description: 'git reference to use with the checkout use default_branch to have that calculated' required: false - default: 'main' + default: "default" type: string workflow_dispatch: inputs: version_tag: - description: 'version tag to use' + description: 'Version tag to use: (bump must also be set to none to keep a specific version' required: false - default: 'next_tag' + default: 'latest' type: string - git_checkout: - description: 'branch or tag to checkout for building' + bump: + description: | + How to optionally bump the semver version ( Major.Minor.Patch ) : git log will be searched for + '#major #minor #patch' or feat/ or fix/ branch names to optionally override the bump. Set to none to keep a specific version required: false - default: 'main' + options: + - patch + - minor + - major + - none + type: choice + ref: + description: 'git reference to use with the checkout use default_branch to have that calculated' + required: false + default: "default" type: string + + jobs: bld_prod: uses: ./.github/workflows/bld_maven.yml @@ -45,7 +65,8 @@ jobs: with: artifact_name: prod version_tag: ${{ inputs.version_tag }} - git_checkout: ${{ inputs.git_checkout }} + bump: ${{ inputs.bump }} + ref: ${{ inputs.ref }} bld_sandbox: uses: ./.github/workflows/bld_maven.yml @@ -58,7 +79,8 @@ jobs: with: artifact_name: sandbox version_tag: ${{ inputs.version_tag }} - git_checkout: ${{ inputs.git_checkout }} + bump: ${{ inputs.bump }} + ref: ${{ inputs.ref }} bld_qa: uses: ./.github/workflows/bld_maven.yml @@ -71,7 +93,8 @@ jobs: with: artifact_name: qa version_tag: ${{ inputs.version_tag }} - git_checkout: ${{ inputs.git_checkout }} + bump: ${{ inputs.bump }} + ref: ${{ inputs.ref }} bld_int: uses: ./.github/workflows/bld_maven.yml @@ -84,4 +107,5 @@ jobs: with: artifact_name: int version_tag: ${{ inputs.version_tag }} - git_checkout: ${{ inputs.git_checkout }} + bump: ${{ inputs.bump }} + ref: ${{ inputs.ref }} diff --git a/.github/workflows/bld_all_yarn.yml b/.github/workflows/bld_all_yarn.yml new file mode 100644 index 0000000000..26a8955446 --- /dev/null +++ b/.github/workflows/bld_all_yarn.yml @@ -0,0 +1,27 @@ +name: bld_all_yarn + +on: + workflow_call: + + workflow_dispatch: + +jobs: + bld_prod: + uses: ./.github/workflows/bld_yarn.yml + with: + artifact_name: prod +# bld_sandbox: +# uses: ./.github/workflows/bld_yarn.yml +# with: +# artifact_name: sandbox +# +# bld_qa: +# uses: ./.github/workflows/bld_yarn.yml +# with: +# artifact_name: qa +# +# bld_int: +# uses: ./.github/workflows/bld_yarn.yml +# with: +# artifact_name: int +# diff --git a/.github/workflows/bld_maven.yml b/.github/workflows/bld_maven.yml index 73bcc39d7f..03c69d0a23 100644 --- a/.github/workflows/bld_maven.yml +++ b/.github/workflows/bld_maven.yml @@ -15,15 +15,20 @@ on: required: false default: 'prod' type: string - git_checkout: - description: 'branch or tag to checkout for building' - required: false - default: 'main' - type: string version_tag: description: 'Name of the tag to build' required: false - default: 'v2.0.1' + default: 'latest' + type: string + bump: + description: 'whether to bump the version number by a major minor patch amount or none' + required: false + default: 'patch' + type: string + ref: + description: 'git reference to use with the checkout use default_branch to have that calculated' + required: false + default: "default" type: string workflow_dispatch: @@ -33,30 +38,52 @@ on: required: false default: 'prod' type: string - git_checkout: - description: 'branch or tag to checkout for building' + version_tag: + description: 'Version tag to use: (bump must also be set to none to keep a specific version' required: false - default: 'main' + default: 'latest' type: string - version_tag: - description: 'Name of the tag to build' + bump: + description: | + How to optionally bump the semver version ( Major.Minor.Patch ) : git log will be searched for + '#major #minor #patch' or feat/ or fix/ branch names to optionally override the bump. Set to none to keep a specific version + required: false + options: + - patch + - minor + - major + - none + type: choice + ref: + description: 'git reference to use with the checkout use default_branch to have that calculated' required: false - default: 'v2.0.1' + default: "default" type: string jobs: bld_maven: runs-on: ubuntu-latest steps: + - name: git-checkout-ref-action + id: ref + uses: ORCID/git-checkout-ref-action@main + with: + default_branch: ${{ github.event.repository.default_branch }} + ref: ${{ inputs.ref }} + - uses: actions/checkout@v3 with: - ref: ${{ inputs.git_checkout }} + ref: ${{ steps.ref.outputs.ref }} + # checkout some history so we can scan commits for bump messages + # NOTE: history does not include tags! + fetch-depth: 100 - name: find next version id: version uses: ORCID/version-bump-action@main with: version_tag: ${{ inputs.version_tag }} + bump: ${{ inputs.bump }} - name: Set up Open JDK 11 uses: actions/setup-java@v3 @@ -65,11 +92,11 @@ jobs: java-version: '11' cache: 'maven' - - name: setup node - uses: actions/setup-node@v3 - with: - node-version: 'v16.13.2' - #18.7.0 +# FIXME: think that maven somehow pulls this in, so never cached +# - name: setup node +# uses: actions/setup-node@v3 +# with: +# node-version: 'v16.13.2' - name: show path run: | @@ -78,25 +105,24 @@ jobs: echo "$JAVA_HOME" echo "$tag_numeric" echo "$project" + ls -la shell: bash env: version_tag_numeric: '${{ steps.version.outputs.version_tag_numeric }}' project: '${{ inputs.artifact_name }}' - - name: bump version + - name: bump version using prod profile run: | mvn -T 1C --batch-mode versions:set \ - -DnewVersion="$version_tag_numeric" -DgenerateBackupPoms=false --activate-profiles "${build_env}" -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn + -DnewVersion="$version_tag_numeric" -DgenerateBackupPoms=false --activate-profiles prod -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn env: version_tag_numeric: '${{ steps.version.outputs.version_tag_numeric }}' - build_env: '${{ inputs.artifact_name }}' - name: check some build related things run: | - cat /home/runner/.m2/settings.xml - git --version git config user.name "GitHub Actions Bot" git config user.email "<>" + git --version git status git diff git rev-parse --abbrev-ref HEAD diff --git a/.github/workflows/bld_yarn.yml b/.github/workflows/bld_yarn.yml new file mode 100644 index 0000000000..9205c66bfc --- /dev/null +++ b/.github/workflows/bld_yarn.yml @@ -0,0 +1,36 @@ +name: bld_yarn +run-name: bld-{{ inputs.artifact_name }} + +permissions: + checks: write + contents: read + issues: read + +on: + workflow_call: + inputs: + artifact_name: + description: 'Name of the artifact env' + required: false + default: 'prod' + type: string + + workflow_dispatch: + inputs: + artifact_name: + description: 'Name of the artifact env' + required: false + default: 'prod' + type: string + +jobs: + bld_yarn: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 'v16.13.2' + cache: 'yarn' + - run: yarn + - run: yarn build:${{ inputs.artifact_name }} diff --git a/.github/workflows/build_test_release_tag.yml b/.github/workflows/build_test_release_tag.yml new file mode 100644 index 0000000000..179b1b0339 --- /dev/null +++ b/.github/workflows/build_test_release_tag.yml @@ -0,0 +1,115 @@ +name: build_test_release_tag + +on: + workflow_call: + inputs: + version_tag: + description: 'version tag to use' + required: false + default: "latest" + type: string + bump: + description: 'whether to bump the version number by a major minor patch amount or try gitlog' + required: false + default: "patch" + type: string + ref: + description: 'git reference to use with the checkout use default_branch to have that calculated' + required: false + default: "default" + type: string + + workflow_dispatch: + inputs: + version_tag: + description: 'version tag to use' + required: false + default: "latest" + type: string + bump: + description: | + How to optionally bump the semver version ( Major.Minor.Patch ) : git log will be searched for + '#major #minor #patch' or feat/ or fix/ branch names to optionally override the bump. Set to none to keep a specific version + required: false + options: + - patch + - minor + - major + - none + type: choice + ref: + description: 'git reference to use with the checkout use default_branch to have that calculated' + required: false + default: "default_branch" + type: string + + +# cancel running job if another commit comes in +concurrency: + group: main-${{ github.ref }}-1 + cancel-in-progress: true + +jobs: + format_i18n: + uses: ./.github/workflows/format_i18n.yml + secrets: inherit # pass all secrets for pushing + + format_prettier: + uses: ./.github/workflows/format_prettier.yml + secrets: inherit # pass all secrets for pushing + +############################################################################## + + lint: + uses: ./.github/workflows/lint.yml + needs: + - format_i18n + - format_prettier + + unit_tests: + uses: ./.github/workflows/unit_tests.yml + needs: + - format_i18n + - format_prettier + + # this is a test + bld_all_yarn: + uses: ./.github/workflows/bld_all_yarn.yml + needs: + - format_i18n + - format_prettier + +############################################################################## + bld_all: + uses: ./.github/workflows/bld_all.yml + secrets: inherit # pass all secrets for uploading assets + needs: + - lint + - bld_all_yarn + - format_i18n + - format_prettier + permissions: + checks: write + contents: read + issues: read + pull-requests: write + with: + version_tag: ${{ inputs.version_tag }} + bump: ${{ inputs.bump }} + ref: ${{ inputs.ref }} + +############################################################################## + + rel_tag: + uses: ./.github/workflows/rel_tag.yml + needs: bld_all + with: + version_tag: ${{ inputs.version_tag }} + bump: ${{ inputs.bump }} + ref: ${{ inputs.ref }} + secrets: inherit # pass all secrets + permissions: + checks: write + contents: write + issues: read + pull-requests: write diff --git a/.github/workflows/commit.yml b/.github/workflows/commit.yml new file mode 100644 index 0000000000..445de6088f --- /dev/null +++ b/.github/workflows/commit.yml @@ -0,0 +1,19 @@ +name: commit + +# run lints even before someone submits a pr + +on: + push: + branches: + - '**' # run on any branch + - '!main' + - '!development' + +# cancel running job if another commit comes in +concurrency: + group: commit-${{ github.ref }}-1 + cancel-in-progress: true + +jobs: + lint: + uses: ./.github/workflows/lint.yml diff --git a/.github/workflows/format_i18n.yml b/.github/workflows/format_i18n.yml new file mode 100644 index 0000000000..21ab1ac568 --- /dev/null +++ b/.github/workflows/format_i18n.yml @@ -0,0 +1,22 @@ +on: + workflow_call: + workflow_dispatch: + +name: format_i18n + +jobs: + format_i18n: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 'v16.13.2' + cache: 'yarn' + - run: yarn + - run: yarn build:i18n:generate-testing + - uses: EndBug/add-and-commit@c8bfb4ff65642c4c54445500822f6e7da558994a + with: + message: '๐Ÿค– GITHUB ACTIONS i18n generator' + env: + GITHUB_TOKEN: ${{ secrets.ORCID_RELEASER }} diff --git a/.github/workflows/format_prettier.yml b/.github/workflows/format_prettier.yml new file mode 100644 index 0000000000..914e575be4 --- /dev/null +++ b/.github/workflows/format_prettier.yml @@ -0,0 +1,22 @@ +on: + workflow_call: + workflow_dispatch: + +name: format_prettier + +jobs: + format_prettier: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 'v16.13.2' + cache: 'yarn' + - run: yarn + - run: yarn format + - uses: EndBug/add-and-commit@c8bfb4ff65642c4c54445500822f6e7da558994a + with: + message: '๐Ÿค– GITHUB ACTIONS format_prettier' + env: + GITHUB_TOKEN: ${{ secrets.ORCID_RELEASER }} diff --git a/.github/workflows/init.yml b/.github/workflows/init.yml deleted file mode 100644 index 27006252ef..0000000000 --- a/.github/workflows/init.yml +++ /dev/null @@ -1,18 +0,0 @@ -on: - push: - branches: - - main - - development - pull_request: -name: Build INT ๐Ÿ› ๏ธ - -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v2 - with: - node-version: 'v16.13.2' - - run: yarn - - run: yarn build:int diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000000..a75a9f27b1 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,32 @@ +name: lint + +# we don't pay for pre-commit-ci yet so need this for private repos + +permissions: + checks: write + contents: read + issues: read + pull-requests: write + +on: + workflow_call: + workflow_dispatch: + +jobs: + pre-commit: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: '3.10' + - name: set PY + run: echo "PY=$(python -VV | sha256sum | cut -d' ' -f1)" >> "$GITHUB_ENV" + - uses: actions/cache@v3 + with: + path: ~/.cache + key: pre-commit|${{ env.PY }}|${{ hashFiles('.pre-commit-config.yaml') }} + # lockdown all 3rd party repos to git shas + #- uses: cloudposse/github-action-pre-commit@32acf3179b9eda817c0f549e8057477d320827db + # migrate to standard pre-commit + - uses: pre-commit/action@5f528da5c95691c4cf42ff76a4d10854b62cbb82 diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml new file mode 100644 index 0000000000..cf7416b071 --- /dev/null +++ b/.github/workflows/pr.yml @@ -0,0 +1,29 @@ +name: pr + +# read-only repo token +# no access to secrets + +on: + pull_request: + types: [opened, synchronize, reopened] + + workflow_call: + + workflow_dispatch: + +# cancel running job if another commit comes in +concurrency: + group: pr-${{ github.ref }}-1 + cancel-in-progress: true + +jobs: + unit_tests: + uses: ./.github/workflows/unit_tests.yml + + # NOTE: this is just to test + bld_all_yarn: + uses: ./.github/workflows/bld_all_yarn.yml +# NOTE: codeql is only available on public repos or enterprise github accounts +# codeql: +# uses: ./.github/workflows/codeql.yml +# diff --git a/.github/workflows/prettier-linter.yml b/.github/workflows/prettier-linter.yml deleted file mode 100644 index 93238924e3..0000000000 --- a/.github/workflows/prettier-linter.yml +++ /dev/null @@ -1,23 +0,0 @@ -on: - push: - branches: - - main - - development - pull_request: - -name: Code formatting and testing languagesโœ๏ธ - -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v1 - - uses: actions/setup-node@v2 - - run: yarn - - run: yarn format - - run: yarn build:i18n:generate-testing - - uses: EndBug/add-and-commit@v4 - with: - message: '๐Ÿค– GITHUB ACTIONS' - env: - GITHUB_TOKEN: ${{ secrets.ORCID_MACHINE }} diff --git a/.github/workflows/prod.yml b/.github/workflows/prod.yml deleted file mode 100644 index 7e26e6b1c0..0000000000 --- a/.github/workflows/prod.yml +++ /dev/null @@ -1,18 +0,0 @@ -on: - push: - branches: - - main - - development - pull_request: -name: Test Build Production ๐Ÿ› ๏ธ - -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v2 - with: - node-version: 'v16.13.2' - - run: yarn - - run: yarn build:prod diff --git a/.github/workflows/pushdev.yml b/.github/workflows/pushdev.yml new file mode 100644 index 0000000000..aac5ad8177 --- /dev/null +++ b/.github/workflows/pushdev.yml @@ -0,0 +1,28 @@ +name: pushdev + +on: + push: + branches: + - development + # Ignore changes that are made as part of the rel_tag workflow to avoid infinite loop + paths-ignore: + - CHANGELOG.md + # Ignore workflow changes + - '.github/**' + # Ignore changes that are made as part of the rel_tag workflow to avoid infinite loop + tags-ignore: + - '**' + +# cancel running job if another commit comes in +concurrency: + group: pushdev-${{ github.ref }}-1 + cancel-in-progress: true + +jobs: + build_test_release_tag: + uses: ./.github/workflows/build_test_release_tag.yml + secrets: inherit # pass all secrets for pushing + with: + # NOTE: passing in a specific branch means that commits made during the pipeline before the final build is completed will be included + # the default is to always checkout the current commit that runs the pipeline in each job + ref: development diff --git a/.github/workflows/pushmain.yml b/.github/workflows/pushmain.yml new file mode 100644 index 0000000000..cdab10a959 --- /dev/null +++ b/.github/workflows/pushmain.yml @@ -0,0 +1,29 @@ +name: pushmain + +on: + push: + branches: + - main + # Ignore changes that are made as part of the rel_tag workflow to avoid infinite loop + paths-ignore: + - CHANGELOG.md + # Ignore workflow changes + - '.github/**' + # Ignore changes that are made as part of the rel_tag workflow to avoid infinite loop + tags-ignore: + - '**' + +# cancel running job if another commit comes in +concurrency: + group: pushmain-${{ github.ref }}-1 + cancel-in-progress: true + +jobs: + build_test_release_tag: + uses: ./.github/workflows/build_test_release_tag.yml + secrets: inherit # pass all secrets for pushing + with: + # NOTE: passing in a specific branch means that commits made during the pipeline before the final build is completed will be included + # the default is to always checkout the current commit that runs the pipeline in each job + ref: main + diff --git a/.github/workflows/qa.yml b/.github/workflows/qa.yml deleted file mode 100644 index aca7892e41..0000000000 --- a/.github/workflows/qa.yml +++ /dev/null @@ -1,18 +0,0 @@ -on: - push: - branches: - - main - - development - pull_request: -name: Build QA ๐Ÿ› ๏ธ - -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v2 - with: - node-version: 'v16.13.2' - - run: yarn - - run: yarn build:qa diff --git a/.github/workflows/rel_tag.yml b/.github/workflows/rel_tag.yml new file mode 100644 index 0000000000..6fb07a9ac4 --- /dev/null +++ b/.github/workflows/rel_tag.yml @@ -0,0 +1,91 @@ +name: rel_tag + +permissions: + checks: write + contents: write # needed to create a gh release and tag repo + issues: read + pull-requests: write + +on: + workflow_call: + inputs: + version_tag: + description: 'version tag to use' + required: false + default: "latest" + type: string + bump: + description: 'whether to bump the version number by a major minor patch amount or try gitlog' + required: false + default: "patch" + type: string + ref: + description: 'git reference to use with the checkout use default_branch to have that calculated' + required: false + default: "default" + type: string + + workflow_dispatch: + inputs: + version_tag: + description: 'Version tag to use: (bump must also be set to none to keep a specific version' + required: false + default: 'latest' + type: string + bump: + description: | + How to optionally bump the semver version ( Major.Minor.Patch ) : git log will be searched for + '#major #minor #patch' or feat/ or fix/ branch names to optionally override the bump. Set to none to keep a specific version + required: false + options: + - patch + - minor + - major + - none + type: choice + ref: + description: 'git reference to use with the checkout use default_branch to have that calculated' + required: false + default: "default" + type: string + + + + +jobs: + rel_tag: + runs-on: ubuntu-latest + steps: + - name: git-checkout-ref-action + id: ref + uses: ORCID/git-checkout-ref-action@main + with: + default_branch: ${{ github.event.repository.default_branch }} + ref: ${{ inputs.ref }} + + + - uses: actions/checkout@v3 + with: + # token with write permissions to protected branches + # standard github token does not allow this + token: ${{ secrets.RELEASE_TOKEN }} + ref: ${{ steps.ref.outputs.ref }} + # checkout some history so we can build a changelog and release + # NOTE: history does not include tags! + fetch-depth: 100 + + - name: find next version + id: version + uses: ORCID/version-bump-action@main + with: + version_tag: ${{ inputs.version_tag }} + bump: ${{ inputs.bump }} + + - name: tag repo create changelog and create release + uses: ORCID/changelog-action@main + with: + version_tag: ${{ steps.version.outputs.version_tag }} + slack_channel: tech-release + github_write_token: ${{ secrets.RELEASE_TOKEN }} + slacktee_token: ${{ secrets.SLACKTEE_TOKEN }} + diff --git a/.github/workflows/sandbox.yml b/.github/workflows/sandbox.yml deleted file mode 100644 index f8f868de4e..0000000000 --- a/.github/workflows/sandbox.yml +++ /dev/null @@ -1,18 +0,0 @@ -on: - push: - branches: - - main - - development - pull_request: -name: Build Sandbox ๐Ÿ› ๏ธ - -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v2 - with: - node-version: 'v16.13.2' - - run: yarn - - run: yarn build:sandbox diff --git a/.github/workflows/storybook.yml b/.github/workflows/storybook.yml deleted file mode 100644 index bf81508a68..0000000000 --- a/.github/workflows/storybook.yml +++ /dev/null @@ -1,34 +0,0 @@ -# on: [push, pull_request] -# name: Storybook ๐Ÿ“š -# jobs: -# storybook: -# runs-on: ubuntu-latest -# strategy: -# matrix: -# node-version: [v16.13.2] - -# steps: -# - uses: actions/checkout@v1 - -# - name: Cache node modules -# uses: actions/cache@v1 -# with: -# path: ~/.npm -# key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} -# restore-keys: | -# ${{ runner.os }}-node- -# - name: Setup -# uses: actions/setup-node@v1 -# with: -# node-version: ${{ matrix.node-version }} -# - name: npm install and npm run build -# run: | -# npm i -# npm run build:storybook -# - name: Deploy ๐Ÿš€ -# if: github.event_name == 'push' && (contains(github.ref, 'tags') || github.ref == 'refs/heads/master') -# uses: JamesIves/github-pages-deploy-action@3.5.9 -# with: -# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} -# BRANCH: gh-pages -# FOLDER: dist/storybook diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml deleted file mode 100644 index f0a6f381c0..0000000000 --- a/.github/workflows/tests.yml +++ /dev/null @@ -1,17 +0,0 @@ -on: - push: - branches: - - development - pull_request: -name: Unit Tests ๐Ÿงช - -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v2 - with: - node-version: 'v16.13.2' - - run: yarn - - run: yarn test-headless diff --git a/.github/workflows/unit_tests.yml b/.github/workflows/unit_tests.yml new file mode 100644 index 0000000000..ce900cc4ff --- /dev/null +++ b/.github/workflows/unit_tests.yml @@ -0,0 +1,17 @@ +on: + workflow_call: + workflow_dispatch: + +name: unit_tests + +jobs: + unit_tests: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 'v16.13.2' + cache: 'yarn' + - run: yarn + - run: yarn test-headless