Skip to content

Commit

Permalink
ci: rename action to workflow (#1275)
Browse files Browse the repository at this point in the history
<!--- Provide a general summary of your changes in the Title above -->

## Description

<!--- Describe your changes in detail -->

These are reusable *workflows* so it makes sense to call them that
instead of action. Has been done for FE already

## Related Issue(s)

- #{issue number}

## Verification

- [ ] **Your** code builds clean without any errors or warnings
- [ ] Manual testing done (required)
- [ ] Relevant automated test added (if you find this hard, leave it and
we'll help out)

## Documentation

- [ ] Documentation is updated (either in `docs`-directory, Altinnpedia
or a separate linked PR in
[altinn-studio-docs.](https://github.com/Altinn/altinn-studio-docs), if
applicable)


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **New Features**
- Enhanced README with detailed local development, deployment, and
configuration management instructions.
	- Added guidance for functional and non-functional testing using K6.
- Introduced `appsettings.local.json` for local configuration
management.

- **Bug Fixes**
- Improved clarity in local development instructions and database setup.

- **Documentation**
	- Updated GitHub Actions naming conventions for clarity.
	- Expanded sections on SDK updates and SSH access to Azure resources.

- **Chores**
- Renamed action files to workflow files across multiple CI/CD
configurations for consistency.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
  • Loading branch information
arealmaas authored Oct 13, 2024
1 parent cd4473d commit 1a6a07f
Show file tree
Hide file tree
Showing 22 changed files with 51 additions and 51 deletions.
22 changes: 11 additions & 11 deletions .github/workflows/ci-cd-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,25 +27,25 @@ jobs:

generate-git-short-sha:
name: Generate git short sha
uses: ./.github/workflows/action-generate-git-short-sha.yml
uses: ./.github/workflows/workflow-generate-git-short-sha.yml

get-current-version:
name: Get current version
uses: ./.github/workflows/action-get-current-version.yml
uses: ./.github/workflows/workflow-get-current-version.yml

check-for-changes:
name: Check for changes
uses: ./.github/workflows/action-check-for-changes.yml
uses: ./.github/workflows/workflow-check-for-changes.yml

build-and-test:
name: Build and test backend
uses: ./.github/workflows/action-build-and-test.yml
uses: ./.github/workflows/workflow-build-and-test.yml
needs: [check-for-changes]
if: ${{ github.event_name == 'workflow_dispatch' || needs.check-for-changes.outputs.hasBackendChanges == 'true' || needs.check-for-changes.outputs.hasTestChanges == 'true' }}

publish:
name: Build and publish docker images
uses: ./.github/workflows/action-publish.yml
uses: ./.github/workflows/workflow-publish.yml
needs:
[
get-current-version,
Expand All @@ -64,7 +64,7 @@ jobs:
name: Deploy infra to test
needs: [get-current-version, check-for-changes, generate-git-short-sha]
if: ${{ github.event_name == 'workflow_dispatch' || needs.check-for-changes.outputs.hasAzureChanges == 'true' }}
uses: ./.github/workflows/action-deploy-infra.yml
uses: ./.github/workflows/workflow-deploy-infra.yml
secrets:
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
Expand All @@ -90,7 +90,7 @@ jobs:
]
# we want deployment of apps to be dependent on deployment of infrastructure, but if infrastructure is skipped, we still want to deploy the apps
if: ${{ always() && !failure() && !cancelled() && (github.event_name == 'workflow_dispatch' || needs.check-for-changes.outputs.hasBackendChanges == 'true') }}
uses: ./.github/workflows/action-deploy-apps.yml
uses: ./.github/workflows/workflow-deploy-apps.yml
secrets:
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
Expand All @@ -111,7 +111,7 @@ jobs:
name: Deploy slack notifier (test)
needs: [check-for-changes]
if: ${{ github.event_name == 'workflow_dispatch' || needs.check-for-changes.outputs.hasSlackNotifierChanges == 'true' }}
uses: ./.github/workflows/action-deploy-function.yml
uses: ./.github/workflows/workflow-deploy-function.yml
secrets:
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
Expand All @@ -127,7 +127,7 @@ jobs:
name: Deploy schema npm package
needs: [check-for-changes, get-current-version, generate-git-short-sha]
if: ${{ github.event_name == 'workflow_dispatch' || needs.check-for-changes.outputs.hasSchemaChanges == 'true' }}
uses: ./.github/workflows/action-publish-schema.yml
uses: ./.github/workflows/workflow-publish-schema.yml
with:
version: ${{ needs.get-current-version.outputs.version }}-${{ needs.generate-git-short-sha.outputs.gitShortSha }}
secrets:
Expand All @@ -138,7 +138,7 @@ jobs:
# we want the end-to-end tests to be dependent on deployment of infrastructure and apps, but if infrastructure is skipped, we still want to run the tests
if: ${{ always() && !failure() && !cancelled() && (github.event_name == 'workflow_dispatch' || needs.check-for-changes.outputs.hasBackendChanges == 'true' || needs.check-for-changes.outputs.hasTestChanges == 'true') }}
needs: [deploy-apps-test, check-for-changes]
uses: ./.github/workflows/action-run-k6-tests.yml
uses: ./.github/workflows/workflow-run-k6-tests.yml
secrets:
TOKEN_GENERATOR_USERNAME: ${{ secrets.TOKEN_GENERATOR_USERNAME }}
TOKEN_GENERATOR_PASSWORD: ${{ secrets.TOKEN_GENERATOR_PASSWORD }}
Expand All @@ -154,7 +154,7 @@ jobs:
name: Send Slack message on failure
needs: [deploy-infra-test, deploy-apps-test, deploy-slack-notifier-test, run-e2e-tests, publish-schema-npm, publish]
if: ${{ always() && failure() && !cancelled() }}
uses: ./.github/workflows/action-send-ci-cd-status-slack-message.yml
uses: ./.github/workflows/workflow-send-ci-cd-status-slack-message.yml
with:
environment: test
infra_status: ${{ needs.deploy-infra-test.result }}
Expand Down
18 changes: 9 additions & 9 deletions .github/workflows/ci-cd-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,17 @@ jobs:
# Get changed files between previous tag and current tag: https://github.com/marketplace/actions/changed-files
check-for-changes:
name: Check for changes
uses: ./.github/workflows/action-check-for-changes.yml
uses: ./.github/workflows/workflow-check-for-changes.yml

get-current-version:
name: Get current version
uses: ./.github/workflows/action-get-current-version.yml
uses: ./.github/workflows/workflow-get-current-version.yml

dry-run-deploy-infra-prod:
name: Dry run deploy infra to prod
if: ${{ github.event_name == 'workflow_dispatch' || needs.check-for-changes.outputs.hasAzureChanges == 'true' }}
needs: [get-current-version, check-for-changes]
uses: ./.github/workflows/action-deploy-infra.yml
uses: ./.github/workflows/workflow-deploy-infra.yml
secrets:
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
Expand All @@ -42,7 +42,7 @@ jobs:
name: Deploy infra to prod
if: ${{ github.event_name == 'workflow_dispatch' || needs.check-for-changes.outputs.hasAzureChanges == 'true' }}
needs: [get-current-version, check-for-changes, dry-run-deploy-infra-prod]
uses: ./.github/workflows/action-deploy-infra.yml
uses: ./.github/workflows/workflow-deploy-infra.yml
secrets:
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
Expand All @@ -62,7 +62,7 @@ jobs:
[get-current-version, check-for-changes, deploy-infra-prod]
# we want deployment of apps to be dependent on deployment of infrastructure, but if infrastructure is skipped, we still want to dry-run deploy the apps
if: ${{ always() && !failure() && !cancelled() && (github.event_name == 'workflow_dispatch' || needs.check-for-changes.outputs.hasBackendChanges == 'true') }}
uses: ./.github/workflows/action-deploy-apps.yml
uses: ./.github/workflows/workflow-deploy-apps.yml
secrets:
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
Expand All @@ -85,7 +85,7 @@ jobs:
needs:
[get-current-version, check-for-changes, dry-run-deploy-apps-prod]
if: ${{ github.event_name == 'workflow_dispatch' || needs.check-for-changes.outputs.hasBackendChanges == 'true' }}
uses: ./.github/workflows/action-deploy-apps.yml
uses: ./.github/workflows/workflow-deploy-apps.yml
secrets:
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
Expand All @@ -106,7 +106,7 @@ jobs:
name: Deploy slack notifier (prod)
needs: [check-for-changes]
if: ${{ github.event_name == 'workflow_dispatch' || needs.check-for-changes.outputs.hasSlackNotifierChanges == 'true' }}
uses: ./.github/workflows/action-deploy-function.yml
uses: ./.github/workflows/workflow-deploy-function.yml
secrets:
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
Expand All @@ -123,7 +123,7 @@ jobs:
# # we want the end-to-end tests to be dependent on deployment of infrastructure and apps, but if infrastructure is skipped, we still want to run the tests
# if: ${{ always() && !failure() && !cancelled() && (github.event_name == 'workflow_dispatch' || needs.check-for-changes.outputs.hasBackendChanges == 'true') }}
# needs: [deploy-apps-prod, check-for-changes]
# uses: ./.github/workflows/action-run-k6-tests.yml
# uses: ./.github/workflows/workflow-run-k6-tests.yml
# secrets:
# TOKEN_GENERATOR_USERNAME: ${{ secrets.TOKEN_GENERATOR_USERNAME }}
# TOKEN_GENERATOR_PASSWORD: ${{ secrets.TOKEN_GENERATOR_PASSWORD }}
Expand All @@ -139,7 +139,7 @@ jobs:
name: Send Slack message on failure
needs: [deploy-infra-prod, deploy-apps-prod, deploy-slack-notifier-prod]
if: ${{ always() && failure() && !cancelled() }}
uses: ./.github/workflows/action-send-ci-cd-status-slack-message.yml
uses: ./.github/workflows/workflow-send-ci-cd-status-slack-message.yml
with:
environment: prod
infra_status: ${{ needs.deploy-infra-prod.result }}
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/ci-cd-pull-request-release-please.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,21 @@ jobs:

get-current-version:
name: Get current version
uses: ./.github/workflows/action-get-current-version.yml
uses: ./.github/workflows/workflow-get-current-version.yml

check-for-changes:
name: Check for changes
uses: ./.github/workflows/action-check-for-changes.yml
uses: ./.github/workflows/workflow-check-for-changes.yml

generate-git-short-sha:
name: Generate git short sha
needs: [verify-release-please-branch]
uses: ./.github/workflows/action-generate-git-short-sha.yml
uses: ./.github/workflows/workflow-generate-git-short-sha.yml

dry-run-deploy-infra-staging:
name: Deploy infra to staging (dry run)
needs: [generate-git-short-sha, get-current-version, check-for-changes]
uses: ./.github/workflows/action-deploy-infra.yml
uses: ./.github/workflows/workflow-deploy-infra.yml
secrets:
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
Expand All @@ -47,7 +47,7 @@ jobs:
dry-run-deploy-apps-staging:
name: Deploy apps to staging (dry run)
needs: [generate-git-short-sha, get-current-version, check-for-changes]
uses: ./.github/workflows/action-deploy-apps.yml
uses: ./.github/workflows/workflow-deploy-apps.yml
secrets:
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/ci-cd-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,23 @@ on:
jobs:
generate-git-short-sha:
name: Generate git short sha
uses: ./.github/workflows/action-generate-git-short-sha.yml
uses: ./.github/workflows/workflow-generate-git-short-sha.yml

get-current-version:
name: Get current version
uses: ./.github/workflows/action-get-current-version.yml
uses: ./.github/workflows/workflow-get-current-version.yml

check-for-changes:
name: Check for changes
uses: ./.github/workflows/action-check-for-changes.yml
uses: ./.github/workflows/workflow-check-for-changes.yml

build:
uses: ./.github/workflows/action-build-and-test.yml
uses: ./.github/workflows/workflow-build-and-test.yml
needs: [check-for-changes]
if: ${{ needs.check-for-changes.outputs.hasBackendChanges == 'true' || needs.check-for-changes.outputs.hasTestChanges == 'true' }}

build-infrastructure:
uses: ./.github/workflows/action-build-infrastructure.yml
uses: ./.github/workflows/workflow-build-infrastructure.yml
needs: [check-for-changes]
if: ${{ always() && needs.check-for-changes.outputs.hasAzureChanges == 'true' }}
secrets:
Expand All @@ -38,7 +38,7 @@ jobs:

dry-run-deploy-infra:
name: Dry run deploy infrastructure
uses: ./.github/workflows/action-deploy-infra.yml
uses: ./.github/workflows/workflow-deploy-infra.yml
needs:
[
generate-git-short-sha,
Expand Down Expand Up @@ -72,7 +72,7 @@ jobs:
]
# we want deployment of apps to be dependent on deployment of infrastructure, but if infrastructure is skipped, we still want to deploy the apps
if: ${{ always() && !failure() && !cancelled() && (needs.check-for-changes.outputs.hasBackendChanges == 'true' || needs.check-for-changes.outputs.hasMigrationChanges == 'true') }}
uses: ./.github/workflows/action-deploy-apps.yml
uses: ./.github/workflows/workflow-deploy-apps.yml
secrets:
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
Expand All @@ -91,7 +91,7 @@ jobs:

delete-github-deployments:
name: Delete GitHub deployments
uses: ./.github/workflows/action-delete-deployments.yml
uses: ./.github/workflows/workflow-delete-deployments.yml
needs: [dry-run-deploy-apps, dry-run-deploy-infra]
if: ${{ always() && !failure() && !cancelled() }}
with:
Expand Down
18 changes: 9 additions & 9 deletions .github/workflows/ci-cd-staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ jobs:
# Get changed files between previous tag and current tag: https://github.com/marketplace/actions/changed-files
check-for-changes:
name: Check for changes
uses: ./.github/workflows/action-check-for-changes.yml
uses: ./.github/workflows/workflow-check-for-changes.yml

get-current-version:
name: Get current version
uses: ./.github/workflows/action-get-current-version.yml
uses: ./.github/workflows/workflow-get-current-version.yml

publish:
name: Build and publish docker images
uses: ./.github/workflows/action-publish.yml
uses: ./.github/workflows/workflow-publish.yml
if: ${{ github.event_name == 'workflow_dispatch' || needs.check-for-changes.outputs.hasBackendChanges == 'true' }}
needs: [get-current-version, check-for-changes]
secrets:
Expand All @@ -34,7 +34,7 @@ jobs:
name: Deploy infra to staging
if: ${{ github.event_name == 'workflow_dispatch' || needs.check-for-changes.outputs.hasAzureChanges == 'true' }}
needs: [get-current-version, check-for-changes]
uses: ./.github/workflows/action-deploy-infra.yml
uses: ./.github/workflows/workflow-deploy-infra.yml
secrets:
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
Expand All @@ -54,7 +54,7 @@ jobs:
[get-current-version, check-for-changes, deploy-infra-staging, publish]
# we want deployment of apps to be dependent on deployment of infrastructure, but if infrastructure is skipped, we still want to deploy the apps
if: ${{ always() && !failure() && !cancelled() && (github.event_name == 'workflow_dispatch' || needs.check-for-changes.outputs.hasBackendChanges == 'true') }}
uses: ./.github/workflows/action-deploy-apps.yml
uses: ./.github/workflows/workflow-deploy-apps.yml
secrets:
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
Expand All @@ -75,7 +75,7 @@ jobs:
name: Deploy slack notifier (staging)
needs: [check-for-changes]
if: ${{ github.event_name == 'workflow_dispatch' || needs.check-for-changes.outputs.hasSlackNotifierChanges == 'true' }}
uses: ./.github/workflows/action-deploy-function.yml
uses: ./.github/workflows/workflow-deploy-function.yml
secrets:
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
Expand All @@ -91,7 +91,7 @@ jobs:
name: Publish schema npm package
needs: [check-for-changes, get-current-version]
if: ${{ github.event_name == 'workflow_dispatch' || needs.check-for-changes.outputs.hasSchemaChanges == 'true' }}
uses: ./.github/workflows/action-publish-schema.yml
uses: ./.github/workflows/workflow-publish-schema.yml
with:
version: ${{ needs.get-current-version.outputs.version }}
secrets:
Expand All @@ -102,7 +102,7 @@ jobs:
# we want the end-to-end tests to be dependent on deployment of infrastructure and apps, but if infrastructure is skipped, we still want to run the tests
if: ${{ always() && !failure() && !cancelled() && (github.event_name == 'workflow_dispatch' || needs.check-for-changes.outputs.hasBackendChanges == 'true') }}
needs: [deploy-apps-staging, check-for-changes]
uses: ./.github/workflows/action-run-k6-tests.yml
uses: ./.github/workflows/workflow-run-k6-tests.yml
secrets:
TOKEN_GENERATOR_USERNAME: ${{ secrets.TOKEN_GENERATOR_USERNAME }}
TOKEN_GENERATOR_PASSWORD: ${{ secrets.TOKEN_GENERATOR_PASSWORD }}
Expand All @@ -118,7 +118,7 @@ jobs:
name: Send Slack message on failure
needs: [deploy-infra-staging, deploy-apps-staging, deploy-slack-notifier-staging, run-e2e-tests, publish-schema-npm, publish]
if: ${{ always() && failure() && !cancelled() }}
uses: ./.github/workflows/action-send-ci-cd-status-slack-message.yml
uses: ./.github/workflows/workflow-send-ci-cd-status-slack-message.yml
with:
environment: staging
infra_status: ${{ needs.deploy-infra-staging.result }}
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/dispatch-apps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,23 +28,23 @@ concurrency:
jobs:
generate-git-short-sha:
name: Generate git short sha
uses: ./.github/workflows/action-generate-git-short-sha.yml
uses: ./.github/workflows/workflow-generate-git-short-sha.yml

get-current-version:
name: Get current version
uses: ./.github/workflows/action-get-current-version.yml
uses: ./.github/workflows/workflow-get-current-version.yml

check-for-changes:
name: Check for changes
uses: ./.github/workflows/action-check-for-changes.yml
uses: ./.github/workflows/workflow-check-for-changes.yml

deploy-apps:
name: Deploy apps to ${{ inputs.environment }}
needs:
- generate-git-short-sha
- get-current-version
- check-for-changes
uses: ./.github/workflows/action-deploy-apps.yml
uses: ./.github/workflows/workflow-deploy-apps.yml
secrets:
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/dispatch-infrastructure.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ concurrency:
jobs:
generate-git-short-sha:
name: Generate git short sha
uses: ./.github/workflows/action-generate-git-short-sha.yml
uses: ./.github/workflows/workflow-generate-git-short-sha.yml

deploy-infra:
name: Deploy infra to ${{ inputs.environment }}
needs: [generate-git-short-sha]
uses: ./.github/workflows/action-deploy-infra.yml
uses: ./.github/workflows/workflow-deploy-infra.yml
secrets:
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/dispatch-k6-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ on:
jobs:
k6-test:
name: "Run K6 tests"
uses: ./.github/workflows/action-run-k6-tests.yml
uses: ./.github/workflows/workflow-run-k6-tests.yml
secrets:
TOKEN_GENERATOR_USERNAME: ${{ secrets.TOKEN_GENERATOR_USERNAME }}
TOKEN_GENERATOR_PASSWORD: ${{ secrets.TOKEN_GENERATOR_PASSWORD }}
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -271,11 +271,11 @@ This workflow facilitates the deployment of infrastructure to the specified envi
### GitHub Actions

Naming conventions for GitHub Actions:
- `action-*.yml`: Reusable workflows
- `workflow-*.yml`: Reusable workflows
- `ci-cd-*.yml`: Workflows that are triggered by an event
- `dispatch-*.yml`: Workflows that are dispatchable

The `action-check-for-changes.yml` workflow uses the `tj-actions/changed-files` action to check which files have been altered since last commit or tag. We use this filter to ensure we only deploy backend code or infrastructure if the respective files have been altered.
The `workflow-check-for-changes.yml` workflow uses the `tj-actions/changed-files` action to check which files have been altered since last commit or tag. We use this filter to ensure we only deploy backend code or infrastructure if the respective files have been altered.

### Infrastructure

Expand Down

0 comments on commit 1a6a07f

Please sign in to comment.