Stabilize reusable pipeline and publish v1.2
This commit is contained in:
parent
ea50777645
commit
460883dfcb
2 changed files with 62 additions and 106 deletions
166
.github/workflows/repo-pipeline.yml
vendored
166
.github/workflows/repo-pipeline.yml
vendored
|
|
@ -9,142 +9,97 @@ on:
|
||||||
type: string
|
type: string
|
||||||
default: ios
|
default: ios
|
||||||
lint_command:
|
lint_command:
|
||||||
description: Command that runs lint checks
|
description: Optional lint command override
|
||||||
required: false
|
required: false
|
||||||
type: string
|
type: string
|
||||||
default: ""
|
default: ""
|
||||||
build_command:
|
build_command:
|
||||||
description: Command that builds the project
|
description: Optional build command override
|
||||||
required: false
|
required: false
|
||||||
type: string
|
type: string
|
||||||
default: ""
|
default: ""
|
||||||
test_command:
|
test_command:
|
||||||
description: Command that executes tests
|
description: Optional test command override
|
||||||
required: false
|
required: false
|
||||||
type: string
|
type: string
|
||||||
default: ""
|
default: ""
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
ci-ios:
|
ci:
|
||||||
name: ci
|
name: ci
|
||||||
if: ${{ inputs.repo_type == 'ios' }}
|
runs-on: ${{ inputs.repo_type == 'ios' && 'macos-15' || 'ubuntu-latest' }}
|
||||||
runs-on: macos-15
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout caller repository
|
- name: Checkout caller repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Resolve commands
|
- name: Lint
|
||||||
id: resolve
|
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
lint="${{ inputs.lint_command }}"
|
CMD='${{ inputs.lint_command }}'
|
||||||
build="${{ inputs.build_command }}"
|
if [ -z "$CMD" ]; then
|
||||||
test="${{ inputs.test_command }}"
|
case '${{ inputs.repo_type }}' in
|
||||||
if [ -z "$lint" ]; then
|
ios)
|
||||||
lint="if which swiftlint > /dev/null; then swiftlint --strict; else brew install swiftlint && swiftlint --strict; fi"
|
CMD="if which swiftlint > /dev/null; then swiftlint --strict; else brew install swiftlint && swiftlint --strict; fi"
|
||||||
|
;;
|
||||||
|
node)
|
||||||
|
CMD="npm run lint --if-present"
|
||||||
|
;;
|
||||||
|
python)
|
||||||
|
CMD="python -m pip install -U pip && pip install ruff && ruff check ."
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
CMD="echo 'No lint command configured for custom repo_type'"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
fi
|
fi
|
||||||
if [ -z "$build" ]; then
|
eval "$CMD"
|
||||||
build="xcodebuild build -project CamperLogBook.xcodeproj -scheme CamperLogBook -destination 'platform=iOS Simulator,name=iPhone 16,OS=latest' CODE_SIGNING_ALLOWED=NO"
|
|
||||||
fi
|
|
||||||
if [ -z "$test" ]; then
|
|
||||||
test="xcodebuild test -project CamperLogBook.xcodeproj -scheme CamperLogBook -destination 'platform=iOS Simulator,name=iPhone 16,OS=latest' CODE_SIGNING_ALLOWED=NO"
|
|
||||||
fi
|
|
||||||
{
|
|
||||||
echo "lint<<EOF"
|
|
||||||
echo "$lint"
|
|
||||||
echo "EOF"
|
|
||||||
echo "build<<EOF"
|
|
||||||
echo "$build"
|
|
||||||
echo "EOF"
|
|
||||||
echo "test<<EOF"
|
|
||||||
echo "$test"
|
|
||||||
echo "EOF"
|
|
||||||
} >> "$GITHUB_OUTPUT"
|
|
||||||
|
|
||||||
- name: Lint
|
|
||||||
shell: bash
|
|
||||||
run: ${{ steps.resolve.outputs.lint }}
|
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
shell: bash
|
|
||||||
run: ${{ steps.resolve.outputs.build }}
|
|
||||||
|
|
||||||
- name: Test
|
|
||||||
shell: bash
|
|
||||||
run: ${{ steps.resolve.outputs.test }}
|
|
||||||
|
|
||||||
ci-generic:
|
|
||||||
name: ci
|
|
||||||
if: ${{ inputs.repo_type != 'ios' }}
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout caller repository
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Resolve commands
|
|
||||||
id: resolve
|
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
repo_type="${{ inputs.repo_type }}"
|
CMD='${{ inputs.build_command }}'
|
||||||
lint="${{ inputs.lint_command }}"
|
if [ -z "$CMD" ]; then
|
||||||
build="${{ inputs.build_command }}"
|
case '${{ inputs.repo_type }}' in
|
||||||
test="${{ inputs.test_command }}"
|
ios)
|
||||||
|
CMD="xcodebuild build -project CamperLogBook.xcodeproj -scheme CamperLogBook -destination 'platform=iOS Simulator,name=iPhone 16,OS=latest' CODE_SIGNING_ALLOWED=NO"
|
||||||
if [ -z "$lint" ]; then
|
;;
|
||||||
case "$repo_type" in
|
node)
|
||||||
node) lint="npm run lint --if-present" ;;
|
CMD="npm run build --if-present"
|
||||||
python) lint="python -m pip install -U pip && pip install ruff && ruff check ." ;;
|
;;
|
||||||
custom) lint="" ;;
|
python)
|
||||||
*) lint="" ;;
|
CMD="echo 'No build step for python default'"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
CMD="echo 'No build command configured for custom repo_type'"
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
eval "$CMD"
|
||||||
if [ -z "$build" ]; then
|
|
||||||
case "$repo_type" in
|
|
||||||
node) build="npm run build --if-present" ;;
|
|
||||||
python) build="" ;;
|
|
||||||
custom) build="" ;;
|
|
||||||
*) build="" ;;
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "$test" ]; then
|
|
||||||
case "$repo_type" in
|
|
||||||
node) test="npm test --if-present" ;;
|
|
||||||
python) test="pytest -q" ;;
|
|
||||||
custom) test="" ;;
|
|
||||||
*) test="" ;;
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
|
|
||||||
{
|
|
||||||
echo "lint<<EOF"
|
|
||||||
echo "$lint"
|
|
||||||
echo "EOF"
|
|
||||||
echo "build<<EOF"
|
|
||||||
echo "$build"
|
|
||||||
echo "EOF"
|
|
||||||
echo "test<<EOF"
|
|
||||||
echo "$test"
|
|
||||||
echo "EOF"
|
|
||||||
} >> "$GITHUB_OUTPUT"
|
|
||||||
|
|
||||||
- name: Lint
|
|
||||||
if: ${{ steps.resolve.outputs.lint != '' }}
|
|
||||||
shell: bash
|
|
||||||
run: ${{ steps.resolve.outputs.lint }}
|
|
||||||
|
|
||||||
- name: Build
|
|
||||||
if: ${{ steps.resolve.outputs.build != '' }}
|
|
||||||
shell: bash
|
|
||||||
run: ${{ steps.resolve.outputs.build }}
|
|
||||||
|
|
||||||
- name: Test
|
- name: Test
|
||||||
if: ${{ steps.resolve.outputs.test != '' }}
|
|
||||||
shell: bash
|
shell: bash
|
||||||
run: ${{ steps.resolve.outputs.test }}
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
CMD='${{ inputs.test_command }}'
|
||||||
|
if [ -z "$CMD" ]; then
|
||||||
|
case '${{ inputs.repo_type }}' in
|
||||||
|
ios)
|
||||||
|
CMD="xcodebuild test -project CamperLogBook.xcodeproj -scheme CamperLogBook -destination 'platform=iOS Simulator,name=iPhone 16,OS=latest' CODE_SIGNING_ALLOWED=NO"
|
||||||
|
;;
|
||||||
|
node)
|
||||||
|
CMD="npm test --if-present"
|
||||||
|
;;
|
||||||
|
python)
|
||||||
|
CMD="pytest -q"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
CMD="echo 'No test command configured for custom repo_type'"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
eval "$CMD"
|
||||||
|
|
||||||
security-scan:
|
security-scan:
|
||||||
name: security-scan
|
name: security-scan
|
||||||
|
|
@ -170,11 +125,12 @@ jobs:
|
||||||
config: p/default
|
config: p/default
|
||||||
|
|
||||||
- name: Dependency Review
|
- name: Dependency Review
|
||||||
if: github.event_name == 'pull_request'
|
if: ${{ github.event_name == 'pull_request' }}
|
||||||
uses: actions/dependency-review-action@v4
|
uses: actions/dependency-review-action@v4
|
||||||
|
|
||||||
ai-review:
|
ai-review:
|
||||||
name: ai-review
|
name: ai-review
|
||||||
|
if: ${{ github.event_name == 'pull_request' }}
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ Use from another repository:
|
||||||
```yaml
|
```yaml
|
||||||
jobs:
|
jobs:
|
||||||
use-vanity-dev-engine:
|
use-vanity-dev-engine:
|
||||||
uses: OliverGiertz/vanity-dev-engine/.github/workflows/repo-pipeline.yml@v1.1
|
uses: OliverGiertz/vanity-dev-engine/.github/workflows/repo-pipeline.yml@v1.2
|
||||||
secrets: inherit
|
secrets: inherit
|
||||||
with:
|
with:
|
||||||
repo_type: ios
|
repo_type: ios
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue