Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/__greetings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ permissions: {}

jobs:
greetings:
uses: hoverkraft-tech/ci-github-common/.github/workflows/greetings.yml@4bfbc05c189f1177cf7d47d3060cd1cbddf04ce2 # 0.32.0
uses: hoverkraft-tech/ci-github-common/.github/workflows/greetings.yml@f5847cb398fe65d53794e6aba98ebdfa0801f691 # 0.32.0
permissions:
contents: read
issues: write
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/__need-fix-to-issue.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ permissions: {}

jobs:
main:
uses: hoverkraft-tech/ci-github-common/.github/workflows/need-fix-to-issue.yml@4bfbc05c189f1177cf7d47d3060cd1cbddf04ce2 # 0.32.0
uses: hoverkraft-tech/ci-github-common/.github/workflows/need-fix-to-issue.yml@f5847cb398fe65d53794e6aba98ebdfa0801f691 # 0.32.0
permissions:
contents: read
issues: write
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/__semantic-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ permissions: {}

jobs:
main:
uses: hoverkraft-tech/ci-github-common/.github/workflows/semantic-pull-request.yml@4bfbc05c189f1177cf7d47d3060cd1cbddf04ce2 # 0.32.0
uses: hoverkraft-tech/ci-github-common/.github/workflows/semantic-pull-request.yml@f5847cb398fe65d53794e6aba98ebdfa0801f691 # 0.32.0
permissions:
contents: write
pull-requests: write
9 changes: 8 additions & 1 deletion .github/workflows/__shared-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ permissions: {}

jobs:
linter:
uses: hoverkraft-tech/ci-github-common/.github/workflows/linter.yml@4bfbc05c189f1177cf7d47d3060cd1cbddf04ce2 # 0.32.0
uses: hoverkraft-tech/ci-github-common/.github/workflows/linter.yml@f5847cb398fe65d53794e6aba98ebdfa0801f691 # 0.32.0
permissions:
contents: read
statuses: write
Expand Down Expand Up @@ -35,6 +35,13 @@ jobs:
permissions:
contents: read

test-action-package:
name: Test action "package"
needs: linter
uses: ./.github/workflows/__test-action-package.yml
permissions:
contents: read

test-action-setup-node:
name: Test action "setup-node"
needs: linter
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/__stale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ permissions: {}

jobs:
main:
uses: hoverkraft-tech/ci-github-common/.github/workflows/stale.yml@4bfbc05c189f1177cf7d47d3060cd1cbddf04ce2 # 0.32.0
uses: hoverkraft-tech/ci-github-common/.github/workflows/stale.yml@f5847cb398fe65d53794e6aba98ebdfa0801f691 # 0.32.0
permissions:
issues: write
pull-requests: write
49 changes: 49 additions & 0 deletions .github/workflows/__test-action-package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Internal - Tests for "package" action

on:
workflow_call:

permissions: {}

jobs:
test:
name: Test "package" (${{ matrix.working-directory }})
runs-on: ubuntu-latest
permissions:
contents: read
strategy:
matrix:
include:
- working-directory: tests/npm
artifact-suffix: npm
- working-directory: tests/pnpm
artifact-suffix: pnpm
- working-directory: tests/pnpm-package-manager
artifact-suffix: pnpm-package-manager
- working-directory: tests/yarn
artifact-suffix: yarn
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

- id: package
uses: ./actions/package
with:
working-directory: ${{ matrix.working-directory }}
artifact-name: package-tarball-${{ matrix.artifact-suffix }}

- name: Check "package" outputs
run: |
if [ -z "${{ steps.package.outputs.package-tarball-path }}" ]; then
echo "package-tarball-path output is empty"
exit 1
fi

if [ ! -f "${{ steps.package.outputs.package-tarball-path }}" ]; then
echo "Generated package tarball does not exist"
exit 1
fi

