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

use parallel workflows #150

Merged
merged 2 commits into from
Dec 13, 2021
Merged

use parallel workflows #150

merged 2 commits into from
Dec 13, 2021

Conversation

galleon
Copy link
Contributor

@galleon galleon commented Dec 9, 2021

This PR structures the build in 3 different branches:

  • each branch is in charge of an operating system family

  • each build/test job takes 2 parameters to define a strategy :

    • one for the python versions

    • one for the different versions of the os we want to build or test on

      • we currently build onto the latest OS except for windows were we use windows-2016. Latest versions are currently:
      • we test on more versions. Currenty:
        • windows-2016
        • macos-10.15 and macos-11
        • unbuntu-18.04 and ubuntu-20.04
  • the doc is build as soon as possible i.e. as soon as the tests on linux are finished.

This structure does not increase the build time (it slightly decreases it

@dbarbier
Copy link
Contributor

dbarbier commented Dec 9, 2021

How are reviewers supposed to review your changes if you do not explain what these changes are supposed to do? Thanks for the update

echo "::set-output name=build_macos::['macos-latest']"
echo "::set-output name=test_macos::['macos-10.15', 'macos-11']"
echo "::set-output name=build_linux::['ubuntu-latest']"
echo "::set-output name=test_linux::['ubuntu-18.04', 'ubuntu-20.04']"
Copy link
Contributor

Choose a reason for hiding this comment

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

We had previously:

  • Build matrix: [windows-2016, macos-10.15, ubuntu-latest]
  • Test matrix: [windows-latest, macos-latest, ubuntu-latest]

This PR should mimic that, and configuration changes are made in another PR.

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 - back to previous non // set-up

Copy link
Contributor

Choose a reason for hiding this comment

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

BTW it will be simpler to write this step in Python when you will make this workflow more complex; db/shell-python does that. (And db/shell-python-extended shows how this Python code can be modified in order to implement some complex processing in future PRs, if desired)

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 - taken

echo "::set-output name=build_linux::['ubuntu-latest']"
echo "::set-output name=test_linux::['ubuntu-18.04', 'ubuntu-20.04']"

my_echo:
Copy link
Contributor

Choose a reason for hiding this comment

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

Please remove this job; do not keep debugging stuff in production code, this is useless and may add more bugs

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

shell: bash
runs-on: ${{ matrix.os }}

env:
Copy link
Contributor

Choose a reason for hiding this comment

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

env is the same for all jobs and could be declared globally

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

if: steps.cache-build-dependencies.outputs.cache-hit != 'true'
run: echo "SKDECIDE_SKIP_DEPS=0" >> $GITHUB_ENV

- name: Build Windows wheel
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove mentions of OS from step names (in all steps), this is no more useful when jobs are split by OS.

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

Copy link
Contributor

Choose a reason for hiding this comment

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

$ grep -i -E 'name:.*(linux|macos|windows)' .github/workflows/build.yml
      - name: Install omp on MacOS
      - name: Install and restore ccache for macOs
      - name: Let cmake use ccache for macOs
      - name: Restore docker dev image for Linux
      - name: Restore ccache cache for Linux

Copy link
Contributor Author

Choose a reason for hiding this comment

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

grep -i -E 'name:.*(linux|macos|windows)' .github/workflows/build.yml [🐍 scikit-decide]

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

compiler: [gnu]
fail-fast: true
defaults:
run:
shell: bash
Copy link
Contributor

Choose a reason for hiding this comment

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

No idea why, but test failures occur only when running in bash, remove that stance to have the same behavior as before. Remove it from all 3 test-* jobs, they were not set previously and are useless anyway on Unix.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok back to previous state.

@@ -352,7 +553,7 @@ jobs:

upload-nightly:
if: (github.ref == 'refs/heads/master') && (github.repository == 'airbus/scikit-decide') && (github.event_name == 'schedule')
needs: [test-unix, test-macos, test-windows]
needs: [build-docs, test-macos, test-windows]
Copy link
Contributor

Choose a reason for hiding this comment

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

why this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As explained in the description of the PR. Building the doc is done as early as possible. Since it is done on ubuntu it is done after tests have been performed. Therefore build-docs depends now from test-linux and upload-nightly depends on build-docs

Copy link
Contributor

@dbarbier dbarbier Dec 11, 2021

Choose a reason for hiding this comment

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

Previously upload-nightly and build-docs were independent, both depending on test-*. There is no reason to change that in this PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok went back to same structure

strategy:
matrix:
os: ${{ fromJSON(needs.init.outputs.build_windows) }}
python-version: ${{ fromJSON(needs.init.outputs.python_versions) }}
Copy link
Contributor

Choose a reason for hiding this comment

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

python-version on the left and python_versions on the right, that is not ideal

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

Copy link
Contributor

@dbarbier dbarbier left a comment

Choose a reason for hiding this comment

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

build.yml looks good, you can squash commits after changing the setup step as suggested.

But release.yml is wrong, you copy/pasted build.yml, you should instead have duplicated the steps in release.yml. We do not want to use ccache in release.yml, maybe there are other differences, I do not want to check, this would require too much time.

In fact release.yml could be left as is, we won't implement [ci: skip] keywords in this workflow, so it is less important. If you do want to change it anyway, please make sure that the new release.yml does the exact same thing as the old one.

python_version = ["3.7", "3.8", "3.9"]
build = { "macos": ["macos-10.15"], "linux": ["ubuntu-latest"], "windows": ["windows-2016"] }
test = { "macos": ["macos-latest"], "linux": ["ubuntu-latest"], "windows": ["windows-latest"] }
print("::set-output name=python_version::['3.7', '3.8', '3.9']")
Copy link
Contributor

Choose a reason for hiding this comment

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

You should write

print(f"::set-output name=python_version::{python_version}")

Copy link
Contributor

Choose a reason for hiding this comment

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

still not fixed after rebase

Copy link
Contributor

Choose a reason for hiding this comment

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

still not fixed

python_version = ["3.7", "3.8", "3.9"]
build = { "macos": ["macos-10.15"], "linux": ["ubuntu-latest"], "windows": ["windows-2016"] }
test = { "macos": ["macos-latest"], "linux": ["ubuntu-latest"], "windows": ["windows-latest"] }
print("::set-output name=python_version::['3.7', '3.8', '3.9']")
Copy link
Contributor

Choose a reason for hiding this comment

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

print(f"::set-output name=python_version::{python_version}")

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

@dbarbier
Copy link
Contributor

[...]

In fact release.yml could be left as is, we won't implement [ci: skip] keywords in this workflow, so it is less important. If you do want to change it anyway, please make sure that the new release.yml does the exact same thing as the old one.

And if you want to modify release.yml, you should rebase on current master which also modified this file.

@galleon
Copy link
Contributor Author

galleon commented Dec 12, 2021

I have re-squashed and kept 2 commits one for each file.
Applying the same pattern on release should allow later to skip pushing release to PyPI if needed or doing only documentation publication.

@dbarbier
Copy link
Contributor

Applying the same pattern on release should allow later to skip pushing release to PyPI if needed

I cannot imagine why that would be useful.

or doing only documentation publication.

Since release.yml is only triggered by pushing tags, this would mean that you delete and re-push a tag for a published version, this is certainly not desirable.

python_version = ["3.7", "3.8", "3.9"]
build = { "macos": ["macos-10.15"], "linux": ["ubuntu-latest"], "windows": ["windows-2016"] }
test = { "macos": ["macos-latest"], "linux": ["ubuntu-latest"], "windows": ["windows-latest"] }
print("::set-output name=python_version::['3.7', '3.8', '3.9']")
Copy link
Contributor

Choose a reason for hiding this comment

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

still not fixed

@galleon
Copy link
Contributor Author

galleon commented Dec 12, 2021

Indeed the changes for release.yml are targetting forks only (i.e. tests before tagging on main repository).

@galleon galleon merged commit c868ae7 into airbus:master Dec 13, 2021
@galleon galleon deleted the gal/use_parallel_workflows branch December 15, 2021 18:37
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.

2 participants