retry last failed tests #31
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
name: irissqlcli | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
release: | |
types: | |
- released | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: | |
- "3.8" | |
- "3.9" | |
- "3.10" | |
- "3.11" | |
- "3.12" | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install requirements | |
run: | | |
pip install -U pip setuptools | |
pip install -r requirements-dev.txt | |
pip install -r requirements-iris.txt | |
pip install -e . | |
- uses: nick-fields/retry@v2 | |
name: Run unit tests | |
with: | |
timeout_minutes: 10 | |
max_attempts: 3 | |
command: pytest --container containers.intersystems.com/intersystems/iris-community:latest-em --lf | |
# - name: Run Linters | |
# if: matrix.python-version == '3.10' | |
# run: | | |
# black --check . | |
# autoflake -r irissqlcli | |
# - name: Coverage | |
# run: | | |
# coverage combine | |
# coverage report | |
# codecov | |
build: | |
needs: test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- run: git fetch --depth=1 origin '+refs/tags/*:refs/tags/*' | |
continue-on-error: true | |
- name: set version | |
id: set-version | |
run: | | |
VERSION=$(head -1 irissqlcli/__init__.py | cut -d '"' -f2) | |
[ $GITHUB_EVENT_NAME == 'release' ] && VERSION=${{ github.event.release.tag_name }} && VERSION=${VERSION/v/} | |
[ $GITHUB_EVENT_NAME == 'push' ] && VERSION+=b$(($(git tag -l "v${VERSION}b*" | sort -nt. -k4 2>/dev/null | tail -1 | cut -d b -f2)+1)) | |
[ $GITHUB_EVENT_NAME == 'pull_request' ] && VERSION+=-dev.${{ github.event.pull_request.number }} | |
echo "version=$VERSION" >> $GITHUB_OUTPUT | |
sed -i "s/__version__ = .*/__version__ = \"${VERSION}\"/" irissqlcli/__init__.py | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
with: | |
platforms: linux/amd64,linux/arm64 | |
- name: Install requirements | |
run: | | |
pip install -U pip setuptools | |
pip install -r requirements-dev.txt | |
pip install -r requirements-iris.txt | |
pip install -e . | |
- name: Build Python package | |
run: ./scripts/build-dist.sh | |
- uses: actions/upload-artifact@v3 | |
if: github.event_name == 'pull_request' | |
with: | |
name: dist | |
path: dist/irissqlcli-${{ steps.set-version.outputs.version }}-py3-none-any.whl | |
- name: Create Release | |
id: create-release | |
uses: softprops/action-gh-release@v1 | |
if: github.event_name != 'pull_request' | |
with: | |
tag_name: v${{ steps.set-version.outputs.version }} | |
prerelease: ${{ github.event_name != 'release' }} | |
files: dist/irissqlcli-${{ steps.set-version.outputs.version }}-py3-none-any.whl | |
- name: Publish package | |
if: github.event_name != 'pull_request' | |
uses: pypa/gh-action-pypi-publish@release/v1.5 | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_API_TOKEN }} | |
- name: Docker login | |
run: docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }} | |
- name: Build and push Docker images | |
run: make push | |
- uses: actions/checkout@v3 | |
if: github.event_name == 'release' | |
with: | |
ref: main | |
- name: Bump version | |
if: github.event_name == 'release' | |
run: | | |
git config --global user.name 'ProjectBot' | |
git config --global user.email '[email protected]' | |
VERSION=${{ github.event.release.tag_name }} && VERSION=${VERSION/v/} | |
VERSION=`echo $VERSION | awk -F. '/[0-9]+\./{$NF++;print}' OFS=.` | |
sed -ie "s/__version__ = .*/__version__ = \"$VERSION\"/" irissqlcli/__init__.py | |
git add irissqlcli/__init__.py | |
git commit -m 'auto bump version with release' | |
git push | |
homebrew: | |
needs: build | |
if: github.event_name == 'release' | |
name: Bump Homebrew formula | |
runs-on: ubuntu-latest | |
steps: | |
- name: set version | |
id: set-version | |
run: | | |
VERSION=${{ github.event.release.tag_name }} && VERSION=${VERSION/v/} | |
echo "version=$VERSION" >> $GITHUB_OUTPUT | |
- uses: mislav/bump-homebrew-formula-action@v2 | |
with: | |
formula-name: irissqlcli | |
formula-path: Formula/irissqlcli.rb | |
homebrew-tap: caretdev/homebrew-tap | |
base-branch: main | |
download-url: https://pypi.io/packages/source/i/irissqlcli/irissqlcli-${{ steps.set-version.outputs.version }}.tar.gz | |
commit-message: | | |
{{formulaName}} {{version}} | |
Created by https://github.com/mislav/bump-homebrew-formula-action | |
env: | |
COMMITTER_TOKEN: ${{ secrets.TOKEN }} |