0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Azure Pipeline 上で Bun + testcontainers を使い Postgresql + Hono のテストを行ったメモ

Last updated at Posted at 2025-04-12

概要

前回はマイグレーションを行った。
今回はAzureDevOpsでパイプラインを動かしてみる。

ソースコード

ソースコード

apps/backend/azure-pipeline.yml
trigger:
  branches:
    include:
      - develop

pool:
  vmImage: 'ubuntu-24.04'


steps:
  - checkout: self

  - task: UseNode@1
    inputs:
      version: '22.x'

  - script: |
      curl -fsSL https://bun.sh/install | bash
    displayName: 'Install Bun'

  - script: echo "##vso[task.setvariable variable=PATH]$(HOME)/.bun/bin:$(PATH)"
    displayName: 'Add Bun to PATH'

  - script: bun install
    displayName: 'Install dependencies with Bun'

  - script: bun run test
    displayName: 'Run tests with Bun'
    workingDirectory: apps/backend
    env:
      CI: true

実行結果

image.png

'Add Bun to PATH'の解説

見慣れない書きかたなのでChatGPTに解説してもらった。

部分 意味
##vso[...] Azure Pipelines の「ログコマンド」で、スクリプト出力に含めることでパイプライン動作を制御できる特別な命令
task.setvariable variable=PATH PATH という変数を新しく定義 or 上書き
$(HOME)/.bun/bin:$(PATH) $HOME/.bun/bin を既存の PATH の前に追加(bun コマンドが見つかるようにするため)。

参考

コンテナジョブ
サービスコンテナ

パイプラインの書きかた
workingDirectory
ログコマンド

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?