first commit
Some checks failed
Internal - Main - Continuous Integration / ci (push) Has been cancelled
Internal - Main - Continuous Integration / release (push) Has been cancelled
Need fix to Issue / main (push) Has been cancelled

This commit is contained in:
2025-08-03 01:13:37 +07:00
commit 70d1c8d63e
68 changed files with 120376 additions and 0 deletions

274
.github/workflows/__check-action.yml vendored Normal file
View File

@@ -0,0 +1,274 @@
name: Internal - Tests for action
on:
workflow_call:
permissions:
contents: read
jobs:
test-action-with-services:
runs-on: ubuntu-latest
name: Test with services
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Act
uses: ./
with:
compose-file: "./test/docker-compose.yml"
services: |
service-b
service-c
- name: "Assert: only expected services are running"
run: |
docker compose -f ./test/docker-compose.yml ps
docker compose -f ./test/docker-compose.yml ps | grep test-service-b-1 || (echo "Service service-b is not running" && exit 1)
docker compose -f ./test/docker-compose.yml ps | grep test-service-c-1 || (echo "Service service-c is not running" && exit 1)
(docker compose -f ./test/docker-compose.yml ps | grep test-service-a-1 && echo "Unexpected service service-a is running" && exit 1) || true
test-action-with-down-flags:
runs-on: ubuntu-latest
name: Test compose action
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Act
uses: ./
with:
compose-file: "./test/docker-compose.yml"
down-flags: "--volumes"
test-action-with-compose-flags:
runs-on: ubuntu-latest
name: Test with compose flags
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Act
uses: ./
with:
compose-file: "./test/docker-compose.yml"
compose-flags: "--profile profile-1"
down-flags: "--volumes"
- name: "Assert: profile is used"
run: |
docker compose -f ./test/docker-compose.yml -p profile-1 ps || (echo "Profile not used" && exit 1)
test-action-with-env:
runs-on: ubuntu-latest
name: Test with env
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Act
uses: ./
with:
compose-file: "./test/docker-compose-with-env.yml"
env:
IMAGE_NAME: busybox
- name: "Assert: env is used"
env:
IMAGE_NAME: busybox
run: |
docker compose -f ./test/docker-compose-with-env.yml ps
docker compose -f ./test/docker-compose-with-env.yml ps | grep test-service-a-1 || (echo "Service service-a is not running" && exit 1)
test-action-with-multiple-compose-files:
runs-on: ubuntu-latest
name: Test with multiple compose files
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Act
uses: ./
with:
compose-file: |
./test/docker-compose.yml
./test/docker-compose.ci.yml
services: |
service-b
service-d
- name: "Assert: only expected services are running"
run: |
docker compose -f ./test/docker-compose.yml -f ./test/docker-compose.ci.yml ps
docker compose -f ./test/docker-compose.yml -f ./test/docker-compose.ci.yml ps | grep test-service-b-1 || (echo "Service service-b is not running" && exit 1)
docker compose -f ./test/docker-compose.yml -f ./test/docker-compose.ci.yml ps | grep test-service-d-1 || (echo "Service service-d is not running" && exit 1)
(docker compose -f ./test/docker-compose.yml -f ./test/docker-compose.ci.yml ps | grep test-service-a-1 && echo "Unexpected service service-a is running" && exit 1) || true
(docker compose -f ./test/docker-compose.yml -f ./test/docker-compose.ci.yml ps | grep test-service-c-1 && echo "Unexpected service service-c is running" && exit 1) || true
test-action-with-cwd:
runs-on: ubuntu-latest
name: Test with cwd
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Act
uses: ./
with:
compose-file: "docker-compose.yml"
cwd: "./test"
services: |
service-b
service-c
- name: "Assert: only expected services are running"
run: |
docker compose -f ./test/docker-compose.yml ps
docker compose -f ./test/docker-compose.yml ps | grep test-service-b-1 || (echo "Service service-b is not running" && exit 1)
docker compose -f ./test/docker-compose.yml ps | grep test-service-c-1 || (echo "Service service-c is not running" && exit 1)
(docker compose -f ./test/docker-compose.yml ps | grep test-service-a-1 && echo "Unexpected service service-a is running" && exit 1) || true
test-action-with-absolute-path:
runs-on: ubuntu-latest
name: Test with absolute path
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Act
uses: ./
with:
compose-file: "${{ github.workspace }}/test/docker-compose.yml"
services: |
service-b
service-c
- name: "Assert: only expected services are running"
run: |
docker compose -f ./test/docker-compose.yml ps
docker compose -f ./test/docker-compose.yml ps | grep test-service-b-1 || (echo "Service service-b is not running" && exit 1)
docker compose -f ./test/docker-compose.yml ps | grep test-service-c-1 || (echo "Service service-c is not running" && exit 1)
(docker compose -f ./test/docker-compose.yml ps | grep test-service-a-1 && echo "Unexpected service service-a is running" && exit 1) || true
test-abort-on-container-exit:
runs-on: ubuntu-latest
name: Test with --abort-on-container-exit
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Act
uses: ./
with:
compose-file: "test/docker-compose-web-mysql.yml"
up-flags: "--build --abort-on-container-exit --exit-code-from=web"
test-attach-dependencies-failure:
runs-on: ubuntu-latest
name: Test with --attach-dependencies and service failure
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Act
uses: ./
with:
compose-file: "test/docker-compose-fail.yml"
up-flags: "--attach-dependencies"
- name: Assert
run: |
EXIT_CODE=$(docker compose -f ./test/docker-compose-fail.yml ps service-a --all --format json | jq ".ExitCode")
[ "$EXIT_CODE" == "1" ] || (echo "Service service-a did not exit with code 1" && exit 1)
test-action-with-compose-version:
runs-on: ubuntu-latest
name: Test with compose version
env:
DOCKER_COMPOSE_VERSION: "2.29.0"
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: "Arrange: ensure original docker compose version is not the expected one"
run: |
CURRENT_DOCKER_COMPOSE_VERSION=$(docker compose version --short)
echo "Current docker compose version: $CURRENT_DOCKER_COMPOSE_VERSION"
if [ "$CURRENT_DOCKER_COMPOSE_VERSION" == "$DOCKER_COMPOSE_VERSION" ]; then
echo "Docker compose version is already in $DOCKER_COMPOSE_VERSION version"
exit 1
fi
- name: Act
uses: ./
with:
compose-file: "./test/docker-compose.yml"
compose-version: "2.29.0"
- name: "Assert: compose version is used"
run: |
CURRENT_DOCKER_COMPOSE_VERSION=$(docker compose version --short)
echo "Current docker compose version: $CURRENT_DOCKER_COMPOSE_VERSION"
if [ "$CURRENT_DOCKER_COMPOSE_VERSION" != "$DOCKER_COMPOSE_VERSION" ]; then
echo "Docker compose version is not in $DOCKER_COMPOSE_VERSION version"
exit 1
fi
test-action-with-compose-version-latest:
runs-on: ubuntu-latest
name: Test with compose version latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: "Arrange: retrieve latest version of docker compose"
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
with:
script: |
const dockerComposeVersion = (await github.rest.repos.getLatestRelease({
owner: "docker",
repo: "compose",
})).data.tag_name.replace("v", "");
core.exportVariable('DOCKER_COMPOSE_VERSION', dockerComposeVersion);
- name: "Arrange: ensure original docker compose version is not the expected one"
run: |
CURRENT_DOCKER_COMPOSE_VERSION=$(docker compose version --short)
echo "Current docker compose version: $CURRENT_DOCKER_COMPOSE_VERSION"
if [ "$CURRENT_DOCKER_COMPOSE_VERSION" == "$DOCKER_COMPOSE_VERSION" ]; then
echo "Docker compose version is already in $DOCKER_COMPOSE_VERSION version"
exit 1
fi
- name: Act
uses: ./
with:
compose-file: "./test/docker-compose.yml"
compose-version: "latest"
- name: "Assert: compose version is used"
run: |
CURRENT_DOCKER_COMPOSE_VERSION=$(docker compose version --short)
echo "Current docker compose version: $CURRENT_DOCKER_COMPOSE_VERSION"
if [ "$CURRENT_DOCKER_COMPOSE_VERSION" != "$DOCKER_COMPOSE_VERSION" ]; then
echo "Docker compose version is not in $DOCKER_COMPOSE_VERSION version"
exit 1
fi
test-action-with-docker-context:
runs-on: ubuntu-latest
name: Test with docker context
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Set up Docker
uses: docker/setup-docker-action@b60f85385d03ac8acfca6d9996982511d8620a19 # v4.3.0
with:
context: test-context
- name: Act
uses: ./
with:
docker-flags: "--context test-context"
compose-file: "./test/docker-compose.yml"
compose-version: "latest"