if [ -z "${{ steps.package.outputs.package-tarball-artifact-id }}" ]; then
echo "package-tarball-artifact-id output is empty"
exit 1
fi
50 changes: 17 additions & 33 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ jobs:
security-events: write
runs-on: *ci-runner
steps:
- uses: hoverkraft-tech/ci-github-common/actions/checkout@4bfbc05c189f1177cf7d47d3060cd1cbddf04ce2 # 0.32.0
- uses: hoverkraft-tech/ci-github-common/actions/checkout@f5847cb398fe65d53794e6aba98ebdfa0801f691 # 0.32.0
- uses: github/codeql-action/init@9e907b5e64f6b83e7804b09294d44122997950d6 # v4.32.3
with:
languages: ${{ inputs.code-ql }}
Expand All @@ -306,7 +306,7 @@ jobs:
contents: read
runs-on: *ci-runner
steps:
- uses: hoverkraft-tech/ci-github-common/actions/checkout@4bfbc05c189f1177cf7d47d3060cd1cbddf04ce2 # 0.32.0
- uses: hoverkraft-tech/ci-github-common/actions/checkout@f5847cb398fe65d53794e6aba98ebdfa0801f691 # 0.32.0
- uses: actions/dependency-review-action@3c4e3dcb1aa7874d2c16be7d79418e9b7efd6261 # v4.8.2

setup:
Expand All @@ -327,42 +327,26 @@ jobs:
volumes: ${{ fromJSON(needs.prepare.outputs.container-volumes || '[]') }}
credentials: ${{ fromJSON(needs.prepare.outputs.container-username && format('{{"username":{0},"password":{1}}}',toJSON(needs.prepare.outputs.container-username),toJSON(secrets.container-password)) || '{}') }}
outputs:
working-directory: ${{ steps.working-directory.outputs.working-directory }}
working-directory: ${{ steps.working-directory.outputs.absolute-path }}
build-env: ${{ steps.build-variables.outputs.env }}
build-commands: ${{ steps.build-variables.outputs.commands }}
build-artifact: ${{ steps.build-variables.outputs.artifact }}
steps:
- name: Checkout repository
if: inputs.container == ''
uses: hoverkraft-tech/ci-github-common/actions/checkout@4bfbc05c189f1177cf7d47d3060cd1cbddf04ce2 # 0.32.0
uses: hoverkraft-tech/ci-github-common/actions/checkout@f5847cb398fe65d53794e6aba98ebdfa0801f691 # 0.32.0

- id: working-directory
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
env:
WORKING_DIRECTORY_INPUT: ${{ inputs.working-directory }}
uses: hoverkraft-tech/ci-github-common/actions/working-directory@f5847cb398fe65d53794e6aba98ebdfa0801f691 # 0.32.0
with:
script: |
const fs = require('node:fs');
const path = require('node:path');

let workingDirectory = process.env.WORKING_DIRECTORY_INPUT || '.';
if (!path.isAbsolute(workingDirectory)) {
workingDirectory = path.join(process.env.GITHUB_WORKSPACE, workingDirectory);
}

if (!fs.existsSync(workingDirectory)) {
core.setFailed(`The specified working directory does not exist: ${workingDirectory}`);
return;
}
workingDirectory = path.resolve(workingDirectory);
core.debug(`Running in working directory: ${workingDirectory}`);
core.setOutput('working-directory', workingDirectory);
working-directory: ${{ inputs.working-directory }}
enforce-path-in-workspace: ${{ inputs.container && 'false' || 'true' }}

- id: build-variables
if: inputs.build != ''
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
env:
WORKING_DIRECTORY: ${{ steps.working-directory.outputs.working-directory }}
WORKING_DIRECTORY: ${{ steps.working-directory.outputs.absolute-path }}
BUILD_INPUT: ${{ inputs.build }}
with:
script: |
Expand Down Expand Up @@ -460,11 +444,11 @@ jobs:
packages: read
id-token: write # Needed for getting local workflow actions
steps:
- uses: hoverkraft-tech/ci-github-common/actions/checkout@4bfbc05c189f1177cf7d47d3060cd1cbddf04ce2 # 0.32.0
- uses: hoverkraft-tech/ci-github-common/actions/checkout@f5847cb398fe65d53794e6aba98ebdfa0801f691 # 0.32.0
if: inputs.container == ''

