世の中には色々な Free Tier サービスがありますが、今回は GitLab.com の無料プランで CI/CD パイプラインを試してみました。パイプラインは毎月 400 分まで使えるようなので、とてもありがたいです。
GitLab.com の無料プラン

空のプロジェクトを作成

プロジェクト名を入力し、初期化のチェックを外して、プロジェクトを作成

検証用の .NET 6 コンソールアプリをローカルで作成しリポジトリにプッシュ
dotnet new console -f net6.0 -o devdotnet
cd devdotnet
dotnet run
dotnet new gitignore
git init --initial-branch=main
git remote add origin https://gitlab.com/mnrsdev/devdotnet.git
git add .
git commit -m "Initial commit"
git push --set-upstream origin main
CI/CDを設定

パイプラインの設定

パイプライン用の YAML を下記のように書き換え
stages:
- build
build-job:
stage: build
image: mcr.microsoft.com/dotnet/sdk:6.0
script:
- dotnet run
変更をコミットする

ジョブの状態を確認

ジョブの結果を確認
指定した Docker イメージを使用し、Hello, World!
と表示されました。

参考
https://about.gitlab.com/ja-jp/pricing
https://hub.docker.com/_/microsoft-dotnet-sdk
タグ: GitLab