Skip to content

Commit

Permalink
Version actions for GHES, use reusables (github#26004)
Browse files Browse the repository at this point in the history
Co-authored-by: Kevin Heis <[email protected]>
Co-authored-by: Sarah Edwards <[email protected]>
  • Loading branch information
3 people authored Mar 31, 2022
1 parent 593be2d commit b49c768
Show file tree
Hide file tree
Showing 93 changed files with 624 additions and 729 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -242,9 +242,9 @@ const article: PlaygroundArticleT = {
node-version: [10.x, 12.x, 14.x, 15.x]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Use Node.js \${{ matrix.node-version }}
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: \${{ matrix.node-version }}
- name: Install dependencies
Expand Down Expand Up @@ -275,9 +275,9 @@ const article: PlaygroundArticleT = {
node-version: [8.16.2, 10.17.0]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Use Node.js \${{ matrix.node-version }}
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: \${{ matrix.node-version }}
- name: Install dependencies
Expand All @@ -304,9 +304,9 @@ const article: PlaygroundArticleT = {
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Use Node.js
uses: actions/setup-node@v1
uses: actions/setup-node@v3
with:
node-version: '12.x'
- name: Install dependencies
Expand All @@ -333,9 +333,9 @@ const article: PlaygroundArticleT = {
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Use Node.js
uses: actions/setup-node@v1
uses: actions/setup-node@v3
with:
node-version: '12.x'
- name: Install dependencies
Expand All @@ -362,9 +362,9 @@ const article: PlaygroundArticleT = {
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Use Node.js
uses: actions/setup-node@v1
uses: actions/setup-node@v3
with:
node-version: '12.x'
- name: Install dependencies
Expand All @@ -391,9 +391,9 @@ const article: PlaygroundArticleT = {
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Use Node.js
uses: actions/setup-node@v1
uses: actions/setup-node@v3
with:
node-version: '12.x'
- name: Install dependencies
Expand All @@ -420,9 +420,9 @@ const article: PlaygroundArticleT = {
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Use Node.js
uses: actions/setup-node@v1
uses: actions/setup-node@v3
with:
node-version: '12.x'
- name: Install dependencies
Expand Down Expand Up @@ -450,9 +450,9 @@ const article: PlaygroundArticleT = {
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Use Node.js
uses: actions/setup-node@v1
uses: actions/setup-node@v3
with:
always-auth: true
node-version: '12.x'
Expand Down Expand Up @@ -492,9 +492,9 @@ const article: PlaygroundArticleT = {
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Use Node.js
uses: actions/setup-node@v1
uses: actions/setup-node@v3
with:
node-version: '12.x'
cache: 'npm'
Expand All @@ -520,9 +520,9 @@ const article: PlaygroundArticleT = {
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Use Node.js
uses: actions/setup-node@v1
uses: actions/setup-node@v3
with:
node-version: '12.x'
- run: npm install
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,9 +228,9 @@ const article: PlaygroundArticleT = {
python-version: ["3.6", "3.7", "3.8", "3.9"]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Python \${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v3
with:
python-version: \${{ matrix.python-version }}
- name: Install dependencies
Expand Down Expand Up @@ -268,9 +268,9 @@ const article: PlaygroundArticleT = {
python-version: ["2.7", "3.6", "3.7", "3.8", "3.9"]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Python \${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v3
with:
python-version: \${{ matrix.python-version }}
# You can test your matrix by printing the current Python version
Expand All @@ -292,9 +292,9 @@ const article: PlaygroundArticleT = {
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Python 3.x
uses: actions/setup-python@v2
uses: actions/setup-python@v3
with:
# Semantic version range syntax or exact version of a Python version
python-version: '3.x'
Expand Down Expand Up @@ -341,9 +341,9 @@ const article: PlaygroundArticleT = {
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v3
with:
python-version: '3.x'
- name: Install dependencies
Expand All @@ -363,9 +363,9 @@ const article: PlaygroundArticleT = {
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v3
with:
python-version: '3.x'
- name: Install dependencies
Expand All @@ -387,9 +387,9 @@ const article: PlaygroundArticleT = {
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v2
uses: actions/setup-python@v3
with:
python-version: '3.x'
cache: 'pip'
Expand All @@ -410,9 +410,9 @@ const article: PlaygroundArticleT = {
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v3
with:
python-version: '3.x'
- name: Install dependencies
Expand All @@ -439,9 +439,9 @@ const article: PlaygroundArticleT = {
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v3
with:
python-version: '3.x'
- name: Install dependencies
Expand Down Expand Up @@ -471,9 +471,9 @@ const article: PlaygroundArticleT = {
python: ["3.7", "3.8", "3.9"]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v2
uses: actions/setup-python@v3
with:
python-version: \${{ matrix.python }}
- name: Install Tox and any other packages
Expand All @@ -500,9 +500,9 @@ const article: PlaygroundArticleT = {
python-version: ["3.6", "3.7", "3.8", "3.9"]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Setup Python # Set Python version
uses: actions/setup-python@v2
uses: actions/setup-python@v3
with:
python-version: \${{ matrix.python-version }}
# Install pip and pytest
Expand Down Expand Up @@ -540,9 +540,9 @@ const article: PlaygroundArticleT = {
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v3
with:
python-version: '3.x'
- name: Install dependencies
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ To get started quickly, you can choose the preconfigured Ant starter workflow wh

You can also add this workflow manually by creating a new file in the `.github/workflows` directory of your repository.

{% raw %}
```yaml{:copy}
name: Java CI
Expand All @@ -59,16 +58,15 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: {% data reusables.actions.action-checkout %}
- name: Set up JDK 11
uses: actions/setup-java@v2
uses: {% data reusables.actions.action-setup-java %}
with:
java-version: '11'
distribution: 'adopt'
- name: Build with Ant
run: ant -noinput -buildfile build.xml
```
{% endraw %}

This workflow performs the following steps:

Expand All @@ -90,38 +88,34 @@ The starter workflow will run the default target specified in your _build.xml_ f

If you use different commands to build your project, or you want to run a different target, you can specify those. For example, you may want to run the `jar` target that's configured in your `_build-ci.xml_` file.

{% raw %}
```yaml{:copy}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v2
- uses: {% data reusables.actions.action-checkout %}
- uses: {% data reusables.actions.action-setup-java %}
with:
java-version: '11'
distribution: 'adopt'
- name: Run the Ant jar target
run: ant -noinput -buildfile build-ci.xml jar
```
{% endraw %}

## Packaging workflow data as artifacts

After your build has succeeded and your tests have passed, you may want to upload the resulting Java packages as a build artifact. This will store the built packages as part of the workflow run, and allow you to download them. Artifacts can help you test and debug pull requests in your local environment before they're merged. For more information, see "[Persisting workflow data using artifacts](/actions/automating-your-workflow-with-github-actions/persisting-workflow-data-using-artifacts)."

Ant will usually create output files like JARs, EARs, or WARs in the `build/jar` directory. You can upload the contents of that directory using the `upload-artifact` action.

{% raw %}
```yaml{:copy}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v2
- uses: {% data reusables.actions.action-checkout %}
- uses: {% data reusables.actions.action-setup-java %}
with:
java-version: '11'
distribution: 'adopt'
- run: ant -noinput -buildfile build.xml
- uses: actions/upload-artifact@v3
- uses: {% data reusables.actions.action-upload-artifact %}
with:
name: Package
path: build/jar
```
{% endraw %}
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: {% data reusables.actions.action-checkout %}
- name: Set up JDK 11
uses: actions/setup-java@v2
uses: {% data reusables.actions.action-setup-java %}
with:
java-version: '11'
distribution: 'adopt'
Expand Down Expand Up @@ -95,11 +95,10 @@ The starter workflow will run the `build` task by default. In the default Gradle

If you use different commands to build your project, or you want to use a different task, you can specify those. For example, you may want to run the `package` task that's configured in your _ci.gradle_ file.

{% raw %}
```yaml{:copy}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v2
- uses: {% data reusables.actions.action-checkout %}
- uses: {% data reusables.actions.action-setup-java %}
with:
java-version: '11'
distribution: 'adopt'
Expand All @@ -110,7 +109,6 @@ steps:
with:
arguments: -b ci.gradle package
```
{% endraw %}

## Caching dependencies

Expand All @@ -124,11 +122,10 @@ After your build has succeeded and your tests have passed, you may want to uploa

Gradle will usually create output files like JARs, EARs, or WARs in the `build/libs` directory. You can upload the contents of that directory using the `upload-artifact` action.

{% raw %}
```yaml{:copy}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v2
- uses: {% data reusables.actions.action-checkout %}
- uses: {% data reusables.actions.action-setup-java %}
with:
java-version: '11'
distribution: 'adopt'
Expand All @@ -138,9 +135,8 @@ steps:
uses: gradle/gradle-build-action@937999e9cc2425eddc7fd62d1053baf041147db7
with:
arguments: build
- uses: actions/upload-artifact@v3
- uses: {% data reusables.actions.action-upload-artifact %}
with:
name: Package
path: build/libs
```
{% endraw %}
Loading

0 comments on commit b49c768

Please sign in to comment.