Skip to content

Fix: マージ後レビューで見つかった片側の穴とテストの弁別力を直す #1160

Fix: マージ後レビューで見つかった片側の穴とテストの弁別力を直す

Fix: マージ後レビューで見つかった片側の穴とテストの弁別力を直す #1160

Workflow file for this run

name: Job Boot Check
on:
pull_request:
paths:
- '.github/workflows/job-boot-check.yaml'
- 'cmd/**.go'
- 'internal/**.go'
- 'env/.env.ci'
- 'env/.env'
- 'go.mod'
- 'go.sum'
- '.makefiles/**'
- 'makefile'
workflow_dispatch:
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
job-boot-check:
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
contents: read
env:
ENV: ci
services:
database:
image: postgres:18.4-trixie@sha256:a02db8cac496f15b094798a38254f14d6e00741f709360e5e00bb6668ea31636
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres-password
POSTGRES_DB: test
POSTGRES_INITDB_ARGS: "--encoding=UTF8"
TZ: Asia/Tokyo
PGTZ: Asia/Tokyo
ports:
- "5432:5432"
options: >-
--health-cmd="pg_isready -U postgres -d test"
--health-interval=10s
--health-timeout=5s
--health-retries=5
--health-start-period=20s
steps:
- name: Harden the runner
uses: step-security/harden-runner@b09bb98e06d4d774595224525879c09bc6e98c40 # v2.20.1
with:
egress-policy: block
allowed-endpoints: >
agent.api.stepsecurity.io:443
api.github.com:443
github.com:443
codeload.github.com:443
objects.githubusercontent.com:443
raw.githubusercontent.com:443
release-assets.githubusercontent.com:443
*.actions.githubusercontent.com:443
*.blob.core.windows.net:443
mise.jdx.dev:443
mise-versions.jdx.dev:443
mise.run:443
mise.en.dev:443
aquaproj.github.io:443
proxy.golang.org:443
sum.golang.org:443
index.golang.org:443
storage.googleapis.com:443
dl.google.com:443
go.dev:443
golang.org:443
downloads.sqlc.dev:443
nodejs.org:443
registry.npmjs.org:443
get.pnpm.io:443
astral.sh:443
pypi.org:443
files.pythonhosted.org:443
tuf-repo-cdn.sigstore.dev:443
rekor.sigstore.dev:443
fulcio.sigstore.dev:443
api.npmjs.org:443
api.osv.dev:443
npm.jsr.io:443
docker.io:443
index.docker.io:443
registry-1.docker.io:443
auth.docker.io:443
*.docker.io:443
production.cloudflare.docker.com:443
production.cloudfront.docker.com:443
mirror.gcr.io:443
ghcr.io:443
pkg-containers.githubusercontent.com:443
dl-cdn.alpinelinux.org:443
dl-cdn.alpinelinux.org:80
deb.debian.org:443
deb.debian.org:80
security.debian.org:443
security.debian.org:80
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Setup Go
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7
with:
go-version-file: go.mod
cache: true
- name: Materialize ci env for embedding
run: make materialize-env
# Boot with a non-existent job name so this check does not depend on any sample job name.
- name: Boot job entrypoint and expect "unknown job"
run: |
set -uo pipefail
set +e
output="$(go run ./cmd/ job __ci_boot_check_no_such_job__ 2>&1)"
code=$?
set -e
echo "----- job output -----"
echo "${output}"
echo "----------------------"
if [ "${code}" -eq 0 ]; then
echo "FAIL: exit 0 returned for an unknown job (dispatch may not be working)"
exit 1
fi
if ! echo "${output}" | grep -q "unknown job"; then
echo "FAIL: non-zero exit but not via the 'unknown job' path (boot / DI / DB connection may have failed)"
exit 1
fi
echo "OK: the job entrypoint booted (DI / DB constructed) and correctly rejected an unknown job"