You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/actions/automating-builds-and-tests/building-and-testing-go.md
+52-28Lines changed: 52 additions & 28 deletions
Original file line number
Diff line number
Diff line change
@@ -29,35 +29,59 @@ You should already be familiar with YAML syntax and how it's used with {% data v
29
29
30
30
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).
31
31
32
-
## Using the Go starter workflow
32
+
## Using a Go starter workflow
33
33
34
-
{% data variables.product.prodname_dotcom %} provides a Go starterworkflow 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).
34
+
{% data reusables.actions.starter-workflow-get-started %}
35
35
36
-
To get started quickly, add the starter workflow to the `.github/workflows` directory of your repository.
36
+
{% data variables.product.prodname_dotcom %} provides a Go starter workflow that should work for most Go projects. The subsequent sections of this guide give examples of how you can customize this starter workflow.
37
37
38
-
```yaml copy
39
-
name: Go package
38
+
{% data reusables.repositories.navigate-to-repo %}
39
+
{% data reusables.repositories.actions-tab %}
40
+
{% data reusables.actions.new-starter-workflow %}
41
+
1. The "{% ifversion actions-starter-template-ui %}Choose a workflow{% else %}Choose a workflow template{% endif %}" page shows a selection of recommended starter workflows. Search for "go".
42
+
1. Filter the selection of workflows by clicking **Continuous integration**.
43
+
1. On the "Go - by {% data variables.product.prodname_actions %}" workflow, click {% ifversion actions-starter-template-ui %}**Configure**{% else %}**Set up this workflow**{% endif %}.
40
44
41
-
on: [push]
45
+

42
46
43
-
jobs:
44
-
build:
47
+
{%- ifversion ghes or ghae %}
48
+
If you don't find the "Go - by {% data variables.product.prodname_actions %}" starter workflow, copy the following workflow code to a new file called `go.yml` in the `.github/workflows` directory of your repository.
45
49
46
-
runs-on: ubuntu-latest
47
-
steps:
48
-
- uses: {% data reusables.actions.action-checkout %}
50
+
```yaml copy
51
+
name: Go
49
52
50
-
- name: Set up Go
51
-
uses: {% data reusables.actions.action-setup-go %}
52
-
with:
53
-
go-version: '1.15'
53
+
on:
54
+
push:
55
+
branches: [ "main" ]
56
+
pull_request:
57
+
branches: [ "main" ]
54
58
55
-
- name: Build
56
-
run: go build -v ./...
59
+
jobs:
60
+
build:
57
61
58
-
- name: Test
59
-
run: go test -v ./...
60
-
```
62
+
runs-on: self-hosted
63
+
steps:
64
+
- uses: {% data reusables.actions.action-checkout %}
65
+
66
+
- name: Set up Go
67
+
uses: {% data reusables.actions.action-setup-go %}
68
+
with:
69
+
go-version: '1.20'
70
+
71
+
- name: Build
72
+
run: go build -v ./...
73
+
74
+
- name: Test
75
+
run: go test -v ./...
76
+
```
77
+
{%- endif %}
78
+
79
+
1. Edit the workflow as required. For example, change the version of Go.
80
+
1. Click **Commit changes**.
81
+
82
+
{% ifversion fpt or ghec %}
83
+
The `go.yml` workflow file is added to the `.github/workflows` directory of your repository.
84
+
{% endif %}
61
85
62
86
## Specifying a Go version
63
87
@@ -80,7 +104,7 @@ jobs:
80
104
runs-on: ubuntu-latest
81
105
strategy:
82
106
matrix:
83
-
go-version: [ '1.14', '1.15', '1.16.x' ]
107
+
go-version: [ '1.19', '1.20', '1.21.x' ]
84
108
85
109
steps:
86
110
- uses: {% data reusables.actions.action-checkout %}
@@ -95,14 +119,14 @@ jobs:
95
119
96
120
### Using a specific Go version
97
121
98
-
You can configure your job to use a specific version of Go, such as `1.16.2`. Alternatively, you can use semantic version syntax to get the latest minor release. This example uses the latest patch release of Go 1.16:
122
+
You can configure your job to use a specific version of Go, such as `1.20.8`. Alternatively, you can use semantic version syntax to get the latest minor release. This example uses the latest patch release of Go 1.21:
99
123
100
124
```yaml copy
101
-
- name: Setup Go 1.16.x
125
+
- name: Setup Go 1.21.x
102
126
uses: {% data reusables.actions.action-setup-go %}
103
127
with:
104
128
# Semantic version range syntax or exact version of Go
105
-
go-version: '1.16.x'
129
+
go-version: '1.21.x'
106
130
```
107
131
108
132
## Installing dependencies
@@ -115,7 +139,7 @@ You can use `go get` to install dependencies:
115
139
- name: Setup Go
116
140
uses: {% data reusables.actions.action-setup-go %}
117
141
with:
118
-
go-version: '1.16.x'
142
+
go-version: '1.21.x'
119
143
- name: Install dependencies
120
144
run: |
121
145
go get .
@@ -150,7 +174,7 @@ When caching is enabled, the `setup-go` action searches for the dependency file,
150
174
- name: Setup Go
151
175
uses: {% data reusables.actions.action-setup-go %}
152
176
with:
153
-
go-version: '1.16.x'
177
+
go-version: '1.21.x'
154
178
cache: true
155
179
```
156
180
@@ -187,7 +211,7 @@ jobs:
187
211
- name: Setup Go
188
212
uses: {% data reusables.actions.action-setup-go %}
189
213
with:
190
-
go-version: '1.16.x'
214
+
go-version: '1.21.x'
191
215
- name: Install dependencies
192
216
run: go get .
193
217
- name: Build
@@ -213,7 +237,7 @@ jobs:
213
237
runs-on: ubuntu-latest
214
238
strategy:
215
239
matrix:
216
-
go-version: [ '1.14', '1.15', '1.16.x' ]
240
+
go-version: [ '1.19', '1.20', '1.21.x' ]
217
241
218
242
steps:
219
243
- uses: {% data reusables.actions.action-checkout %}
Copy file name to clipboardExpand all lines: content/actions/automating-builds-and-tests/building-and-testing-java-with-ant.md
+47-34Lines changed: 47 additions & 34 deletions
Original file line number
Diff line number
Diff line change
@@ -15,7 +15,6 @@ topics:
15
15
- Java
16
16
- Ant
17
17
shortTitle: Build & test Java & Ant
18
-
layout: inline
19
18
---
20
19
21
20
{% data reusables.actions.enterprise-github-hosted-runners %}
@@ -40,39 +39,53 @@ We recommend that you have a basic understanding of Java and the Ant framework.
40
39
41
40
{% data reusables.actions.enterprise-setup-prereq %}
42
41
43
-
## Using the Ant starter workflow
44
-
45
-
{% data variables.product.prodname_dotcom %} provides an Ant starter workflow that will work for most Ant-based Java projects. For more information, see the [Ant starter workflow](https://github.com/actions/starter-workflows/blob/main/ci/ant.yml). {% data reusables.actions.workflows.starter-workflows %}
46
-
47
-
To get started quickly, you can choose the preconfigured Ant starter workflow when you create a new workflow. For more information, see the "[AUTOTITLE](/actions/quickstart)."
48
-
49
-
You can also add this workflow manually by creating a new file in the `.github/workflows` directory of your repository.
50
-
51
-
```yaml annotate copy
52
-
# {% data reusables.actions.workflows.workflow-syntax-name %}
53
-
name: Java CI
54
-
55
-
#
56
-
on: [push]
57
-
#
58
-
jobs:
59
-
build:
60
-
{% data reusables.actions.example-github-runner-comment %}
61
-
runs-on: ubuntu-latest
62
-
#
63
-
steps:
64
-
{% data reusables.actions.workflows.workflow-checkout-step-explainer %}
65
-
- uses: {% data reusables.actions.action-checkout %}
66
-
{% data reusables.actions.workflows.setup-java-step-explainer %}
67
-
- name: Set up JDK 17
68
-
uses: {% data reusables.actions.action-setup-java %}
69
-
with:
70
-
java-version: '17'
71
-
distribution: 'temurin'
72
-
# This step runs the default target in your `build.xml` file in non-interactive mode.
73
-
- name: Build with Ant
74
-
run: ant -noinput -buildfile build.xml
75
-
```
42
+
## Using an Ant starter workflow
43
+
44
+
{% data reusables.actions.starter-workflow-get-started %}
45
+
46
+
{% data variables.product.prodname_dotcom %} provides a starter workflow for Ant that should work for most Java with Ant projects. The subsequent sections of this guide give examples of how you can customize this starter workflow.
47
+
48
+
{% data reusables.repositories.navigate-to-repo %}
49
+
{% data reusables.repositories.actions-tab %}
50
+
{% data reusables.actions.new-starter-workflow %}
51
+
1. The "{% ifversion actions-starter-template-ui %}Choose a workflow{% else %}Choose a workflow template{% endif %}" page shows a selection of recommended starter workflows. Search for "Java with Ant".
52
+
1. On the "Java with Ant" workflow, click {% ifversion actions-starter-template-ui %}**Configure**{% else %}**Set up this workflow**{% endif %}.
53
+
54
+
{%- ifversion ghes or ghae %}
55
+
56
+
If you don't find the "Java with Ant" starter workflow, copy the following workflow code to a new file called `ant.yml` in the `.github/workflows` directory of your repository.
57
+
58
+
```yaml copy
59
+
name: Java CI
60
+
61
+
on:
62
+
push:
63
+
branches: [ $default-branch ]
64
+
pull_request:
65
+
branches: [ $default-branch ]
66
+
67
+
jobs:
68
+
build:
69
+
runs-on: ubuntu-latest
70
+
71
+
steps:
72
+
- uses: {% data reusables.actions.action-checkout %}
73
+
- name: Set up JDK 11
74
+
uses: {% data reusables.actions.action-setup-java %}
75
+
with:
76
+
java-version: '11'
77
+
distribution: 'temurin'
78
+
- name: Build with Ant
79
+
run: ant -noinput -buildfile build.xml
80
+
```
81
+
{%- endif %}
82
+
83
+
1. Edit the workflow as required. For example, change the Java version.
84
+
1. Click **Commit changes**.
85
+
86
+
{% ifversion fpt or ghec %}
87
+
The `ant.yml` workflow file is added to the `.github/workflows` directory of your repository.
88
+
{% endif %}
76
89
77
90
{% data reusables.actions.java-jvm-architecture %}
Copy file name to clipboardExpand all lines: content/actions/automating-builds-and-tests/building-and-testing-java-with-gradle.md
+55-49Lines changed: 55 additions & 49 deletions
Original file line number
Diff line number
Diff line change
@@ -15,7 +15,6 @@ topics:
15
15
- Java
16
16
- Gradle
17
17
shortTitle: Build & test Java & Gradle
18
-
layout: inline
19
18
---
20
19
21
20
{% data reusables.actions.enterprise-github-hosted-runners %}
@@ -40,54 +39,61 @@ We recommend that you have a basic understanding of Java and the Gradle framewor
40
39
41
40
{% data reusables.actions.enterprise-setup-prereq %}
42
41
43
-
## Using the Gradle starter workflow
44
-
45
-
{% data variables.product.prodname_dotcom %} provides a Gradle starter workflow that will work for most Gradle-based Java projects. For more information, see the [Gradle starter workflow](https://github.com/actions/starter-workflows/blob/main/ci/gradle.yml). {% data reusables.actions.workflows.starter-workflows %}
46
-
47
-
To get started quickly, you can choose the preconfigured Gradle starter workflow when you create a new workflow. For more information, see the "[AUTOTITLE](/actions/quickstart)."
48
-
49
-
You can also add this workflow manually by creating a new file in the `.github/workflows` directory of your repository.
50
-
51
-
{% note %}
52
-
53
-
**Notes:**
54
-
55
-
- {% data reusables.actions.actions-not-certified-by-github %}
56
-
- {% data reusables.actions.actions-use-sha-pinning %}
57
-
58
-
{% endnote %}
59
-
60
-
```yaml annotate copy
61
-
# {% data reusables.actions.workflows.workflow-syntax-name %}
62
-
name: Java CI
63
-
64
-
#
65
-
on: [push]
66
-
#
67
-
jobs:
68
-
build:
69
-
70
-
{% data reusables.actions.example-github-runner-comment %}
71
-
runs-on: ubuntu-latest
72
-
#
73
-
steps:
74
-
{% data reusables.actions.workflows.workflow-checkout-step-explainer %}
75
-
- uses: {% data reusables.actions.action-checkout %}
76
-
{% data reusables.actions.workflows.setup-java-step-explainer %}
77
-
- name: Set up JDK 17
78
-
uses: {% data reusables.actions.action-setup-java %}
79
-
with:
80
-
java-version: '17'
81
-
distribution: 'temurin'
82
-
# The "Validate Gradle wrapper" step validates the checksums of Gradle Wrapper JAR files present in the source tree.
# The "Build with Gradle" step does a build using the `gradle/gradle-build-action` action provided by the Gradle organization on {% data variables.product.prodname_dotcom %}. The action takes care of invoking Gradle, collecting results, and caching state between jobs. For more information see [`gradle/gradle-build-action`](https://github.com/gradle/gradle-build-action).
{% data reusables.actions.starter-workflow-get-started %}
45
+
46
+
{% data variables.product.prodname_dotcom %} provides a starter workflow for Gradle that should work for most Java with Gradle projects. The subsequent sections of this guide give examples of how you can customize this starter workflow.
47
+
48
+
{% data reusables.repositories.navigate-to-repo %}
49
+
{% data reusables.repositories.actions-tab %}
50
+
{% data reusables.actions.new-starter-workflow %}
51
+
1. The "{% ifversion actions-starter-template-ui %}Choose a workflow{% else %}Choose a workflow template{% endif %}" page shows a selection of recommended starter workflows. Search for "Java with Gradle".
52
+
1. On the "Java with Gradle" workflow, click {% ifversion actions-starter-template-ui %}**Configure**{% else %}**Set up this workflow**{% endif %}.
53
+
54
+
{%- ifversion ghes or ghae %}
55
+
56
+
If you don't find the "Java with Gradle" starter workflow, copy the following workflow code to a new file called `gradle.yml` in the `.github/workflows` directory of your repository.
57
+
58
+
```yaml copy
59
+
name: Java CI with Gradle
60
+
61
+
on:
62
+
push:
63
+
branches: [ "main" ]
64
+
pull_request:
65
+
branches: [ "main" ]
66
+
67
+
permissions:
68
+
contents: read
69
+
70
+
jobs:
71
+
build:
72
+
runs-on: ubuntu-latest
73
+
74
+
steps:
75
+
- uses: {% data reusables.actions.action-checkout %}
76
+
- name: Set up JDK 11
77
+
uses: {% data reusables.actions.action-setup-java %}
0 commit comments