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

Remove building from running time #4

Closed
krzema12 opened this issue Jun 21, 2022 · 2 comments
Closed

Remove building from running time #4

krzema12 opened this issue Jun 21, 2022 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@krzema12
Copy link
Member

krzema12 commented Jun 21, 2022

Goals:

  1. Save ~2 minutes of actions' running time (from user's perspective). Now the image is built every time the action is used:
    FROM gradle:8.4.0-jdk17 AS build
    COPY --chown=gradle:gradle . /src
    WORKDIR /src
    RUN gradle build --no-daemon
    RUN rm -rf dist
    RUN unzip build/distributions/github-actions-typing.zip -d dist
  2. Eliminate risk of failures during image building in actions' runtime, like:
  * What went wrong:
  Error resolving plugin [id: 'org.jetbrains.kotlin.jvm', version: '1.7.0']
  > Could not resolve all dependencies for configuration 'detachedConfiguration1'.
     > Could not determine artifacts for org.jetbrains.kotlin.jvm:org.jetbrains.kotlin.jvm.gradle.plugin:1.7.0
        > Could not get resource 'https://plugins.gradle.org/m2/org/jetbrains/kotlin/jvm/org.jetbrains.kotlin.jvm.gradle.plugin/1.7.0/org.jetbrains.kotlin.jvm.gradle.plugin-1.7.0.jar'.
           > Could not HEAD 'https://plugins.gradle.org/m2/org/jetbrains/kotlin/jvm/org.jetbrains.kotlin.jvm.gradle.plugin/1.7.0/org.jetbrains.kotlin.jvm.gradle.plugin-1.7.0.jar'.
              > Read timed out

The biggest challenge will be to ensure that if the user uses this action in a certain version/commit hash/branch, then the right Docker image is used.

@krzema12
Copy link
Member Author

Idea: keep compiled JARs in the source code. Not perfect, but pragmatic. It's a frequent practice in TS-based actions. See the template: https://github.com/actions/typescript-action/tree/main/dist

In CI, validate that given source code produces given JARs. May be tedious when it comes to updating the deps, but let's see.

@krzema12 krzema12 changed the title Prebuild the Docker image Remove building from running time Nov 26, 2023
@krzema12 krzema12 self-assigned this Nov 26, 2023
@krzema12 krzema12 added the enhancement New feature or request label Nov 26, 2023
@krzema12
Copy link
Member Author

How to check in CI that something changed or was added and is untracked by git:

git add .
git diff --cached --exit-code
echo $?

krzema12 added a commit that referenced this issue Nov 28, 2023
Part of #4.

Thanks to this, the users don't need to wait for the project to build with Gradle,
which took around 1-2 minutes. Now it takes a few seconds to build the Docker image,
and under 1 second to run the action itself.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant