-
Notifications
You must be signed in to change notification settings - Fork 0
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: Allow build action to be triggered remotely #47
Changes from 7 commits
13dc1bc
894f5a0
30ceeb3
f974af7
21b4a24
95b23b4
de05e43
c339a07
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,6 +18,11 @@ on: | |
- "**.cff" | ||
branches: | ||
- main | ||
workflow_call: # allows for remote triggering of action | ||
inputs: | ||
caller_branch: | ||
required: true | ||
type: string | ||
|
||
jobs: | ||
build: | ||
|
@@ -30,7 +35,10 @@ jobs: | |
os: ["ubuntu-latest"] | ||
python-version: ["3.10"] | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Checkout Repository | ||
uses: actions/checkout@v3 | ||
with: | ||
repository: EIT-ALIVE/eit_dash # needs to be made explicit for the remote trigger | ||
- name: Connect to Container Registry | ||
uses: docker/[email protected] | ||
with: | ||
|
@@ -39,40 +47,19 @@ jobs: | |
password: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Run Tests in Container | ||
run: > | ||
echo "action triggered by: ${{github.event_name}}"; | ||
docker run | ||
--rm | ||
-v ${{ github.workspace }}:/ci | ||
-v $GITHUB_WORKSPACE:/ci | ||
-e TEST_DATA=/eitprocessing | ||
ghcr.io/eit-alive/eittestdata:latest | ||
sh -c 'set -xe ; | ||
cd /ci ; | ||
python3 -m pip install --upgrade pip poetry ; | ||
python${{ matrix.python-version }} -m pip install --upgrade pip poetry ; | ||
echo "--- conditionally install remote branch of eitprocessing" | ||
if [ -n "${{ inputs.caller_branch }}" ]; then | ||
poetry add git+https://github.com/EIT-ALIVE/eitprocessing.git#${{ inputs.caller_branch }} ; | ||
fi | ||
poetry install --with test ; | ||
poetry run pytest -v tests/unit_tests ; | ||
python -m build' | ||
|
||
lint: | ||
if: github.event.pull_request.draft == false | ||
name: Linting build | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Python 3.10 | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: "3.10" | ||
- name: Python info | ||
shell: bash -e {0} | ||
run: | | ||
which python3 | ||
python3 --version | ||
- name: Upgrade pip and install dependencies | ||
run: | | ||
python3 -m pip install --upgrade pip poetry | ||
poetry install --with test | ||
- name: Check linting and formatting using ruff | ||
run: | | ||
poetry run ruff check | ||
poetry run ruff format --check | ||
python${{ matrix.python-version }} -m build' |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
name: Linting | ||
|
||
on: | ||
push: | ||
paths-ignore: | ||
- "**.md" | ||
- "**.rst" | ||
- "**.ipynb" | ||
- "**.cff" | ||
branches: | ||
- main | ||
pull_request: | ||
types: [opened, synchronize, reopened, ready_for_review] | ||
paths-ignore: | ||
- "**.md" | ||
- "**.rst" | ||
- "**.ipynb" | ||
- "**.cff" | ||
branches: | ||
- main | ||
|
||
jobs: | ||
lint: | ||
if: github.event.pull_request.draft == false | ||
name: Linting build for (${{ matrix.python-version }}, ${{ matrix.os }}) | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: ["ubuntu-latest"] | ||
python-version: ["3.10"] | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Python info | ||
shell: bash -e {0} | ||
run: | | ||
which python3 | ||
python3 --version | ||
Comment on lines
+38
to
+42
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this needed? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. no... it was already in there. I guess for troubleshooting reasons. |
||
- name: Upgrade pip and install dependencies | ||
run: | | ||
python3 -m pip install --upgrade pip poetry | ||
poetry install --with test | ||
- name: Check linting and formatting using ruff | ||
run: | | ||
poetry run ruff check | ||
poetry run ruff format --check | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wonder if it makes sense to go through poetry for checking the linting, or if we can just pip install ruff and run the check. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'll make the change in the other repo too :) |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's nice to have a debug workflow ready to be used in case of need |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
# This file exists just for troubleshooting purposes | ||
name: Remote Build Trigger | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
caller_branch: | ||
required: true | ||
type: string | ||
remote: | ||
required: true | ||
type: boolean | ||
|
||
jobs: | ||
build: | ||
name: Remote build | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: ["ubuntu-latest"] | ||
python-version: ["3.10"] | ||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v3 | ||
with: | ||
repository: EIT-ALIVE/eit_dash # needs to be made explicit to avoid the remote repo being used | ||
- name: Verify Repository Structure # echo debugging info in case things go haywire | ||
run: | | ||
echo "action triggered by: ${{github.event_name}}"; | ||
echo "Current directory: $(pwd)" | ||
ls -al | ||
echo "Contents of $GITHUB_WORKSPACE:" | ||
ls -al $GITHUB_WORKSPACE | ||
if [ -f $GITHUB_WORKSPACE/pyproject.toml ]; then | ||
echo "Contents of pyproject.toml:" | ||
cat $GITHUB_WORKSPACE/pyproject.toml | ||
else | ||
echo "pyproject.toml not found." | ||
exit 1 | ||
fi | ||
- name: Connect to Container Registry | ||
uses: docker/[email protected] | ||
with: | ||
registry: ghcr.io | ||
username: wbaccinelli | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Run Tests in Container | ||
run: > | ||
docker run | ||
--rm | ||
-v $GITHUB_WORKSPACE:/ci | ||
-e TEST_DATA=/eitprocessing | ||
ghcr.io/eit-alive/eittestdata:latest | ||
sh -c 'set -xe ; | ||
cd /ci ; | ||
python${{ matrix.python-version }} -m pip install --upgrade pip poetry ; | ||
poetry add git+https://github.com/EIT-ALIVE/eitprocessing.git#${{ inputs.caller_branch }} | ||
poetry install --with test ; | ||
poetry run pytest -v tests/unit_tests ; | ||
python${{ matrix.python-version }} -m build' |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
# Data | ||
test_data | ||
|
||
# Mac | ||
.DS_Store | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the difference with
{{ github.workspace }}
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think nothing (it came up when I was checking things with chatgpt), but found this slightly more readable. Wouldn't have made a separate PR for it, but while I was at it...