Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .devcontainer/devcontainer-lock.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
{
"features": {
"ghcr.io/devcontainers/features/dotnet:2": {
"ghcr.io/devcontainers/features/dotnet": {
"version": "2.5.0",
"resolved": "ghcr.io/devcontainers/features/dotnet@sha256:0fc16547ed4db6d7ff2a9f5981d2b93eb314e568affb9958029ad794f1f9a093",
"integrity": "sha256:0fc16547ed4db6d7ff2a9f5981d2b93eb314e568affb9958029ad794f1f9a093"
},
"ghcr.io/devcontainers/features/go:1": {
"ghcr.io/devcontainers/features/go": {
"version": "1.3.4",
"resolved": "ghcr.io/devcontainers/features/go@sha256:d85e921f91b41340055bb12b325d9d551170ed04b3b832e33530bf42f167c032",
"integrity": "sha256:d85e921f91b41340055bb12b325d9d551170ed04b3b832e33530bf42f167c032"
},
"ghcr.io/devcontainers/features/node:2": {
"ghcr.io/devcontainers/features/node": {
"version": "2.1.0",
"resolved": "ghcr.io/devcontainers/features/node@sha256:586c9a6f7dd40bd3ba2cd41e7f2f88dcc31fbe5d1442afcbf07ffbc66b686857",
"integrity": "sha256:586c9a6f7dd40bd3ba2cd41e7f2f88dcc31fbe5d1442afcbf07ffbc66b686857"
Expand Down
15 changes: 5 additions & 10 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,36 +3,31 @@
{
"name": "Ubuntu",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"image": "mcr.microsoft.com/devcontainers/base:resolute",
"image": "mcr.microsoft.com/devcontainers/base:ubuntu",
"features": {
"ghcr.io/devcontainers/features/dotnet:2": {
"ghcr.io/devcontainers/features/dotnet": {
"tabCompletions": true,
"version": "latest"
},
"ghcr.io/devcontainers/features/go:1": {
"ghcr.io/devcontainers/features/go": {
"version": "latest"
},
"ghcr.io/devcontainers/features/node:2": {
"ghcr.io/devcontainers/features/node": {
"nodeGypDependencies": true,
"version": "lts",
"npmVersion": "lts",
"pnpmVersion": "latest",
"nvmVersion": "latest"
}
}

// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],

// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "uname -a",

// Configure tool-specific properties.
// "customizations": {},

// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
}
}
2 changes: 1 addition & 1 deletion .github/actions/setup-playwright/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ runs:
echo "PLAYWRIGHT_VERSION=$PLAYWRIGHT_VERSION" >> $GITHUB_OUTPUT

- name: Cache Playwright with deps
uses: actions/cache@v4
uses: actions/cache@v6
with:
path: ~/.cache/ms-playwright
key: playwright-${{ steps.version.outputs.PLAYWRIGHT_VERSION }}
Expand Down
16 changes: 16 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file

version: 2
updates:
- package-ecosystem: "devcontainers" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "weekly"

- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Chapter 1 Hello World、ワークフローの定義ファイルの書き方.
---
name: Chapter 1 - Hello World (Go Test)
name: Chapter 1 - Hello World

on:
# Events
Expand All @@ -11,16 +11,14 @@ on:
branches:
- main
paths:
- "./chapters/go/go.mod"
- "./chapters/go/go.sum"
- "./chapters/go/*.go"
- ".github/workflows/chapter-1-go.yaml"
- './chapters/go/hello/**'
- '.github/workflows/chapter-1-hello.yaml'

# issusのコメントでワークフローをトリガーする設定
issue_comment:
types: [created, deleted]

# 指定した時間にワークフローをトリガーする設定
# 指定した時間にワークフローをトリガーする設定
# schedule:
# - cron: "0 9 1 * *" # At 09:00 on day-of-month 1.

Expand All @@ -31,7 +29,7 @@ permissions: {}
defaults:
run:
shell: bash

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
Expand All @@ -46,17 +44,17 @@ jobs:
contents: read
defaults:
run:
working-directory: ./chapters/go/
working-directory: './chapters/go/hello/'

# steps は job の中で実行されるタスクの集合体です。
# steps は job の中で実行されるタスクの集合体です。
steps:
# 複雑な処理や頻繁に使用する処理は、アクションを定義して使用することができます。
- uses: actions/checkout@v7

- name: Set up Go
uses: actions/setup-go@v7
with:
go-version: "1.26.5"
go-version: '1.26'
cache: false

- name: Build
Expand Down
20 changes: 12 additions & 8 deletions .github/workflows/chapter-2-1-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@
name: Chapter 2 (1) - CI

on:
# main ブランチへのプルリクエストが作成されたときに実行する
pull_request:
branches:
- main
paths:
- "./chapters/go/go.mod"
- "./chapters/go/go.sum"
- "./chapters/go/*.go"
- ".github/workflows/chapter-2-1-ci.yaml"
- './chapters/go/hello-api/**'
- '.github/workflows/chapter-2-1-ci.yaml'
workflow_dispatch:

permissions: {}
Expand All @@ -30,22 +29,27 @@ jobs:
contents: read
defaults:
run:
working-directory: ./chapters/go/
working-directory: 'chapters/go/hello-api/'

steps:
- name: チェックアウトする
uses: actions/checkout@v7

- name: Go の環境をセットアップする
uses: actions/setup-go@v7
with:
go-version: "1.26.5"
go-version: '1.26'

- name: フォーマットを実行する
# フォーマット違反時にステップを失敗させる
# gofmt はフォーマット違反の検出にかかわらず正常終了する。
# そのため test -z で違反がある場合に失敗させる。
run: test -z "$(gofmt -l .)"

- name: 静的解析を実行する
run: go vet ./...

- name: テストを実行する
run: go test

- name: ビルドを実行する
run: go build .
29 changes: 13 additions & 16 deletions .github/workflows/chapter-2-2-cd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@
name: Chapter 2 (2) - CD

on:
# main への push つまりマージが行われたときに実行する
push:
branches:
- main
paths:
- "./chapters/go/go.mod"
- "./chapters/go/go.sum"
- "./chapters/go/*.go"
- './chapters/go/hello-api/**'
- './.github/workflows/chapter-2-2-cd.yaml'
workflow_dispatch:

permissions: {}
defaults:
run:
shell: bash

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
Expand All @@ -25,25 +25,22 @@ jobs:
cd:
name: cd
runs-on: ubuntu-latest
# GitHub Container Registry にイメージを push するための権限を付与する
permissions:
contents: read
packages: write
defaults:
run:
working-directory: './chapters/go/hello-api/'

steps:
- uses: actions/checkout@v7
- name: Container registory に認証する

- name: Container registry に認証する
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
- name: Container registory に認証する
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Docker ビルドする
run: docker build -t ghcr.io/${{ github.repository }}:latest .

- name: Docker イメージをプッシュする
run: docker push ghcr.io/${{ github.repository }}:latest
- name: Docker をビルドおよびプッシュする
uses: docker/build-push-action@v5
with:
push: true
tags: ghcr.io/${{ github.repository }}:latest
56 changes: 56 additions & 0 deletions .github/workflows/chapter-2-3-cd-action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Chapter 2 マージ駆動でCDを実現する(Docker公式のactionを使用する方法).
---
name: Chapter 2 (3) - CD with Docker action

on:
push:
branches:
- main
paths:
- './chapters/go/hello-api/**'
- './.github/workflows/chapter-2-3-cd-action.yaml'
workflow_dispatch:

permissions: {}
defaults:
run:
shell: bash

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
cd:
name: cd
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
defaults:
run:
working-directory: './chapters/go/hello-api/'

steps:
- uses: actions/checkout@v7

# https://github.com/marketplace/actions/build-and-push-docker-images
- name: Login to Docker Hub
uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Set up QEMU
uses: docker/setup-qemu-action@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4

- name: Build and push
uses: docker/build-push-action@v7
with:
platforms: linux/amd64,linux/arm64
push: true
tags: ghcr.io/${{ github.repository }}:latest
44 changes: 36 additions & 8 deletions .github/workflows/chapter-3-1-context.yaml
Original file line number Diff line number Diff line change
@@ -1,32 +1,42 @@
# Chapter 3 ワークフロー内で利用可能な値(コンテキスト).
---
name: Chapter 3 (1) - actions/context
name: Chapter 3 (1) - Context

on:
pull_request:
paths:
- ".github/workflows/context.yaml"
- '.github/workflows/chapter-3-1-context.yaml'
workflow_dispatch:

permissions: {}
defaults:
run:
shell: bash

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

# ワークフロー内では GitHub Actions に関連するさまざまな情報へアクセスするための値(コンテキスト)が利用できます。

jobs:
display:
name: display
runs-on: ubuntu-latest
permissions:
contents: read

steps:
- name: プルリクエストの情報を表示
env:
GITHUB_HEAD_REF: "${{ github.head_ref }}"
GITHUB_HEAD_REF: '${{ github.head_ref }}'
run: |
echo "プルリクエストのブランチ名: $GITHUB_HEAD_REF"
echo "プルリクエストの番号: ${{ github.event.pull_request.number }}"
echo "プルリクエストの作成者": ${{ github.event.pull_request.user.login }}

# - see: https://docs.github.com/ja/actions/writing-workflows/choosing-what-your-workflow-does/accessing-contextual-information-about-workflow-runs
- name: github コンテキストの表示
# github コンテキストには主に、GitHub Actions の実行に関する情報が格納されています
# Be aware that it contains sensitive information such as github.token!
env:
GITHUB_EVENT_CONTEXT: ${{ toJson(github.event) }}
Expand All @@ -39,14 +49,32 @@ jobs:
echo "github.event: $GITHUB_EVENT_CONTEXT"

- name: runner コンテキストの表示
# runner コンテキストには主に、GitHub Actions の実行環境に関する情報が格納されています
env:
RUNNER_CONTEXT: ${{ toJson(runner) }}
run: echo "$RUNNER_CONTEXT"

- uses: actions/checkout@v7
# steps コンテキストを利用するには、id を指定する必要があります
id: checkout
- name: actions/checkout のステータスを表示
run: echo "${{ steps.checkout.conclusion }}"

- name: job のステータスを表示
run: echo "${{ job.status }}"
- name: steps コンテキストの表示
# steps コンテキストには、同じジョブ内で実行されたステップの情報が格納されています
run: |
# actions/checkout のステータスを表示
echo "${{ steps.checkout.conclusion }}"

- name: job コンテキストの表示
# job コンテキストには、同じジョブ内で実行されたステップの情報が格納されています
run: |
echo "${{ job.status }}"
echo "${{ toJson(job) }}"

- name: その他のコンテキストの表示
# - see: https://docs.github.com/ja/actions/writing-workflows/choosing-what-your-workflow-does/accessing-contextual-information-about-workflow-runs
run: |
echo "${{ toJson(matrix) }}"
echo "${{ toJson(needs) }}"
echo "${{ toJson(runner.os) }}"
echo "${{ toJson(env) }}"
echo "${{ toJson(inputs) }}"
Loading
Loading