Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix CI after GHA's drop of node16 actions #2338

Merged
merged 3 commits into from
Dec 2, 2024
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
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
distribution: "temurin"

- name: Set up Gradle
uses: gradle/actions/setup-gradle@v3
uses: gradle/actions/setup-gradle@v4

- name: Run unit tests
env:
Expand Down Expand Up @@ -66,7 +66,7 @@ jobs:
distribution: "temurin"

- name: Set up Gradle
uses: gradle/actions/setup-gradle@v3
uses: gradle/actions/setup-gradle@v4

- name: Start containerized server and dependencies
run: |
Expand Down Expand Up @@ -113,7 +113,7 @@ jobs:
distribution: "temurin"

- name: Set up Gradle
uses: gradle/actions/setup-gradle@v3
uses: gradle/actions/setup-gradle@v4

- name: Run cloud test
# Only supported in non-fork runs, since secrets are not available in forks. We intentionally
Expand Down Expand Up @@ -152,7 +152,7 @@ jobs:
distribution: "temurin"

- name: Set up Gradle
uses: gradle/actions/setup-gradle@v3
uses: gradle/actions/setup-gradle@v4

- name: Run copyright and code format checks
run: ./gradlew --no-daemon checkLicenseMain checkLicenses spotlessCheck
2 changes: 1 addition & 1 deletion .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
distribution: 'temurin'

- name: Set up Gradle
uses: gradle/actions/setup-gradle@v3
uses: gradle/actions/setup-gradle@v4

- name: Run Tests
run: ./gradlew test -x checkLicenseMain -x checkLicenses -x spotlessCheck -x spotlessApply -Pjacoco
Expand Down
47 changes: 24 additions & 23 deletions .github/workflows/prepare-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ jobs:
distribution: "temurin"

- name: Set up Gradle
uses: gradle/actions/setup-gradle@v3
uses: gradle/actions/setup-gradle@v4
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are other places we use gradle/actions/setup-gradle@v3. Should update those too.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done


- name: Set up signing key
run: mkdir -p "$HOME/.gnupg" && echo -n "$KEY" | base64 -d > "$HOME/.gnupg/secring.gpg"
Expand Down Expand Up @@ -128,7 +128,7 @@ jobs:
fail-fast: false
matrix:
include:
- runner: buildjet-2vcpu-ubuntu-1804
- runner: ubuntu-latest
os_family: linux
arch: amd64
- runner: macos-13
Expand All @@ -138,43 +138,45 @@ jobs:
os_family: windows
arch: amd64
runs-on: ${{ matrix.runner }}
env:
# This is required to allow continuing usage of Node 16 for actions,
# as Node 20 won't run on the builder we use for linux builds
# (Node 20 require glibc 2.28+, but ubuntu-1804 has glibc 2.27).
# https://github.blog/changelog/2024-05-17-updated-dates-for-actions-runner-using-node20-instead-of-node16-by-default/
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true
steps:
- name: Checkout repo
# FIXME: v4+ requires Node 20
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
submodules: recursive
ref: ${{ env.INPUT_REF }}

# See comment on temporary tag above. tldr: this is a local tag; never
# gets pushed
- name: Temporary tag
run: git tag "$INPUT_TAG"

- name: Set up Java
# FIXME: v4+ requires Node 20
uses: actions/setup-java@v3
if: matrix.os_family != 'Linux'
uses: actions/setup-java@v4
with:
java-version: "11"
distribution: "temurin"

- name: Set up Gradle
# FIXME: v3+ requires Node 20
uses: gradle/gradle-build-action@v2

- name: Build native test server
run: ./gradlew :temporal-test-server:build
if: matrix.os_family != 'Linux'
uses: gradle/actions/setup-gradle@v4

- name: Build native test server (non-Docker)
if: matrix.os_family != 'Linux'
run: |
./gradlew :temporal-test-server:build

- name: Build native test server (Docker)
if: matrix.os_family == 'Linux'
run: |
docker run \
--rm -w /github/workspace -v "$(pwd):/github/workspace" \
$(docker build -q ./docker/native-image) \
sh -c "./gradlew :temporal-test-server:build"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that you moved installation stuff to a docker image, you probably no longer need the sh -c and quotes.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, fixed

# path ends in a wildcard because on windows the file ends in '.exe'
# path excludes *.txt because native-image also writes a build manifest txt file
- name: Upload executable to workflow
# FIXME: v4+ requires Node 20
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.os_family }}_${{ matrix.arch }}
path: |
Expand All @@ -185,16 +187,15 @@ jobs:

attach_to_release:
name: Attach native executables to release
needs: build_native_images
needs: [build_native_images, create_draft_release]
runs-on: ubuntu-latest
steps:
- name: Audit gh version
run: gh --version

# when no artifact is specified, all artifacts are downloaded and expanded into CWD
- name: Fetch executables
# Need v3 here to stay compatible with the build_native_images job.
uses: actions/download-artifact@v3-node20
uses: actions/download-artifact@v4

# example: linux_amd64/ -> temporal-test-server_1.2.3_linux_amd64
# the name of the directory created becomes the basename of the archive (*.tar.gz or *.zip) and
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-snapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
distribution: 'temurin'

- name: Set up Gradle
uses: gradle/actions/setup-gradle@v3
uses: gradle/actions/setup-gradle@v4

# Prefer env variables here rather than inline ${{ secrets.FOO }} to
# decrease the likelihood that secrets end up printed to stdout.
Expand Down
10 changes: 10 additions & 0 deletions docker/native-image/dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Use an old version of Ubuntu to build the test server to maintain compatibility with
# older versions of glibc, specifically glib 2.17.
FROM ubuntu:18.04
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be pertinent to add some comments in this docker file explaining to outside readers why we are using an old distro.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a comment

ENV JAVA_HOME=/opt/java/openjdk
COPY --from=eclipse-temurin:21 $JAVA_HOME $JAVA_HOME
ENV PATH="${JAVA_HOME}/bin:${PATH}"
RUN apt-get update
RUN apt-get install -y git build-essential zlib1g-dev
# Avoid errors like: "fatal: detected dubious ownership in repository"
RUN git config --global --add safe.directory '*'
Loading