Skip to content

Commit

Permalink
Update workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
jefflester committed Nov 29, 2023
1 parent b4756a4 commit e638fda
Show file tree
Hide file tree
Showing 6 changed files with 68 additions and 20 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/branch-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Branch Release

on:
workflow_run:
workflows: [lib-tests, cli-tests]
types:
- completed

jobs:
set-branch-release-and-tag:
runs-on: ubuntu-latest
steps:

- name: Check out code
uses: actions/checkout@v4

- name: Create release
run: |-
RELEASE_NOTES=./release-notes/"${GITHUB_HEAD_REF}".md
if [ ! -f "${RELEASE_NOTES}" ]; then
echo "Release notes file not found at ${RELEASE_NOTES}. Exiting..."
exit 1
fi
DESCRIPTION=$(cat "${RELEASE_NOTES}")
echo "Checking if release exists..."
if gh release list | grep -q -e "${GITHUB_HEAD_REF}"; then
echo "Release ${GITHUB_HEAD_REF} found. Deleting release..."
gh release delete "${GITHUB_HEAD_REF}" -y --cleanup-tag
fi
echo "Creating release from branch ${GITHUB_HEAD_REF}..."
gh release create "${GITHUB_HEAD_REF}" \
--prerelease \
--draft=true \
--title "${GITHUB_HEAD_REF}" \
--notes "${DESCRIPTION}" \
--target "${GITHUB_HEAD_REF}"
env:
GITHUB_TOKEN: ${{ secrets.MINITRINO_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/cli-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
- src/cli/**

jobs:
test:
cli-tests:
runs-on: ubuntu-22.04
steps:

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lib-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
- src/lib/**

jobs:
test:
lib-tests:
runs-on: ubuntu-22.04
steps:

Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/test-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ on:
branches:
- master
paths:
- src/lib/**
- src/**

jobs:
set_release_and_tag:
set-test-release-and-tag:
runs-on: ubuntu-latest
steps:

Expand All @@ -17,8 +17,8 @@ jobs:

- name: Delete and recreate release
run: |-
export TAG="0.0.0"
export DESCRIPTION="Used as a placeholder to give test builds access to the PR branch's module library."
TAG="0.0.0"
DESCRIPTION="Used as a placeholder to give test builds access to the PR branch's module library."
echo "Checking if release exists..."
if gh release list | grep -q -e "${TAG}"; then
Expand Down
33 changes: 21 additions & 12 deletions .github/workflows/update-version-files.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,30 @@ jobs:
- name: Update version files
run: |-
BRANCH=$(echo "${GITHUB_REF#refs/heads/}")
# Update ./src/lib/version
if [[ "$GITHUB_REF" == "$BRANCH" ]]; then
echo "This workflow can only be triggered by a branch"
exit 0
fi
echo "Updating version files to version ${BRANCH}"
echo "Update ./src/lib/version"
echo "${BRANCH}" > ./src/lib/version
# Update ./src/cli/setup.py
sed -i "s/version=\"[0-9]\.[0-9]\.[0-9]\"/version=\"${BRANCH}\"/" ./src/cli/setup.py
echo "Update ./src/cli/setup.py"
sed -i "s|version=\"[0-9]\.[0-9]\.[0-9]\"|version=\"${BRANCH}\"|" ./src/cli/setup.py
# Update ./readme.md
sed -i "s/\*\*Latest Stable Release\*\*: [0-9]\.[0-9]\.[0-9]/\*\*Latest Stable Release\*\*: ${BRANCH}/" ./readme.md
echo "Update ./readme.md"
sed -i "s|\*\*Latest Stable Release\*\*: [0-9]\.[0-9]\.[0-9]|\*\*Latest Stable Release\*\*: ${BRANCH}|" ./readme.md
# Commit changes
git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com"
git config --global user.name "${GITHUB_ACTOR}"
git add ./src/lib/version ./src/cli/setup.py ./readme.md
git commit -m "Update version to ${BRANCH}"
git push
if [[ -n $(git status --porcelain) ]]; then
echo "Commit version changes"
git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com"
git config --global user.name "${GITHUB_ACTOR}"
git add ./src/lib/version ./src/cli/setup.py ./readme.md
git commit -m "Update version files to ${BRANCH}"
git push
else
echo "No version changes to commit"
fi
env:
GITHUB_TOKEN: ${{ secrets.MINITRINO_TOKEN }}
2 changes: 0 additions & 2 deletions src/test/src/lib/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,6 @@ def __init__(self, json_data={}, module=""):
f"Module test type '{t.get('type')}' for module: '{module}'"
)

common.log_success(f"Module tests for module: '{module}'")

def test_query(self, json_data={}):
"Runs a query inside the Trino container using the trino-cli."

Expand Down

0 comments on commit e638fda

Please sign in to comment.