Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
仕事でGoで書いたWindows向けの小さなアプリをAppVeyorを使ってCIした話
Search
Daichi Hioki
March 27, 2019
Technology
0
210
仕事でGoで書いたWindows向けの小さなアプリをAppVeyorを使ってCIした話
第8回ゆるはち.it: CI/CDについてゆるく話す -
https://yuruhachi-it.connpass.com/event/123888/
での LT 資料です。
Daichi Hioki
March 27, 2019
Tweet
Share
More Decks by Daichi Hioki
See All by Daichi Hioki
Rustで学ぶTOTP
hioki_daichi
0
1.2k
Gopher道場#3を振り返る
hioki_daichi
0
2.4k
Rubyエンジニア多めの現場での Vue.js1系 on Rails
hioki_daichi
5
1.3k
Other Decks in Technology
See All in Technology
解析の定理証明実践@Lean 4
dec9ue
1
210
生成AI時代 文字コードを学ぶ意義を見出せるか?
hrsued
1
750
Delegating the chores of authenticating users to Keycloak
ahus1
0
130
Witchcraft for Memory
pocke
1
670
Lazy application authentication with Tailscale
bluehatbrit
0
130
Tech-Verse 2025 Keynote
lycorptech_jp
PRO
0
1.4k
5min GuardDuty Extended Threat Detection EKS
takakuni
0
180
Node-RED × MCP 勉強会 vol.1
1ftseabass
PRO
0
180
AWS Summit Japan 2025 Community Stage - App workflow automation by AWS Step Functions
matsuihidetoshi
1
310
rubygem開発で鍛える設計力
joker1007
3
290
SpringBoot x TestContainerで実現するポータブル自動結合テスト
demaecan
0
130
Node-REDのFunctionノードでMCPサーバーの実装を試してみた / Node-RED × MCP 勉強会 vol.1
you
PRO
0
130
Featured
See All Featured
It's Worth the Effort
3n
185
28k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
45
7.5k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
161
15k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
16k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
331
22k
Build your cross-platform service in a week with App Engine
jlugia
231
18k
Testing 201, or: Great Expectations
jmmastey
42
7.6k
4 Signs Your Business is Dying
shpigford
184
22k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
34
3.1k
Become a Pro
speakerdeck
PRO
28
5.4k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
44
2.4k
How to Think Like a Performance Engineer
csswizardry
24
1.7k
Transcript
仕事でGoで書いたWindows 向けの小さなアプリを AppVeyorを使ってCIした話
自己紹介 - 株式会社クリプラでクラウド電子カルテを開発している Rails エンジニア - https://clipla.jp/ - 最近は Go
で Windows 向けアプリを作成中 - こちらにまつわる CI のご紹介
AppVeyor とは - Windows 環境の CI ができるやつ - (Windows 以外も対応してるけど・・)
- 価格 - Public なリポジトリなら無料 - 2019年3月時点で Private なリポジトリ は $29/month
設定方法 - Web からでも YAML でも 設定可能 - Web の場合は→
- YAMLの場合は appveyor.yml で
設定方法 - Web で設定したものを YAML へ Export するこ とも可能
Build Worker Image - 現時点でのデフォルト: - Visual Studio 2015 -
ubuntu 等も選択可能 - ubuntu を Worker Image に 使った Getting started ページも ある - Getting started with AppVeyor for Linux | AppVeyor
Stack (※ 今回は使わず) - stack: go 1.11 のように指定すること で公式の用意した Go
を使える
Build Cache - 指定したディレクトリやファイルの内容をビルド間で保持できる 機能
AppVeyor でテストを行う例
appveyor.yml に変更があったら cache からの restore を skip する こちらは Windows
のコマンド > https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/if if [not] exist <FileName> <Command> [else <Expression>] 公式でまだ Go1.12 がサポートされていないためソースからインストール msiexec /i でインストール https://docs.microsoft.com/ja-jp/windows/desktop/Msi/command-line-options あらかじめ environment の箇所で環境変数 GOBIN を c:\gobin に設定しているため、$ go install した時に c:\gobin 以下にツールをインストールしてくれる どこでもよさそう。Go の Modules 導入以前は制限があったかも。 Go のモジュールシステムが過渡期なのでこのような指定が必要 詳細: https://github.com/golang/go/wiki/Modules
AppVeyor に GoReleaser を組み合わせることで tag を push した時に自動で GitHub Releases
に Publish する例
if %APPVEYOR_REPO_TAG% equ true <コマンド> で tag を push した時だけ実行したいコマンドを定義できる
deploy_script 内での goreleaser release の実行
GoReleaser の設定ファイルは .goreleaser.yaml - builds の goos と goarch で
指定した組み合わせをすべ て生成してくれる - 右の例では 6 通り
GoReleaser には環境変数 GITHUB_TOKEN が必要 - GoReleaser を使ってリリースするためには repo の scope
を 持った GitHub token を環境変数 GITHUB_TOKEN に設定 する必要がある
GitHub token の作成 - https://github.com/settings/tokens/new で作るだけ
AppVeyor で環境変数 GITHUB_TOKEN を指定する
あとは tag を push するだけ - tag を push するだけで
GitHub Releases にリリース が作成される
まとめ
- 話したこと - AppVeyor の概要: - 設定方法、Build Worker Image、Stack、Build Cache
- プロジェクトでの実例: - Go1.12 をソースからインストールして statik もインストールしてテスト - AppVeyor + GoReleaser: - AppVeyor と GoReleaser を組み合わせて、tag を push した時に自動で GitHub Releases に publish - その他 - 今回試していなかったけれど、コードが大きい場合は Azure Pipelines の方が良い かも? - https://azure.microsoft.com/ja-jp/services/devops/pipelines/ - Public なリポジトリなら無料で 10 個の並列ジョブ(時間制限なし)を実行可能ら しい