39
.github/workflows/__check-dist.yml vendored Normal file
View File

@@ -0,0 +1,39 @@
name: Internal - Checks for dist
on:
workflow_call:
permissions:
contents: read
jobs:
check-dist:
name: Check dist
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: hoverkraft-tech/ci-github-nodejs/actions/setup-node@77c905a25700b1ca630037812b5df42d2d7c40ae # 0.12.0
- name: Build dist/ Directory
id: package
run: npm run package
# This will fail the workflow if the PR wasn't created by Dependabot.
- name: Compare Directories
id: diff
run: |
if [ "$(git diff --ignore-space-at-eol --text dist/ | wc -l)" -gt "0" ]; then
echo "Detected uncommitted changes after package. See status below:"
git diff --ignore-space-at-eol --text dist/
exit 1
fi
# If `dist/` was different than expected, and this was not a Dependabot
# PR, upload the expected version as a workflow artifact.
- if: ${{ failure() && steps.diff.outcome == 'failure' }}
name: Upload Artifact
id: upload
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: dist
path: dist/

19
.github/workflows/__check-nodejs.yml vendored Normal file
View File

@@ -0,0 +1,19 @@
name: Internal - Checks for nodejs
on:
workflow_call:
permissions:
contents: read
security-events: write
id-token: write
jobs:
test-nodejs:
uses: hoverkraft-tech/ci-github-nodejs/.github/workflows/continuous-integration.yml@77c905a25700b1ca630037812b5df42d2d7c40ae # 0.12.0
permissions:
id-token: write
security-events: write
contents: read
with:
build: ""

