-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #47 from EIT-ALIVE/remote_workflow_dbodor
ci: Allow build action to be triggered remotely
- Loading branch information
Showing
7 changed files
with
2,068 additions
and
1,970 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
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 | ||
- name: Check linting and formatting using ruff | ||
run: | | ||
python3 -m pip install ruff | ||
ruff check || echo "Please ensure you have the latest version of ruff (`ruff -V`) installed locally." | ||
ruff format --check || echo "Please ensure you have the latest version of ruff (`ruff -V`) installed locally." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
# Data | ||
test_data | ||
|
||
# Mac | ||
.DS_Store | ||
|
||
|
Oops, something went wrong.