Merge pull request #2107 from expectedparrot/refactor_extensions_module #2481
This file contains hidden or 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
name: Run coopr - edsl tests | |
on: | |
pull_request: | |
branches: | |
- main | |
push: | |
branches: | |
- '**' | |
workflow_dispatch: | |
jobs: | |
build-and-test: | |
if: ${{ github.event_name == 'push' && contains(github.event.head_commit.message, 'coopr') || github.event_name == 'pull_request' }} | |
runs-on: self-hosted | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Determine last commit hash | |
id: get_last_commit | |
run: | | |
if [ "${{ github.head_ref }}" != "" ]; then | |
# Pull Request: Get the last commit from the source branch | |
echo "COMMIT=$(git rev-parse ${{ github.event.pull_request.head.sha }})" >> $GITHUB_ENV | |
else | |
# Push: Get the last commit directly | |
echo "COMMIT=$(git rev-parse HEAD)" >> $GITHUB_ENV | |
fi | |
- name: Update pyproject.toml for EDSL target commit | |
run: | | |
cd /home/stefan/expectedparrot/coopr/backend | |
git checkout -f main | |
git fetch origin | |
git pull | |
sed -i -E "s|edsl = \{git = \"https://github.com/expectedparrot/edsl.git\", rev = \".*\"\}|edsl = {git = \"https://github.com/expectedparrot/edsl.git\", rev = \"$COMMIT\"}|" pyproject.toml | |
sed -i -E "s|edsl = \{git = \"https://github.com/expectedparrot/edsl.git\",branch = \".*\"\}|edsl = {git = \"https://github.com/expectedparrot/edsl.git\", rev = \"$COMMIT\"}|" pyproject.toml | |
- name: Run Docker Compose | |
run: | | |
cd /home/stefan/expectedparrot/coopr | |
docker-compose build backend && docker-compose up --wait | |
- name: Fetch and checkout last commit in EDSL | |
run: | | |
cd /home/stefan/expectedparrot/edsl | |
git fetch origin | |
git checkout -f $COMMIT || git checkout -f origin/main # Fallback to main if commit is unavailable | |
- name: Run make coop-test | |
run: | | |
cd /home/stefan/expectedparrot/edsl | |
source ./project/bin/activate | |
poetry install | |
make test-coop |