Update action versions #193
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: Run Tests and Build Quit Store Releases | |
on: [push] | |
jobs: | |
test: | |
runs-on: ubuntu-22.04 | |
strategy: | |
fail-fast: false | |
matrix: | |
python: [3.7, 3.8, 3.9, '3.10', '3.11'] | |
# include: | |
# - python: "3.11.0-rc.1" | |
# experimental: true | |
steps: | |
# Configures the python version | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python }} | |
- name: Print Versions | |
run: | | |
python --version | |
git --version | |
- uses: actions/checkout@v4 | |
- name: Install Required Packages | |
run: sudo apt-get install cmake libssl-dev libssh2-1-dev | |
- name: Install Python Dependencies | |
# pygit2 is installed separately to make sure cached-property is | |
# installed on python 3.7: https://github.com/libgit2/pygit2/issues/1114 | |
run: | | |
pip install -U poetry | |
poetry run pip install pygit2 | |
poetry install --no-root | |
- name: Check Conding style | |
run: poetry run pylama -i E402,C | |
- name: Set Git user | |
run: | | |
git config --global user.email "quittestsystem@example.org" | |
git config --global user.name "Quit CI Tests" | |
- name: Run Tests | |
run: | | |
poetry run pytest --cov=quit --cov-report=term-missing | |
- name: Coverage | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
COVERALLS_SERVICE_NAME: github | |
run: | | |
poetry run coveralls | |
build: | |
runs-on: ubuntu-22.04 | |
needs: test | |
strategy: | |
matrix: | |
python-version: [3.9] | |
fail-fast: false | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Pyinstaller | |
run: | | |
# Update pip | |
python -m pip install --progress-bar=off poetry | |
# Install dependencies | |
poetry install | |
# Build wheel and source package | |
poetry build | |
- name: Upload Wheel and Source | |
uses: actions/upload-artifact@v4 | |
with: | |
name: wheel-and-source | |
path: | | |
dist/quit-*.whl | |
dist/quit-*.tar.gz | |
release: | |
runs-on: ${{ matrix.os }} | |
needs: build | |
strategy: | |
matrix: | |
python-version: [3.9] | |
os: ['windows-2022', 'ubuntu-22.04', 'macos-12'] | |
fail-fast: false | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
#- name: Patch Windows requirements | |
# if: startsWith(matrix.os, 'windows') | |
# run: | | |
# git apply requirements.txt.windows.patch | |
- name: Pyinstaller | |
run: | | |
# Update pip | |
python -m pip install --progress-bar=off poetry | |
# Install dependencies | |
poetry install | |
# Run PyInstaller | |
poetry run pyinstaller quit.spec | |
- name: Rename Lin Release | |
if: ${{ startsWith(matrix.os, 'ubuntu') }} | |
run: cp ./dist/run ./dist/quit-linux | |
- name: Rename Mac Release | |
if: ${{ startsWith(matrix.os, 'macos') }} | |
run: cp ./dist/run ./dist/quit-macos | |
- name: Rename Win Release | |
if: ${{ startsWith(matrix.os, 'windows') }} | |
run: cp ./dist/run.exe ./dist/quit-windows.exe | |
- name: Upload Binary Releases 🚀 | |
uses: actions/upload-artifact@v4 | |
with: | |
name: binary-releases | |
path: | | |
dist/quit-windows.exe | |
dist/quit-linux | |
dist/quit-macos | |
docker: | |
runs-on: ubuntu-22.04 | |
needs: build | |
steps: | |
- name: Download build | |
uses: actions/download-artifact@v4 | |
with: | |
name: wheel-and-source | |
path: dist | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to DockerHub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: | | |
aksw/quitstore | |
ghcr.io/aksw/quitstore | |
- name: Build and push for many architectures | |
id: docker_build_tagged | |
uses: docker/build-push-action@v5 | |
with: | |
push: ${{ github.event_name != 'pull_request' }} | |
platforms: 'linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64,linux/ppc64le' | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
build-contexts: dist=./dist |