Skip to content

Conversation

ncsokas
Copy link

@ncsokas ncsokas commented Jul 7, 2025

This pull request updates the labs/storing-artifacts.md file to introduce an extra exercise to reorganize the workflow for better efficiency and alignment with best practices. The changes include breaking the workflow into dedicated jobs (build, test, and lint), optimizing artifact usage, and improving parallelism.

Enhancements to the tutorial:

  • Added an "Extra Exercise" section to guide users on reorganizing their workflows into three dedicated jobs: build, test, and lint. This includes separating responsibilities and improving efficiency.

Workflow improvements:

  • Updated the Build job to upload only the necessary build artifact instead of the entire source code.
  • Added a new Test job that runs after the Build job, downloads the build artifact, and executes unit tests against it.
  • Modified the Linting job to run in parallel by removing the dependency on the Build job and replacing the artifact download step with a repository checkout step.

@ncsokas ncsokas requested review from moller2866 and amrutashety July 7, 2025 18:30
Copy link

@moller2866 moller2866 left a comment

Choose a reason for hiding this comment

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

LGTM! And as you said so yourself @ncsokas , we might have to look at the other exercises to align with the best practice structure.

But lets wait with the merge until the rest of the exercises is updated 😄

Copy link
Contributor

@michaelin michaelin left a comment

Choose a reason for hiding this comment

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

While I think this PR is good improvement and should be kept for now, it seems like something that should have been a basic premise for the whole exercise. I think the exercise should be re-written so that it revolves around extracting the unit-test step into its own job. The linting may be added as a bonus exercise if necessary, but seems like it should be it's own, unrelated exercise.

If we keep the linting, we should consider configuring it to run only the necessary linters instead of simply disabling errors. It can be configured with VALIDATE_[LANGUAGE] variables.


## Extra Exercise: Reorganizing Your Workflow

However, while the current setup is a great start for understanding artifacts, but we can make it more efficient and align it with best practices.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
However, while the current setup is a great start for understanding artifacts, but we can make it more efficient and align it with best practices.
While the current workflow is a great start for understanding artifacts, we can make it more efficient and align it with best practices.


Now, create a completely new job for testing. This job will run after the `Build` job is finished and will test the artifact that was created.

Add a new job named `Test`.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Add a new job named `Test`.
Add a new job named `Test` that will be executed inside a `gradle:6-jdk11` `container` which in turn `runs-on` an `ubuntu-latest` agent

Comment on lines +256 to +259
with:
name: code
path: .
include-hidden-files: true
Copy link
Contributor

Choose a reason for hiding this comment

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

include-hidden-files is only valid for the upload action

Suggested change
with:
name: code
path: .
include-hidden-files: true
with:
name: code
path: .

Comment on lines +260 to +262

- name: Run unit tests
run: ci/unit-test-app.sh
Copy link
Contributor

Choose a reason for hiding this comment

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

File permissions are not preserved when uploaded. The script will have to be made executable in order to run. This needs to be reflected in the exercise steps as well.

Suggested change
- name: Run unit tests
run: ci/unit-test-app.sh
- name: Ensure unit test script is executable
run: chmod +x ci/unit-test-app.sh
- name: Run unit tests
run: ci/unit-test-app.sh

Copy link
Contributor

@michaelin michaelin left a comment

Choose a reason for hiding this comment

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

The docker-images exercise makes use of the code artifact. If the extra assignment is completed in storing-artifacts, the code artifact is no longer available, and the exercise will fail. Rewriting the `docker-images´ to take this into account should be part of this PR.

Comment on lines +225 to +230
- name: Upload build artifact
uses: actions/upload-artifact@v4
with:
name: code
path: .
include-hidden-files: true
Copy link
Contributor

Choose a reason for hiding this comment

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

The exercise step says:

Change the Upload repo step to Upload build artifact

But we're still uploading the full code. Should this upload the build folder instead?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants