Skip to content

Commit

Permalink
Publish workflow (not complete)
Browse files Browse the repository at this point in the history
and a little tidyup
  • Loading branch information
damies13 committed Feb 25, 2024
1 parent f1189c6 commit 92feced
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 58 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/Main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ jobs:
- Package_For_PIP
uses: ./.github/workflows/Regression_Tests.yaml

# Publish_Package:
# needs:
# - Package_For_PIP
# - Regression_Tests
# uses: ./.github/workflows/Package.yaml
Publish_Package:
needs:
- Package_For_PIP
- Regression_Tests
uses: ./.github/workflows/Publish.yaml
17 changes: 3 additions & 14 deletions .github/workflows/Package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,18 @@ on: workflow_call

jobs:
Package_For_PIP:
# strategy:
# matrix:
# platform: [ubuntu-latest]
# python: ['3.x']
# runs-on: ${{ matrix.platform }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.x
- name: "Apt Update"
# if: ${{ matrix.platform == 'ubuntu-latest' }}
- name: Apt Update
run: |
sudo apt update -y
- name: "pip install"
- name: PIP Install
run: pip install --upgrade build setuptools twine wheel
# - name: "Echo Vars"
# run: |
# echo matrix.platform: ${{ matrix.platform }}
# echo matrix.python: ${{ matrix.python }}
- name: Git fetch
run: git fetch --prune --unshallow
- name: Get Branch Name
Expand All @@ -52,7 +42,6 @@ jobs:
fi
echo "ismaster=$ismaster" >> "$GITHUB_ENV"
- name: Get Date String
if: ${{ env.isrrelease == 0 && env.ismaster == 0 }}
run: |
Expand All @@ -67,7 +56,7 @@ jobs:
version=v$numver
echo "version=$version" >> "$GITHUB_ENV"
- name: Set New Version Number
if: ${{ env.isrrelease == 0 && env.ismaster == 0 }}
if: ${{ env.isrrelease == 0 }}
run: |
numver=$(echo "$currrelease" | sed -E 's/v([^-]*)/\1/')
mapfile -d . -t numverparts < <(echo "$numver")
Expand Down
56 changes: 56 additions & 0 deletions .github/workflows/Publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
---
name: Publish

on: workflow_call

jobs:
Publish_PIP:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Get Branch Name
run: |
branchname=$(git rev-parse --abbrev-ref HEAD)
echo "branchname=$branchname" >> "$GITHUB_ENV"
- name: Determine if this is a release branch
run: |
isrrelease=0
if [[ $branchname =~ v[0-9]\. ]]; then
isrrelease=1
fi
echo "isrrelease=$isrrelease" >> "$GITHUB_ENV"
- name: Apt Update
if: ${{ env.isrrelease == 1 }}
run: |
sudo apt update -y
- name: Setup Python
if: ${{ env.isrrelease == 1 }}
uses: actions/setup-python@v5
with:
python-version: 3.x
- name: PIP Install
if: ${{ env.isrrelease == 1 }}
run: pip install --upgrade build setuptools twine wheel
- name: Download packages to dist
if: ${{ env.isrrelease == 1 }}
uses: actions/download-artifact@v4
with:
name: dist
path: dist
- name: Show Dist UM
if: ${{ env.isrrelease == 1 }}
if: ${{ matrix.platform != 'windows-latest' }}
run: |
ls -la dist
- name: Show Dist W
if: ${{ env.isrrelease == 1 }}
if: ${{ matrix.platform == 'windows-latest' }}
run: |
dir dist
# Still need to have a check all the milestones are complete
# - name: Do Publish
# if: ${{ env.isrrelease == 1 }}
# run: |
# echo python3 -m twine upload -u USERNAME -p PASSWORD dist/rfswarm*
39 changes: 0 additions & 39 deletions .github/workflows/Regression_Tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -108,24 +108,6 @@ jobs:
# fluxbox
fluxbox &
# - name: "MacOS Installs"
# if: ${{ matrix.platform == 'macos-latest' }}
# run: |
# brew update
# brew install tesseract
# brew upgrade
#
# - name: "Windows Installs"
# if: ${{ matrix.platform == 'windows-latest' }}
# run: |
# Invoke-WebRequest -Uri "https://digi.bib.uni-mannheim.de/tesseract/tesseract-ocr-w64-setup-5.3.1.20230401.exe"
# -OutFile "$($ENV:Temp)\tesseract-ocr-w64-setup-5.3.1.20230401.exe"
# & "$($ENV:Temp)\tesseract-ocr-w64-setup-5.3.1.20230401.exe" /s
# shell: powershell
#
# - name: "Verify tesseract"
# run: tesseract -v

- name: Download packages to dist
uses: actions/download-artifact@v4
with:
Expand Down Expand Up @@ -178,7 +160,6 @@ jobs:

# This below is to save results back to git, actions/upload-artifact@v4 might be a better solution, see Issue #169
- name: git commit
# if: ${{ steps.robottest.conclusion == 'failure' }}
# https://docs.github.com/en/actions/learn-github-actions/expressions
if: ${{ failure() }}
run: |
Expand All @@ -188,15 +169,13 @@ jobs:
echo "git commit"
git commit -m "Manager ${{ matrix.platform }} ${{ matrix.python }}"
- name: Switch back to original branch
# if: ${{ steps.robottest.conclusion == 'failure' }}
if: ${{ failure() }}
run: |
echo "git checkout ref_name: ${{ github.ref_name }}"
git checkout -f ${{ github.ref_name }}
echo "git pull"
git pull --ff --autostash -f
- name: Merge test results into original branch
# if: ${{ steps.robottest.conclusion == 'failure' }}
if: ${{ failure() }}
run: |
echo "git merge"
Expand Down Expand Up @@ -259,14 +238,10 @@ jobs:
sleep 1
# fluxbox
fluxbox &
#
- name: "MacOS Install tesseract"
if: ${{ matrix.platform == 'macos-latest' }}
run: |
brew install tesseract
# brew update
# brew upgrade
#
- name: "Windows Download Tesseract"
if: ${{ matrix.platform == 'windows-latest' }}
shell: pwsh
Expand All @@ -285,21 +260,7 @@ jobs:
run: |
echo "$($ENV:ProgramFiles)\Tesseract-OCR" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- name: "Verify tesseract"
# if: ${{ matrix.platform != 'windows-latest' }}
run: tesseract -v
#
# - name: "Verify tesseract"
# if: ${{ matrix.platform == 'windows-latest' }}
# run: |
# echo %PATH%
# echo %programfiles%
# dir "%programfiles%""
# dir "%programfiles%\Tesseract-OCR"
# echo %programfiles(x86)%
# dir "%programfiles(x86)%"
# "%programfiles%\Tesseract-OCR\tesseract.exe" -v
# shell: cmd
#

- name: Download packages to dist
uses: actions/download-artifact@v4
Expand Down

0 comments on commit 92feced

Please sign in to comment.