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

CI overhaul: separate stages #2862

Merged
merged 1 commit into from Feb 14, 2021
Merged

Conversation

lgritz
Copy link
Collaborator

@lgritz lgritz commented Feb 13, 2021

Background: In our GitHub Actions CI, we were doing environment setup,
dependency setup, OIIO build, and testsuite -- all in one action
"step" because each stage is its own shell process, so I couldn't
figure out how to communicate between them (for example, a dependency
setup might build and install a dep package, but then the later build
stage needs the CMake Pkg_ROOT variable set to that location).

Doing it all as one "step" was clumsy, not best GHA practice, and it
made it hard to understand which stages were taking different amounts
of time and how to optimize them.

The trick, it turns out, is that $GITHUB_ENV is the name of a file
that will be executed at the start of each step. So you put commands
into that location that restore whatever env variable you need to
restore between steps, or any other setup you need.

So in this patch, we:

  • Elevate env setting to be for all steps.

  • Split build-and-test.bash into separate build and test scripts.

  • Separate setup, dependency installs, build, and test into separate
    GHA steps.

  • Each step's script, at its very end, calls new script save-env.bash,
    which puts commands to restore the environment into the file named
    by $GITHUB_ENV, which will be read at the beginning of the subsequent
    step.

  • Merge gh-installdeps and gh-centos-installdeps scripts -- there was a
    lot of redundancy between them anyway.

The net result of this is that when we examine the test results, it's
much easier to see which stage a failed test had trouble on, and
especially how much time each stage took. That's really handy with the
recent changes to add caching, and helps us verify that the caching is
working as intended, since it is expected to take a big bite out of
the dependency and build stages, but not the test stage.

Background: In our GitHub Actions CI, we were doing environment setup,
dependency setup, OIIO build, and testsuite -- all in one action
"step" because each stage is its own shell process, so I couldn't
figure out how to communicate between them (for example, a dependency
setup might build and install a dep package, but then the later build
stage needs the CMake Pkg_ROOT variable set to that location).

Doing it all as one "step" was clumsy, not best GHA practice, and it
made it hard to understand which stages were taking different amounts
of time and how to optimize them.

The trick, it turns out, is that $GITHUB_ENV is the name of a file
that will be executed at the start of each step. So you put commands
into that location that restore whatever env variable you need to
restore between steps, or any other setup you need.

So in this patch, we:

* Elevate env setting to be for all steps.

* Split build-and-test.bash into separate build and test scripts.

* Separate setup, dependency installs, build, and test into separate
  GHA steps.

* Each step's script, at its very end, calls new script save-env.bash,
  which puts commands to restore the environment into the file named
  by $GITHUB_ENV, which will be read at the beginning of the subsequent
  step.

* Merge gh-installdeps and gh-centos-installdeps scripts -- there was a
  lot of redundancy between them anyway.

The net result of this is that when we examine the test results, it's
much easier to see which stage a failed test had trouble on, and
especially how much time each stage took. That's really handy with the
recent changes to add caching, and helps us verify that the caching is
working as intended, since it is expected to take a big bite out of
the dependency and build stages, but not the test stage.
@lgritz lgritz merged commit 1e8f526 into AcademySoftwareFoundation:master Feb 14, 2021
@lgritz lgritz deleted the lg-ci branch February 17, 2021 20:18
lgritz added a commit to lgritz/OpenImageIO that referenced this pull request Feb 17, 2021
Background: In our GitHub Actions CI, we were doing environment setup,
dependency setup, OIIO build, and testsuite -- all in one action
"step" because each stage is its own shell process, so I couldn't
figure out how to communicate between them (for example, a dependency
setup might build and install a dep package, but then the later build
stage needs the CMake Pkg_ROOT variable set to that location).

Doing it all as one "step" was clumsy, not best GHA practice, and it
made it hard to understand which stages were taking different amounts
of time and how to optimize them.

The trick, it turns out, is that $GITHUB_ENV is the name of a file
that will be executed at the start of each step. So you put commands
into that location that restore whatever env variable you need to
restore between steps, or any other setup you need.

So in this patch, we:

* Elevate env setting to be for all steps.

* Split build-and-test.bash into separate build and test scripts.

* Separate setup, dependency installs, build, and test into separate
  GHA steps.

* Each step's script, at its very end, calls new script save-env.bash,
  which puts commands to restore the environment into the file named
  by $GITHUB_ENV, which will be read at the beginning of the subsequent
  step.

* Merge gh-installdeps and gh-centos-installdeps scripts -- there was a
  lot of redundancy between them anyway.

The net result of this is that when we examine the test results, it's
much easier to see which stage a failed test had trouble on, and
especially how much time each stage took. That's really handy with the
recent changes to add caching, and helps us verify that the caching is
working as intended, since it is expected to take a big bite out of
the dependency and build stages, but not the test stage.
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.

None yet

1 participant