Skip to content

Commit

Permalink
Now triggers release & PyPI upload when tagged.
Browse files Browse the repository at this point in the history
  • Loading branch information
bcoconni committed Oct 17, 2020
1 parent 8585b48 commit 8fdea98
Showing 1 changed file with 113 additions and 64 deletions.
177 changes: 113 additions & 64 deletions .github/workflows/cpp-python-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ name: C/C++ build

on: [push, pull_request]

env:
release: ${{ github.event_name == 'push' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/')) }}

jobs:
Linux:
strategy:
Expand Down Expand Up @@ -30,7 +33,7 @@ jobs:
- name: Checkout JSBSim
uses: actions/checkout@v2
- name: Install & Configure Doxygen
if: github.event_name == 'push' && github.ref == 'refs/heads/master' && matrix.expat == 'OFF' && matrix.shared_libs == 'OFF'
if: env.release == 'true' && matrix.expat == 'OFF' && matrix.shared_libs == 'OFF'
run: |
sudo apt-get install doxygen
# We don't want Doxygen to generate the HTML docs in this job (saves time)
Expand All @@ -53,7 +56,7 @@ jobs:
working-directory: build
run: LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PWD/src ctest -j2 --output-on-failure
- name: Build Ubuntu packages
if: matrix.shared_libs == 'OFF'
if: matrix.shared_libs == 'OFF' && matrix.expat == 'OFF'
working-directory: build
run: cpack
- name: Build ManyLinux wheel packages (PEP 513)
Expand All @@ -76,38 +79,26 @@ jobs:
python -c "import jsbsim;fdm=jsbsim.FGFDMExec('.', None);print(jsbsim.FGAircraft.__doc__)"
pip uninstall jsbsim -y
# Upload files
- name: On failure - Prepare logs for upload
if: failure()
run: |
mkdir logs
cp build/Testing/Temporary/*.log logs/.
cp build/tests/*-build.log logs/.
cp valgrind_Short_S23_3.xml logs/.
# On failure, upload logs
- name: On failure - Upload logs
uses: actions/upload-artifact@v1
uses: actions/upload-artifact@v2
if: failure()
with:
name: Linux-${{ matrix.os }}-system_expat_${{ matrix.expat }}-shared_libs_${{ matrix.shared_libs }}.logs
path: logs
path: |
build/Testing/Temporary/*.log
build/tests/*-build.log
valgrind_Short_S23_3.xml
- name: On failure - Display a summary of valgrind errors.
if: failure()
run: valgrind-ci valgrind_Short_S23_3.xml --number-of-errors --summary --source=.

# Release files
- name: Release binaries
uses: softprops/action-gh-release@v1
if: github.event_name == 'push' && github.ref == 'refs/heads/master' && matrix.expat == 'OFF' && matrix.shared_libs == 'OFF'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload Files for Release
uses: actions/upload-artifact@v2
if: env.release == 'true' && matrix.expat == 'OFF' && matrix.shared_libs == 'OFF'
with:
name: ${{ github.job}} rolling release
tag_name: ${{ github.job }}
prerelease: true
body: |
Contains the ${{ github.job}} packages built from the bleeding edge code
(branch ${{ github.ref }} commit ${{ github.sha}})
files: |
name: Linux-${{ matrix.os }}.binaries
path: |
build/*.deb
build/python/dist/*-manylinux*.whl
Expand Down Expand Up @@ -165,7 +156,7 @@ jobs:
- name: Checkout JSBSim
uses: actions/checkout@v2
- name: Install & Configure Doxygen
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
if: env.release == 'true'
run: |
cinst doxygen.install
# We don't want Doxygen to generate the HTML docs in this job (saves time)
Expand Down Expand Up @@ -227,34 +218,22 @@ jobs:
pip install jsbsim --no-index -f build/python/dist
python -c "import jsbsim;fdm=jsbsim.FGFDMExec('.', None);print(jsbsim.FGAircraft.__doc__)"
# Upload files
- name: On failure - Prepare logs for upload
if: failure()
run: |
mkdir logs
cp build/Testing/Temporary/*.log logs/.
cp build/tests/*-build.log logs/.
# On failure, upload logs
- name: On failure - Upload logs
uses: actions/upload-artifact@v1
if: failure()
with:
name: Windows_MSVC.logs
path: logs
path: |
build/Testing/Temporary/*.log
build/tests/*-build.log
# Release files
- name: Release binaries
uses: softprops/action-gh-release@v1
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload Files for Release
uses: actions/upload-artifact@v2
if: env.release == 'true'
with:
name: ${{ github.job}} rolling release
tag_name: ${{ github.job }}
prerelease: true
body: |
Contains the ${{ github.job}} packages built from the bleeding edge code
(branch ${{ github.ref }} commit ${{ github.sha}})
files: |
name: Windows_MSVC.binaries
path: |
build\src\RelWithDebInfo\JSBSim.exe
build\utils\aeromatic++\RelWithDebInfo\aeromatic.exe
build\python\dist\*.whl
Expand All @@ -271,7 +250,7 @@ jobs:
- name: Checkout JSBSim
uses: actions/checkout@v2
- name: Install & Configure Doxygen
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
if: env.release == 'true'
run: |
brew install doxygen
# We don't want Doxygen to generate the HTML docs in this job (saves time)
Expand Down Expand Up @@ -301,6 +280,10 @@ jobs:
- name: Build wheel package for Python 3.6
working-directory: build
run: python python/setup.py bdist_wheel --build-number=$GITHUB_RUN_NUMBER
- name: Build source package for Python
if: env.release == 'true'
working-directory: build
run: python python/setup.py sdist
- name: Test wheel package for Python 3.6
run: |
pip install jsbsim --no-index -f build/python/dist
Expand Down Expand Up @@ -333,35 +316,101 @@ jobs:
pip install jsbsim --no-index -f build/python/dist
python -c "import jsbsim;fdm=jsbsim.FGFDMExec('.', None);print(jsbsim.FGAircraft.__doc__)"
# Upload files
- name: On failure - Prepare logs for upload
if: failure()
run: |
mkdir logs
cp build/Testing/Temporary/*.log logs/.
cp build/tests/*-build.log logs/.
# On failure, upload logs
- name: On failure - Upload logs
uses: actions/upload-artifact@v1
uses: actions/upload-artifact@v2
if: failure()
with:
name: MacOSX.logs
path: logs
path: |
build/Testing/Temporary/*.log
build/tests/*-build.log
- name: Upload Files for Release
uses: actions/upload-artifact@v2
if: env.release == 'true'
with:
name: MacOSX.binaries
path: build/python/dist/*

# Release files
- name: Release binaries
Rolling-Release:
needs: [Linux, MacOSX, Windows-MSVC]
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
steps:
- name: Download files
uses: actions/download-artifact@v2
- name: Prepare files
run: |
mkdir dist
find . -type f -name *.exe -exec cp {} dist/. \;
find . -type f -name *.whl -exec cp {} dist/. \;
find . -type f -name *.deb -exec cp {} dist/. \;
- name: Rolling release
uses: softprops/action-gh-release@v1
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
name: ${{ github.job}} rolling release
tag_name: ${{ github.job }}
name: Rolling release
tag_name: Linux
prerelease: true
body: |
Contains the ${{ github.job}} packages built from the bleeding edge code
Contains the packages built from the bleeding edge code
(branch ${{ github.ref }} commit ${{ github.sha}})
files: |
build/python/dist/*.whl
dist/*.exe
dist/*.whl
dist/*.deb
Official-Release:
needs: [Linux, MacOSX, Windows-MSVC]
runs-on: ubuntu-latest
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
steps:
- name: Download files
uses: actions/download-artifact@v2
- name: Prepare files for deployment
run: |
mkdir dist
find . -type f -name *.exe -exec cp {} dist/. \;
find . -type f -name *.whl -exec cp {} dist/. \;
find . -type f -name *.deb -exec cp {} dist/. \;
find . -type f -name *.tar.gz -exec cp {} dist/. \;
# PyPI deployment
- name: Set up Python 3.6
uses: actions/setup-python@v1
with:
python-version: '3.6'
- name: PyPI deployment
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
pip install -U twine
twine upload dist/*.whl
twine upload dist/*.tar.gz
# Deploy official release to GitHub
- name: Get JSBSim version
run: |
pip install -U numpy
pip install jsbsim --no-index -f dist
export VERSION=`pip show jsbsim | grep -i version | awk '{ print $2 }'`
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: GitHub release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
name: Release v${{ env.VERSION }}
body: JSBSim version ${{ env.VERSION }}
prerelease: false
draft: false
files: |
dist/*.exe
dist/*.whl
dist/*.deb
Documentation:
needs: Linux
Expand Down

0 comments on commit 8fdea98

Please sign in to comment.