41
.github/workflows/__shared-ci.yml vendored Normal file
View File

@@ -0,0 +1,41 @@
name: Common Continuous Integration tasks
on:
workflow_call:
permissions:
actions: read
contents: read
packages: read
security-events: write
statuses: write
id-token: write
jobs:
linter:
uses: hoverkraft-tech/ci-github-common/.github/workflows/linter.yml@9a3d71ca9f68bc1061db8ea1442084ac31a0f8bf # 0.23.0
with:
linter-env: |
FILTER_REGEX_EXCLUDE=dist/**/*
VALIDATE_JSCPD=false
VALIDATE_TYPESCRIPT_STANDARD=false
VALIDATE_TYPESCRIPT_ES=false
VALIDATE_TYPESCRIPT_PRETTIER=false
VALIDATE_JAVASCRIPT_ES=false
VALIDATE_JAVASCRIPT_STANDARD=false
check-nodejs:
name: Test nodejs
needs: linter
uses: ./.github/workflows/__check-nodejs.yml
secrets: inherit
check-dist:
name: Test nodejs
needs: linter
uses: ./.github/workflows/__check-dist.yml
check-action:
name: Test action
needs: [check-nodejs, check-dist]
uses: ./.github/workflows/__check-action.yml

16
.github/workflows/greetings.yml vendored Normal file
View File

@@ -0,0 +1,16 @@
name: Greetings
on:
issues:
types: [opened]
pull_request_target:
branches: [main]
permissions:
contents: read
issues: write
pull-requests: write
jobs:
greetings:
uses: hoverkraft-tech/ci-github-common/.github/workflows/greetings.yml@9a3d71ca9f68bc1061db8ea1442084ac31a0f8bf # 0.23.0

57
.github/workflows/main-ci.yml vendored Normal file
View File

