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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ shortTitle: Your profile README

生成された README ファイルには、プロフィール README のアイディアを得るためのテンプレートが事前入力されています。 ![テンプレートが事前入力された README ファイル](/assets/images/help/repository/personal-repository-readme-template.png)

利用可能なすべての絵文字とそのコードの概要については、「[絵文字のチートシート](http://www.emoji-cheat-sheet.com/)」を参照してください。
利用可能なすべての絵文字とそのコードの概要については、「[絵文字のチートシート](https://www.webfx.com/tools/emoji-cheat-sheet/)」を参照してください。

## プロフィール README を削除する

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ shortTitle: Personalize

**Note{% ifversion ghec %}s{% endif %}**: {% ifversion ghec %}

* {% endif %}Your profile picture should be a PNG, JPG, or GIF file under 1 MB in size. 最高の画質をもたらすには、画像を 500 × 500 ピクセルに収めることを推奨します。
* {% endif %}Your profile picture should be a PNG, JPG, or GIF file, and it must be less than 1 MB in size and smaller than 3000 by 3000 pixels. 最高の画質をもたらすには、画像を 500 × 500 ピクセルに収めることを推奨します。
{% ifversion ghec %}* Gravatar profile pictures are not supported with {% data variables.product.prodname_emus %}.{% endif %}

{% endnote %}
Expand All @@ -39,14 +39,14 @@ shortTitle: Personalize

{% data reusables.user-settings.access_settings %}
2. [**Profile Picture**] で {% octicon "pencil" aria-label="The edit icon" %} [**Edit**] をクリックします。 ![プロフィール画像を編集](/assets/images/help/profile/edit-profile-photo.png)
3. [**Upload a photo...**] をクリックします。 ![プロフィール画像の更新](/assets/images/help/profile/edit-profile-picture-options.png)
3. Click **Upload a photo...**.{% ifversion not ghae %} ![Update profile picture](/assets/images/help/profile/edit-profile-picture-options.png){% endif %}
3. 画像をクロッピングします。 作業を終えたら [**Set new profile picture**] をクリックします。 ![アップロードされた画像をクロッピングする](/assets/images/help/profile/avatar_crop_and_save.png)

### プロフィール画像をアイデンティコンへリセットする

{% data reusables.user-settings.access_settings %}
2. [**Profile Picture**] で {% octicon "pencil" aria-label="The edit icon" %} [**Edit**] をクリックします。 ![プロフィール画像を編集](/assets/images/help/profile/edit-profile-photo.png)
3. アイデンティコンに戻すには、[**Remove photo**] をクリックします。 メールアドレスが [Gravatar](https://en.gravatar.com/) に関連付けられている場合、アイデンティコンに戻すことはできません。 その場合は、代わりに [**Revert to Gravatar**] をクリックします。 ![プロフィール画像の更新](/assets/images/help/profile/edit-profile-picture-options.png)
3. アイデンティコンに戻すには、[**Remove photo**] をクリックします。 {% ifversion not ghae %}If your email address is associated with a [Gravatar](https://en.gravatar.com/), you cannot revert to your identicon. その場合は、代わりに [**Revert to Gravatar**] をクリックします。 ![Update profile picture](/assets/images/help/profile/edit-profile-picture-options.png){% endif %}

## プロフィール名を変更する

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,217 @@
---
title: Building and testing Go
intro: You can create a continuous integration (CI) workflow to build and test your Go project.
versions:
fpt: '*'
ghes: '*'
ghae: '*'
ghec: '*'
type: tutorial
topics:
- CI
shortTitle: Build & test Go
---

{% data reusables.actions.enterprise-beta %}
{% data reusables.actions.enterprise-github-hosted-runners %}

## はじめに

This guide shows you how to build, test, and publish a Go package.

{% ifversion ghae %}
{% data reusables.actions.self-hosted-runners-software %}
{% else %} {% data variables.product.prodname_dotcom %}-hosted runners have a tools cache with preinstalled software, which includes the dependencies for Go. For a full list of up-to-date software and the preinstalled versions of Go, see "[About {% data variables.product.prodname_dotcom %}-hosted runners](/actions/using-github-hosted-runners/about-github-hosted-runners#preinstalled-software)."
{% endif %}

## 必要な環境

YAMLの構文と、{% data variables.product.prodname_actions %}でのYAMLの使われ方に馴染んでいる必要があります。 詳しい情報については、「[{% data variables.product.prodname_actions %}のワークフロー構文](/actions/using-workflows/workflow-syntax-for-github-actions)」を参照してください。

We recommend that you have a basic understanding of the Go language. For more information, see [Getting started with Go](https://golang.org/doc/tutorial/getting-started).

## Using the Go starter workflow

{% data variables.product.prodname_dotcom %} provides a Go starter workflow that should work for most Go projects. This guide includes examples that you can use to customize the starter workflow. For more information, see the [Go starter workflow](https://github.com/actions/starter-workflows/blob/main/ci/go.yml).

To get started quickly, add the starter workflow to the `.github/workflows` directory of your repository.

```yaml{:copy}
name: Go package

on: [push]

jobs:
build:

runs-on: ubuntu-latest
steps:
- uses: {% data reusables.actions.action-checkout %}

- name: Set up Go
uses: {% data reusables.actions.action-setup-go %}
with:
go-version: 1.15

- name: Build
run: go build -v ./...

- name: Test
run: go test -v ./...
```

## Specifying a Go version

The easiest way to specify a Go version is by using the `setup-go` action provided by {% data variables.product.prodname_dotcom %}. For more information see, the [`setup-go` action](https://github.com/actions/setup-go/).

To use a preinstalled version of Go on a {% data variables.product.prodname_dotcom %}-hosted runner, pass the relevant version to the `go-version` property of the `setup-go` action. This action finds a specific version of Go from the tools cache on each runner, and adds the necessary binaries to `PATH`. これらの変更は、ジョブの残りの部分で保持されます。

The `setup-go` action is the recommended way of using Go with {% data variables.product.prodname_actions %}, because it helps ensure consistent behavior across different runners and different versions of Go. If you are using a self-hosted runner, you must install Go and add it to `PATH`.

### Using multiple versions of Go

```yaml{:copy}
name: Go

on: [push]

jobs:
build:

runs-on: ubuntu-latest
strategy:
matrix:
go-version: [ '1.14', '1.15', '1.16.x' ]

steps:
- uses: {% data reusables.actions.action-checkout %}
- name: Setup Go {% raw %}${{ matrix.go-version }}{% endraw %}
uses: {% data reusables.actions.action-setup-go %}
with:
go-version: {% raw %}${{ matrix.go-version }}{% endraw %}
# You can test your matrix by printing the current Go version
- name: Display Go version
run: go version
```

### Using a specific Go version

You can configure your job to use a specific version of Go, such as `1.16.2`. あるいは、最新のマイナーリリースを取得するためにセマンティックバージョン構文を使うこともできます。 This example uses the latest patch release of Go 1.16:

```yaml{:copy}
- name: Setup Go 1.16.x
uses: {% data reusables.actions.action-setup-go %}
with:
# Semantic version range syntax or exact version of Go
go-version: '1.16.x'
```

## 依存関係のインストール

You can use `go get` to install dependencies:

```yaml{:copy}
steps:
- uses: {% data reusables.actions.action-checkout %}
- name: Setup Go
uses: {% data reusables.actions.action-setup-go %}
with:
go-version: '1.16.x'
- name: Install dependencies
run: |
go get .
go get example.lab/octo-examplemodule
go get example.lab/[email protected]
```

{% ifversion actions-caching %}

### 依存関係のキャッシング

You can cache and restore the dependencies using the [`setup-go` action](https://github.com/actions/setup-go). By default, caching is disabled, but you can set the `cache` parameter to `true` to enable it.

When caching is enabled, the `setup-go` action searches for the dependency file, `go.sum`, in the repository root and uses the hash of the dependency file as a part of the cache key.

```yaml{:copy}
- name: Setup Go
uses: {% data reusables.actions.action-setup-go %}
with:
go-version: '1.16.x'
cache: true
```

Alternatively, you can use the `cache-dependency-path` parameter for cases when multiple dependency files are used, or when they are located in different subdirectories.

```yaml{:copy}
- uses: {% data reusables.actions.action-setup-go %}
with:
go-version: '1.17'
cache: true
cache-dependency-path: subdir/go.sum
```

If you have a custom requirement or need finer controls for caching, you can use the [`cache` action](https://github.com/marketplace/actions/cache). 詳しい情報については、「[ワークフローを高速化するための依存関係のキャッシュ](/actions/using-workflows/caching-dependencies-to-speed-up-workflows)」を参照してください。

{% endif %}

## コードのビルドとテスト

ローカルで使うのと同じコマンドを、コードのビルドとテストに使えます。 This example workflow demonstrates how to use `go build` and `go test` in a job:

```yaml{:copy}
name: Go
on: [push]

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: {% data reusables.actions.action-checkout %}
- name: Setup Go
uses: {% data reusables.actions.action-setup-go %}
with:
go-version: '1.16.x'
- name: Install dependencies
run: go get .
- name: Build
run: go build -v ./...
- name: Test with the Go CLI
run: go test
```

## 成果物としてのワークフローのデータのパッケージ化

ワークフローが完了すると、結果の成果物を分析のためにアップロードできます。 たとえば、ログファイル、コアダンプ、テスト結果、スクリーンショットを保存する必要があるかもしれません。 以下の例は、`upload-artifact`アクションを使ってテスト結果をアップロードする方法を示しています。

For more information, see "[Storing workflow data as artifacts](/actions/using-workflows/storing-workflow-data-as-artifacts)."

```yaml{:copy}
name: Upload Go test results

on: [push]

jobs:
build:

runs-on: ubuntu-latest
strategy:
matrix:
go-version: [ '1.14', '1.15', '1.16.x' ]

steps:
- uses: {% data reusables.actions.action-checkout %}
- name: Setup Go
uses: {% data reusables.actions.action-setup-go %}
with:
go-version: {% raw %}${{ matrix.go-version }}{% endraw %}
- name: Install dependencies
run: go get .
- name: Test with Go
run: go test -json > TestResults-{% raw %}${{ matrix.go-version }}{% endraw %}.json
- name: Upload Go test results
uses: {% data reusables.actions.action-upload-artifact %}
with:
name: Go-results-{% raw %}${{ matrix.go-version }}{% endraw %}
path: TestResults-{% raw %}${{ matrix.go-version }}{% endraw %}.json
```
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.6", "3.7", "3.8", "3.9"]
python-version: ["3.7", "3.8", "3.9", "3.10"]

steps:
- uses: {% data reusables.actions.action-checkout %}
Expand Down Expand Up @@ -114,7 +114,7 @@ jobs:
# python-version内のPyPyのバージョンが利用できる。
# For example, {% ifversion actions-node16-action %}pypy-2.7 and pypy-3.8{% else %}pypy2 and pypy3{% endif %}
matrix:
python-version: ["2.7", "3.6", "3.7", "3.8", "3.9"]
python-version: ["2.7", "3.7", "3.8", "3.9", "3.10"]

steps:
- uses: {% data reusables.actions.action-checkout %}
Expand All @@ -129,7 +129,7 @@ jobs:

###  特定のバージョンのPythonの利用

Pythonの特定バージョンを設定することができます。 たとえば3.8が利用できます。 あるいは、最新のマイナーリリースを取得するためにセマンティックバージョン構文を使うこともできます。 以下の例では、Python 3の最新のマイナーリリースを使います。
Pythonの特定バージョンを設定することができます。 For example, 3.9. あるいは、最新のマイナーリリースを取得するためにセマンティックバージョン構文を使うこともできます。 以下の例では、Python 3の最新のマイナーリリースを使います。

```yaml{:copy}
name: Python package
Expand Down Expand Up @@ -173,12 +173,12 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.6", "3.7", "3.8", "3.9", {% ifversion actions-node16-action %}pypy-2.7, pypy-3.8{% else %}pypy2, pypy3{% endif %}]
python-version: ["3.7", "3.8", "3.9", "3.10", {% ifversion actions-node16-action %}pypy-2.7, pypy-3.8{% else %}pypy2, pypy3{% endif %}]
exclude:
- os: macos-latest
python-version: "3.6"
python-version: "3.7"
- os: windows-latest
python-version: "3.6"
python-version: "3.7"
```

### デフォルトバージョンのPythonの利用
Expand Down Expand Up @@ -238,7 +238,7 @@ steps:
- uses: {% data reusables.actions.action-checkout %}
- uses: {% data reusables.actions.action-setup-python %}
with:
python-version: '3.9'
python-version: '3.10'
cache: 'pip'
- run: pip install -r requirements.txt
- run: pip test
Expand Down Expand Up @@ -315,7 +315,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python: ["3.7", "3.8", "3.9"]
python: ["3.8", "3.9", "3.10"]

steps:
- uses: {% data reusables.actions.action-checkout %}
Expand Down Expand Up @@ -347,7 +347,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.6", "3.7", "3.8", "3.9"]
python-version: ["3.7", "3.8", "3.9", "3.10"]

steps:
- uses: {% data reusables.actions.action-checkout %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ redirect_from:
- /actions/automating-builds-and-tests/building-and-testing-nodejs-or-python
children:
- /about-continuous-integration
- /building-and-testing-go
- /building-and-testing-java-with-ant
- /building-and-testing-java-with-gradle
- /building-and-testing-java-with-maven
Expand Down
Loading