- id: local-workflow-actions
uses: hoverkraft-tech/ci-github-common/actions/local-workflow-actions@4bfbc05c189f1177cf7d47d3060cd1cbddf04ce2 # 0.32.0
uses: hoverkraft-tech/ci-github-common/actions/local-workflow-actions@f5847cb398fe65d53794e6aba98ebdfa0801f691 # 0.32.0
with:
actions-path: actions

Expand Down Expand Up @@ -500,7 +484,7 @@ jobs:
path-mapping: ${{ needs.prepare.outputs.path-mapping || '' }}

# jscpd:ignore-start
- uses: hoverkraft-tech/ci-github-common/actions/local-workflow-actions@4bfbc05c189f1177cf7d47d3060cd1cbddf04ce2 # 0.32.0
- uses: hoverkraft-tech/ci-github-common/actions/local-workflow-actions@f5847cb398fe65d53794e6aba98ebdfa0801f691 # 0.32.0
if: always() && steps.local-workflow-actions.outputs.repository
with:
actions-path: actions
Expand All @@ -523,11 +507,11 @@ jobs:
outputs:
artifact-id: ${{ steps.build.outputs.artifact-id }}
steps:
- uses: hoverkraft-tech/ci-github-common/actions/checkout@4bfbc05c189f1177cf7d47d3060cd1cbddf04ce2 # 0.32.0
- uses: hoverkraft-tech/ci-github-common/actions/checkout@f5847cb398fe65d53794e6aba98ebdfa0801f691 # 0.32.0
if: needs.setup.outputs.build-commands && inputs.container == ''

- id: local-workflow-actions
uses: hoverkraft-tech/ci-github-common/actions/local-workflow-actions@4bfbc05c189f1177cf7d47d3060cd1cbddf04ce2 # 0.32.0
uses: hoverkraft-tech/ci-github-common/actions/local-workflow-actions@f5847cb398fe65d53794e6aba98ebdfa0801f691 # 0.32.0
with:
actions-path: actions

Expand All @@ -543,7 +527,7 @@ jobs:
build-artifact: ${{ needs.setup.outputs.build-artifact }}

# jscpd:ignore-start
- uses: hoverkraft-tech/ci-github-common/actions/local-workflow-actions@4bfbc05c189f1177cf7d47d3060cd1cbddf04ce2 # 0.32.0
- uses: hoverkraft-tech/ci-github-common/actions/local-workflow-actions@f5847cb398fe65d53794e6aba98ebdfa0801f691 # 0.32.0
if: always() && steps.local-workflow-actions.outputs.repository
with:
actions-path: actions
Expand All @@ -566,7 +550,7 @@ jobs:
packages: read
id-token: write # Needed for getting local workflow actions
steps:
- uses: hoverkraft-tech/ci-github-common/actions/checkout@4bfbc05c189f1177cf7d47d3060cd1cbddf04ce2 # 0.32.0
- uses: hoverkraft-tech/ci-github-common/actions/checkout@f5847cb398fe65d53794e6aba98ebdfa0801f691 # 0.32.0
if: inputs.container == ''

- if: needs.build.outputs.artifact-id && inputs.container == ''
Expand All @@ -576,7 +560,7 @@ jobs:
path: "/"

- id: local-workflow-actions
uses: hoverkraft-tech/ci-github-common/actions/local-workflow-actions@4bfbc05c189f1177cf7d47d3060cd1cbddf04ce2 # 0.32.0
uses: hoverkraft-tech/ci-github-common/actions/local-workflow-actions@f5847cb398fe65d53794e6aba98ebdfa0801f691 # 0.32.0
with:
actions-path: actions

Expand Down Expand Up @@ -618,7 +602,7 @@ jobs:
github-token: ${{ secrets.github-token || github.token }}