@@ -0,0 +1,57 @@
name: Internal - Main - Continuous Integration
on:
push:
branches: [main]
tags: ["*"]
workflow_dispatch:
schedule:
- cron: "25 8 * * 1"
permissions:
actions: read
contents: read
packages: read
security-events: write
statuses: write
# FIXME: This is a workaround for having workflow ref. See https://github.com/orgs/community/discussions/38659
id-token: write
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
ci:
uses: ./.github/workflows/__shared-ci.yml
secrets: inherit
release:
needs: ci
if: github.event_name != 'schedule'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: bitflight-devops/github-action-readme-generator@f750ff0ac8a4b68a3c2d622cc50a5ad20bcebaa1 # v1.8.0
with:
owner: ${{ github.repository_owner }}
repo: ${{ github.event.repository.name }}
- uses: actions/create-github-app-token@df432ceedc7162793a195dd1713ff69aefc7379e # v2.0.6
id: generate-token
with:
app-id: ${{ vars.CI_BOT_APP_ID }}
private-key: ${{ secrets.CI_BOT_APP_PRIVATE_KEY }}
- uses: hoverkraft-tech/ci-github-common/actions/create-and-merge-pull-request@9a3d71ca9f68bc1061db8ea1442084ac31a0f8bf # 0.23.0
with:
github-token: ${{ steps.generate-token.outputs.token }}
branch: docs/actions-workflows-documentation-update
title: "docs: update actions and workflows documentation"
body: Update actions and workflows documentation
commit-message: |
docs: update actions and workflows documentation
[skip ci]

27
.github/workflows/need-fix-to-issue.yml vendored Normal file
View File

@@ -0,0 +1,27 @@
name: Need fix to Issue
on:
push:
branches:
- main
workflow_dispatch:
inputs:
#checkov:skip=CKV_GHA_7: required
manual-commit-ref:
description: "The SHA of the commit to get the diff for"
required: true
manual-base-ref:
description: "By default, the commit entered above is compared to the one directly
before it; to go back further, enter an earlier SHA here"
required: false
permissions:
contents: read
issues: write
jobs:
main:
uses: hoverkraft-tech/ci-github-common/.github/workflows/need-fix-to-issue.yml@9a3d71ca9f68bc1061db8ea1442084ac31a0f8bf # 0.23.0
with:
manual-commit-ref: ${{ inputs.manual-commit-ref }}
manual-base-ref: ${{ inputs.manual-base-ref }}

23
.github/workflows/pull-request-ci.yml vendored Normal file
View File

@@ -0,0 +1,23 @@
name: Pull request - Continuous Integration
on:
merge_group:
pull_request:
branches: [main]
permissions:
actions: read
contents: read
packages: read
statuses: write
security-events: write
id-token: write
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
ci:
uses: ./.github/workflows/__shared-ci.yml
secrets: inherit

View File

@@ -0,0 +1,29 @@
name: Release new action version
on:
release:
types: [released]
workflow_dispatch:
inputs:
#checkov:skip=CKV_GHA_7: required
TAG_NAME:
description: "Tag name that the major tag will point to"
required: true
env:
TAG_NAME: ${{ github.event.inputs.TAG_NAME || github.event.release.tag_name }}
permissions:
contents: write
jobs:
update_tag:
name: Update the major tag to include the ${{ github.event.inputs.TAG_NAME || github.event.release.tag_name }} changes
environment:
name: releaseNewActionVersion
runs-on: ubuntu-latest
steps:
- name: Update the ${{ env.TAG_NAME }} tag
uses: actions/publish-action@f784495ce78a41bac4ed7e34a73f0034015764bb # v0.3.0
with:
source-tag: ${{ env.TAG_NAME }}

View File

@@ -0,0 +1,16 @@
name: "Pull Request - Semantic Lint"
on:
pull_request_target:
types:
- opened
- edited
- synchronize
permissions:
contents: write
pull-requests: write
jobs:
main:
uses: hoverkraft-tech/ci-github-common/.github/workflows/semantic-pull-request.yml@9a3d71ca9f68bc1061db8ea1442084ac31a0f8bf # 0.23.0

13
.github/workflows/stale.yml vendored Normal file
View File

@@ -0,0 +1,13 @@
name: Mark stale issues and pull requests
on:
schedule:
- cron: "30 1 * * *"
permissions:
issues: write
pull-requests: write
jobs:
main:
uses: hoverkraft-tech/ci-github-common/.github/workflows/stale.yml@9a3d71ca9f68bc1061db8ea1442084ac31a0f8bf # 0.23.0