Skip to content

Commit

Permalink
Fix CI issue with bash -login (streamlit#9220)
Browse files Browse the repository at this point in the history
## Describe your changes

The `--login` flag seems to cause our CI to crash with the latest Github
ubuntu runner image `20240804.1.0` which is currently rolled out
([example](https://github.com/streamlit/streamlit/actions/runs/10265321950/job/28401273688)).
Most likely this is caused by something that gets loaded in the bash
profile that returns error code 3. Based on the [bash
manual](https://www.man7.org/linux/man-pages/man1/bash.1.html), The
`--login` flag will cause `bash` to source some profile files, which
won't happen anymore after this PR.
This PR changes all the bash uses to use the default Github action
settings: `bash`, which resolves to `bash --noprofile --norc -eo
pipefail {0}` (see [GitHub
docs](https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsshell)).

It seems that originally this behavior was used in our workflows to make
the Python virtual env available by writing `source venv/bin` to the
`bash_profile` file which then was sourced. Now, we don't source it from
the `bash_profile` anymore but set the environment explicitly in the
`GITHUB_PATH` to make it available. This not only resolves the issue,
but is also way leaner.

---

**Contribution License Agreement**

By submitting this pull request you agree that all contributions to this
project are made under the Apache 2.0 license.
lukasmasuch authored Aug 6, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent 9490e07 commit bae8ffd
Showing 18 changed files with 31 additions and 33 deletions.
2 changes: 1 addition & 1 deletion .github/actions/build_info/action.yml
Original file line number Diff line number Diff line change
@@ -35,4 +35,4 @@ runs:
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
GITHUB_INPUTS: ${{ toJson(inputs) }}
shell: bash --login -eo pipefail {0}
shell: bash
19 changes: 9 additions & 10 deletions .github/actions/make_init/action.yml
Original file line number Diff line number Diff line change
@@ -21,7 +21,7 @@ runs:
run: |
pip install pre-commit
pre-commit install-hooks
shell: bash --login -eo pipefail {0}
shell: bash
- name: Setup Node
uses: actions/setup-node@v4
with:
@@ -33,7 +33,7 @@ runs:
# Create the cache directory if it does not exist.
mkdir -p $(yarn cache dir)
make react-init
shell: bash --login -eo pipefail {0}
shell: bash
# We require protoc >= 3.20, but Ubuntu 22.04 - the OS that these Github
# Actions are running as of 2024.06.04 - doesn't have recent versions
# of protoc in its package repository. To work around this, we
@@ -47,7 +47,7 @@ runs:
sudo ln -s /usr/local/bin/protoc /usr/bin/protoc
# Print out your System's protoc version:
protoc --version
shell: bash --login -eo pipefail {0}
shell: bash
# Combine hashes of the Python interpreter, Pipfile, and today's
# date into a file whose hash will key the Python virtualenv.
#
@@ -67,7 +67,7 @@ runs:
md5sum lib/setup.py >> $GITHUB_WORKSPACE/python_cache_key.md5
md5sum Makefile >> $GITHUB_WORKSPACE/python_cache_key.md5
date +%F >> $GITHUB_WORKSPACE/python_cache_key.md5
shell: bash --login -eo pipefail {0}
shell: bash
- if: inputs.use_cached_venv == 'true'
name: Restore virtualenv from cache
id: cache-virtualenv
@@ -83,19 +83,18 @@ runs:
pip install --upgrade pip
pip install uv
make python-init
deactivate
shell: bash --login -eo pipefail {0}
shell: bash
- name: Activate virtualenv
run: echo 'source venv/bin/activate' >> $HOME/.bash_profile
shell: bash --login -eo pipefail {0}
run: echo "${{ github.workspace }}/venv/bin" >> $GITHUB_PATH
shell: bash
- name: Show environment info
run: |
echo "Show environment info"
echo "Python version:"
python --version
echo "Installed dependencies:"
python -m pip list
shell: bash --login -eo pipefail {0}
shell: bash
- name: Generate Protobufs
run: make protobuf
shell: bash --login -eo pipefail {0}
shell: bash
2 changes: 1 addition & 1 deletion .github/actions/preview_branch/action.yml
Original file line number Diff line number Diff line change
@@ -38,4 +38,4 @@ runs:
fi
)" >> $GITHUB_ENV
echo "BRANCH=$BRANCH_NAME" >> $GITHUB_ENV
shell: bash --login -eo pipefail {0}
shell: bash
2 changes: 1 addition & 1 deletion .github/workflows/cli-regression.yml
Original file line number Diff line number Diff line change
@@ -18,7 +18,7 @@ jobs:

defaults:
run:
shell: bash --login -eo pipefail {0}
shell: bash

steps:
- name: Checkout Streamlit code
2 changes: 1 addition & 1 deletion .github/workflows/conda-build.yml
Original file line number Diff line number Diff line change
@@ -18,7 +18,7 @@ jobs:

defaults:
run:
shell: bash --login -eo pipefail {0}
shell: bash

steps:
- name: Checkout Streamlit code
2 changes: 1 addition & 1 deletion .github/workflows/cypress-update-snapshots.yml
Original file line number Diff line number Diff line change
@@ -21,7 +21,7 @@ jobs:

defaults:
run:
shell: bash --login -eo pipefail {0}
shell: bash

steps:
- name: Checkout Streamlit code
4 changes: 2 additions & 2 deletions .github/workflows/cypress.yml
Original file line number Diff line number Diff line change
@@ -24,7 +24,7 @@ jobs:

defaults:
run:
shell: bash --login -eo pipefail {0}
shell: bash

strategy:
fail-fast: false
@@ -136,7 +136,7 @@ jobs:

defaults:
run:
shell: bash --login -eo pipefail {0}
shell: bash

steps:
- name: Check Cypress test matrix status
2 changes: 1 addition & 1 deletion .github/workflows/ensure-relative-imports.yml
Original file line number Diff line number Diff line change
@@ -24,7 +24,7 @@ jobs:

defaults:
run:
shell: bash --login -eo pipefail {0}
shell: bash

steps:
- name: Checkout Streamlit code
5 changes: 2 additions & 3 deletions .github/workflows/js-tests.yml
Original file line number Diff line number Diff line change
@@ -24,8 +24,7 @@ jobs:

defaults:
run:
shell: bash --login -eo pipefail {0}

shell: bash
steps:
- name: Checkout Streamlit code
uses: actions/checkout@v4
@@ -80,7 +79,7 @@ jobs:

defaults:
run:
shell: bash --login -eo pipefail {0}
shell: bash

steps:
- name: Checkout Streamlit code
6 changes: 3 additions & 3 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
@@ -13,7 +13,7 @@ jobs:

defaults:
run:
shell: bash --login -eo pipefail {0}
shell: bash

permissions:
# Additional permission needed to generate tag
@@ -142,7 +142,7 @@ jobs:

defaults:
run:
shell: bash --login -eo pipefail {0}
shell: bash

outputs:
enable-setup: ${{ steps.exports.outputs.enable-setup }}
@@ -227,7 +227,7 @@ jobs:

defaults:
run:
shell: bash --login -eo pipefail {0}
shell: bash

steps:
- name: Checkout Core Previews Repo
2 changes: 1 addition & 1 deletion .github/workflows/playwright-changed-files.yml
Original file line number Diff line number Diff line change
@@ -15,7 +15,7 @@ jobs:

defaults:
run:
shell: bash --login -eo pipefail {0}
shell: bash

steps:
- name: Checkout Streamlit code
2 changes: 1 addition & 1 deletion .github/workflows/playwright-custom-components.yml
Original file line number Diff line number Diff line change
@@ -23,7 +23,7 @@ jobs:
runs-on: ubuntu-latest
defaults:
run:
shell: bash --login -eo pipefail {0}
shell: bash

steps:
- name: Checkout Streamlit code
2 changes: 1 addition & 1 deletion .github/workflows/playwright.yml
Original file line number Diff line number Diff line change
@@ -24,7 +24,7 @@ jobs:

defaults:
run:
shell: bash --login -eo pipefail {0}
shell: bash

steps:
- name: Checkout Streamlit code
4 changes: 2 additions & 2 deletions .github/workflows/pr-preview.yml
Original file line number Diff line number Diff line change
@@ -22,7 +22,7 @@ jobs:

defaults:
run:
shell: bash --login -eo pipefail {0}
shell: bash

outputs:
enable-setup: ${{ steps.exports.outputs.enable-setup }}
@@ -121,7 +121,7 @@ jobs:

defaults:
run:
shell: bash --login -eo pipefail {0}
shell: bash

steps:
- name: Checkout Core Previews Repo
2 changes: 1 addition & 1 deletion .github/workflows/python-bare-executions.yml
Original file line number Diff line number Diff line change
@@ -24,7 +24,7 @@ jobs:

defaults:
run:
shell: bash --login -eo pipefail {0}
shell: bash

steps:
- name: Checkout Streamlit code
2 changes: 1 addition & 1 deletion .github/workflows/python-min-deps.yml
Original file line number Diff line number Diff line change
@@ -20,7 +20,7 @@ concurrency:

defaults:
run:
shell: bash --login -eo pipefail {0}
shell: bash

env:
FORCE_COLOR: "1"
2 changes: 1 addition & 1 deletion .github/workflows/python-tests.yml
Original file line number Diff line number Diff line change
@@ -34,7 +34,7 @@ concurrency:

defaults:
run:
shell: bash --login -eo pipefail {0}
shell: bash

env:
FORCE_COLOR: "1"
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -41,7 +41,7 @@ jobs:

defaults:
run:
shell: bash --login -eo pipefail {0}
shell: bash

permissions:
# Additional permission needed to generate release

0 comments on commit bae8ffd

Please sign in to comment.