# jscpd:ignore-start
- uses: hoverkraft-tech/ci-github-common/actions/local-workflow-actions@4bfbc05c189f1177cf7d47d3060cd1cbddf04ce2 # 0.32.0
- uses: hoverkraft-tech/ci-github-common/actions/local-workflow-actions@f5847cb398fe65d53794e6aba98ebdfa0801f691 # 0.32.0
if: always() && steps.local-workflow-actions.outputs.repository
with:
actions-path: actions
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ _Actions for continuous integration steps: build, lint, and test._

#### - [Codecov](actions/codecov/README.md)

#### - [Package](actions/package/README.md)

#### - [Lint](actions/lint/README.md)

#### - [Test](actions/test/README.md)
Expand Down
17 changes: 9 additions & 8 deletions actions/build/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,17 @@ runs:
# FIXME: workaround until will be merged: https://github.com/actions/runner/pull/1684
run: mkdir -p ./self-build-action/ && cp -r $GITHUB_ACTION_PATH/../* ./self-build-action/

- id: working-directory
uses: hoverkraft-tech/ci-github-common/actions/working-directory@f5847cb398fe65d53794e6aba98ebdfa0801f691 # 0.32.0
with:
working-directory: ${{ inputs.working-directory }}
enforce-path-in-workspace: ${{ inputs.container && 'false' || 'true' }}

- id: setup-node
if: inputs.container != 'true'
uses: ./self-build-action/setup-node
with:
working-directory: ${{ inputs.working-directory }}
working-directory: ${{ steps.working-directory.outputs.absolute-path }}
dependencies-cache: |
nx
gatsby
Expand All @@ -86,7 +92,7 @@ runs:
if: inputs.container == 'true'
uses: ./self-build-action/get-package-manager
with:
working-directory: ${{ inputs.working-directory }}
working-directory: ${{ steps.working-directory.outputs.absolute-path }}

- uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
env:
Expand Down Expand Up @@ -122,15 +128,10 @@ runs:
env:
BUILD_COMMANDS: ${{ inputs.build-commands }}
RUN_SCRIPT_COMMAND: ${{ inputs.container == 'true' && steps.get-package-manager.outputs.run-script-command || steps.setup-node.outputs.run-script-command }}
WORKING_DIRECTORY: ${{ inputs.working-directory }}
WORKING_DIRECTORY: ${{ steps.working-directory.outputs.absolute-path }}
with:
script: |
const fs = require('node:fs');
const workingDirectory = process.env.WORKING_DIRECTORY;
if (!fs.existsSync(workingDirectory)) {
core.setFailed(`The specified working directory does not exist: ${workingDirectory}`);
return;
}
core.debug(`Running in working directory: ${workingDirectory}`);
process.chdir(workingDirectory);

Expand Down
12 changes: 9 additions & 3 deletions actions/codecov/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ inputs:
runs:
using: "composite"
steps:
- id: working-directory
uses: hoverkraft-tech/ci-github-common/actions/working-directory@f5847cb398fe65d53794e6aba98ebdfa0801f691 # 0.32.0
with:
working-directory: ${{ inputs.working-directory }}
enforce-path-in-workspace: "false"

# Check and install dependencies for codecov
- name: Check Codecov dependencies
id: check-codecov-deps
Expand Down Expand Up @@ -153,9 +159,9 @@ runs:
- name: 📊 Upload coverage to Codecov
uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5.5.2
with:
directory: ${{ inputs.working-directory }}
root_dir: ${{ inputs.working-directory }}
working-directory: ${{ inputs.working-directory }}
directory: ${{ steps.working-directory.outputs.workspace-relative-path }}
root_dir: ${{ steps.working-directory.outputs.workspace-relative-path }}
working-directory: ${{ steps.working-directory.outputs.workspace-relative-path }}
use_oidc: true
disable_telem: true
fail_ci_if_error: false
Expand Down
Loading
Loading