Skip to content

ci: fix pip install #211

ci: fix pip install

ci: fix pip install #211

Workflow file for this run

# This is a basic workflow to help you get started with Actions
name: RCM_CI
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the "main" branch
push:
branches: [ "dev", "feature/*" ]
tags:
- v*
pull_request:
branches: [ "dev" ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
env:
RCM_CHECKOUT: "rcm_repository"
PYTHON_VERSION: "3.10.11"
PYENV_VERSION: "2.3.35"
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
nightly-link:
runs-on: ubuntu-latest
steps:
- name: Generate Annotation
run: |
url="https://nightly.link/${{ github.repository }}/actions/runs/${{ github.run_id }}"
echo "::notice title=Download the artificats from nightly.link (without logging in) by visiting the URL below::$url"
build:
strategy:
matrix:
os:
- windows-latest
- ubuntu-latest
- ubuntu-20.04
turbovnc-version:
- '3.1'
- '2.2.7'
image:
- false
include:
- os: macos-latest
turbovnc-version: 'none'
image: false
- os: ubuntu-latest
turbovnc-version: '3.1'
image: 'ubuntu-18.04'
- os: ubuntu-latest
turbovnc-version: '2.2.7'
image: 'ubuntu-18.04'
# The type of runner that the job will run on
runs-on: ${{ matrix.os }}
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Checkout RCM
uses: actions/[email protected]
with:
path: ${{ env.RCM_CHECKOUT }}
- name: Install Qt missing libraries (linux only)
uses: awalsh128/cache-apt-pkgs-action@latest
if: ${{ ! matrix.image && contains(matrix.os, 'ubuntu') }}
with:
packages: qtbase5-dev qt5-qmake qtwayland5
version: 1.0-${{ matrix.os }}
- name: Build Docker (Docker only)
if: ${{ matrix.image && contains(matrix.os, 'ubuntu') }}
run: docker build -t rcm "${RCM_CHECKOUT}/scripts/ci/"
- name: Setup env and build executable (Docker only)
if: ${{ matrix.image && contains(matrix.os, 'ubuntu') }}
run: |
docker run \
-v ${RCM_CHECKOUT}:/RCM \
--env RCM_INSTALL_EXTERNAL=true \
--env RCM_CHECKOUT='.' \
--env PYTHON_VERSION=${PYTHON_VERSION} \
--env PYENV_VERSION=${PYENV_VERSION} \
--env TURBOVNC_VERSION=${{ matrix.turbovnc-version }} \
rcm \
bash -c "source scripts/ci/01-setup-pyenv.sh && . scripts/ci/02-install-python.sh && python -m venv .venv && source .venv/bin/activate && pip install ".[dev]" && pyinstaller rcm/client/rcm_client_qt.spec"
# CACHE
- name: (GHO) Cache pyenv
if: ${{ ! matrix.image }}
uses: actions/[email protected]
id: cache-pyenv
with:
path: .pyenv
key: pyenv-${{ env.PYENV_VERSION }}-python-${{ env.PYTHON_VERSION }}-${{ matrix.os }}
# PYTHON
- name: Setup pyenv environment
if: ${{ ! matrix.image }}
uses: carlkidcrypto/[email protected]
with:
macos: . "${RCM_CHECKOUT}/scripts/ci/01-setup-pyenv.sh"
linux: . "${RCM_CHECKOUT}/scripts/ci/01-setup-pyenv.sh"
windows: . "${env:RCM_CHECKOUT}\scripts\ci\01-setup-pyenv.ps1"
- name: Install pyenv locally
if: ${{ ! matrix.image && steps.cache-pyenv.outputs.cache-hit != 'true' }}
uses: carlkidcrypto/[email protected]
with:
macos: . "${RCM_CHECKOUT}/scripts/ci/02-install-python.sh"
linux: . "${RCM_CHECKOUT}/scripts/ci/02-install-python.sh"
windows: . "${env:RCM_CHECKOUT}\scripts\ci\02-install-python.ps1"
# - name: (GHO) Cache venv
# uses: actions/[email protected]
# id: cache-venv
# with:
# path: .venv
# key: venv-${{ hashFiles( format('{0}/pyproject.toml', env.RCM_CHECKOUT )) }}${{ hashFiles( format('{0}/scripts/external_hook.py', env.RCM_CHECKOUT )) }}-turbovnc-${{ matrix.turbovnc-version }}-${{ matrix.image || matrix.os }}
# if: ${{steps.cache-pyenv.outputs.cache-hit != 'true' }}
- name: Install venv and RCM-client
if: ${{ ! matrix.image }}
uses: carlkidcrypto/[email protected]
with:
macos: |
python -m venv ".venv"
source ".venv/bin/activate"
export RCM_INSTALL_EXTERNAL=true
export TURBOVNC_VERSION=${{ matrix.turbovnc-version }}
cd ${RCM_CHECKOUT:?}
pip install rcm ".[dev]"
linux: |
python -m venv ".venv"
source ".venv/bin/activate"
export RCM_INSTALL_EXTERNAL=true
export TURBOVNC_VERSION=${{ matrix.turbovnc-version }}
cd ${RCM_CHECKOUT:?}
pip install rcm ".[dev]"
windows: |
python.exe -m venv ".venv"
. ".venv\Scripts\Activate.ps1"
$env:RCM_INSTALL_EXTERNAL = "true"
$env:TURBOVNC_VERSION = ${{ matrix.turbovnc-version }}
cd ${RCM_CHECKOUT:?}
pip install rcm ".[dev]"
# PYINSTALLER
- name: Build pyinstaller
if: ${{ ! matrix.image }}
uses: carlkidcrypto/[email protected]
with:
macos: |
source ".venv/bin/activate"
pyinstaller "${RCM_CHECKOUT}/rcm/client/rcm_client_qt.spec"
linux: |
source ".venv/bin/activate"
pyinstaller "${RCM_CHECKOUT}/rcm/client/rcm_client_qt.spec"
windows: |
. ".venv\Scripts\Activate.ps1"
pyinstaller "${env:RCM_CHECKOUT}\rcm\client\rcm_client_qt.spec"
# ARTIFACT
- name: (GHO) Define EXT
uses: carlkidcrypto/[email protected]
with:
macos: echo "EXT=" >> "${GITHUB_ENV}"
linux: echo "EXT=" >> "${GITHUB_ENV}"
windows: echo "EXT=.exe" >> "${env:GITHUB_ENV}"
- name: (GHO) Move preartifacts
shell: bash
run: |
# https://github.com/actions/upload-artifact?tab=readme-ov-file#permission-loss
find "${RCM_CHECKOUT}/dist" -type f -name "RCM${EXT}" -exec cp '{}' . \;
find "${RCM_CHECKOUT}/dist" -type f -name "RCM.zip" -exec cp '{}' . \;
- name: (GHO) Install cosign
uses: sigstore/[email protected]
- name: (GHO) Sign image with a key
shell: bash
run: |
cosign sign-blob --yes --key env://COSIGN_PRIVATE_KEY --output-signature "RCM.sig" "RCM${EXT}"
cosign sign-blob --yes --key env://COSIGN_PRIVATE_KEY --output-signature "RCM-zip.sig" "RCM.zip"
cosign verify-blob --key env://COSIGN_PUBLIC_KEY --signature "RCM.sig" "RCM${EXT}"
cosign verify-blob --key env://COSIGN_PUBLIC_KEY --signature "RCM-zip.sig" "RCM.zip"
echo "${{ env.COSIGN_PUBLIC_KEY }}" > RCM.pub
env:
COSIGN_PRIVATE_KEY: ${{ secrets.COSIGN_PRIVATE_KEY }}
COSIGN_PUBLIC_KEY: ${{ secrets.COSIGN_PUBLIC_KEY }}
COSIGN_PASSWORD: ${{ secrets.COSIGN_PASSWORD }}
# Always upload as artifact
- name: (GHO) Upload dir
uses: actions/[email protected]
with:
name: RCM-client-${{ matrix.image || matrix.os }}-turbovnc-${{ matrix.turbovnc-version }}-dir
path: |
RCM.zip
RCM-zip.sig
RCM.pub
- name: (GHO) Upload exe
uses: actions/[email protected]
with:
name: RCM-client-${{ matrix.image || matrix.os }}-turbovnc-${{ matrix.turbovnc-version }}
path: |
RCM${{ env.EXT }}
RCM.sig
RCM.pub
upload-public-key:
needs: build
runs-on: ubuntu-latest
if: ${{ ( github.event_name == 'push' && contains(github.ref, 'refs/tags/') ) || contains(github.ref, 'refs/heads/feature') }}
steps:
- name: Setup env
run: |
if ${{ github.event_name == 'push' && contains(github.ref, 'refs/tags/') }}; then
echo "IS_TAG=true" >> "${GITHUB_ENV}"
echo "TAG=${{ github.ref }}" >> "${GITHUB_ENV}"
echo "RELEASE_NAME=${{ github.ref }}" >> "${GITHUB_ENV}"
else
echo "IS_CD=" >> "${GITHUB_ENV}"
echo "TAG=dev" >> "${GITHUB_ENV}"
echo "RELEASE_NAME='Continuous dev'" >> "${GITHUB_ENV}"
fi
- name: Checkout RCM
if: ${{ env.IS_CD }}
uses: actions/[email protected]
with:
path: repo
- name: (GHO) Override dev tag
if: ${{ env.IS_CD }}
run: |
cd repo
git tag -f ${{ env.tag }}
git push origin --tags -f
# Clean release if exists
if gh release list | awk '{print $1}' | grep -q "^${{ env.tag }}$"; then
gh release delete ${{ env.tag }}
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: (GHO) Sign image with a key
run: echo "${{ env.COSIGN_PUBLIC_KEY }}" > RCM.pub
env:
COSIGN_PUBLIC_KEY: ${{ secrets.COSIGN_PUBLIC_KEY }}
- name: Upload exe to release
uses: svenstaro/upload-release-action@v2
with:
file: RCM.pub
asset_name: RCM.pub
prerelease: true
overwrite: true
release_name: ${{ env.RELEASE_NAME }}
tag: ${{ env.TAG }}
upload-release:
needs: upload-public-key
strategy:
matrix:
os:
- windows-latest
- ubuntu-latest
- ubuntu-20.04
turbovnc-version:
- '3.1'
- '2.2.7'
image:
- false
include:
- os: macos-latest
turbovnc-version: 'none'
image: false
- os: ubuntu-latest
turbovnc-version: '3.1'
image: 'ubuntu-18.04'
- os: ubuntu-latest
turbovnc-version: '2.2.7'
image: 'ubuntu-18.04'
# The type of runner that the job will run on
runs-on: ubuntu-latest
if: ${{ ( github.event_name == 'push' && contains(github.ref, 'refs/tags/') ) || contains(github.ref, 'refs/heads/feature') }}
steps:
- name: Setup env
run: |
if ${{ github.event_name == 'push' && contains(github.ref, 'refs/tags/') }}; then
echo "IS_TAG=true" >> "${GITHUB_ENV}"
echo "TAG=${{ github.ref }}" >> "${GITHUB_ENV}"
echo "RELEASE_NAME=${{ github.ref }}" >> "${GITHUB_ENV}"
else
echo "IS_CD=" >> "${GITHUB_ENV}"
echo "TAG=dev" >> "${GITHUB_ENV}"
echo "RELEASE_NAME='Continuous dev'" >> "${GITHUB_ENV}"
fi
- uses: actions/download-artifact@v4
with:
name: RCM-client-${{ matrix.image || matrix.os }}-turbovnc-${{ matrix.turbovnc-version }}
- name: Setup env
run: ls
# Upload to release when dev to continuous dev
- name: (GHO) Upload exe to release
uses: svenstaro/upload-release-action@v2
with:
file: RCM${{ env.EXT }}
asset_name: RCM-client_${{ matrix.image || matrix.os }}_turbovnc_${{ matrix.turbovnc-version }}${{ env.EXT }}
prerelease: true
overwrite: true
release_name: ${{ env.RELEASE_NAME }}
tag: ${{ env.TAG }}
- name: (GHO) Upload sig to release
uses: svenstaro/upload-release-action@v2
with:
file: RCM.sig
asset_name: RCM-client_${{ matrix.image || matrix.os }}_turbovnc_${{ matrix.turbovnc-version }}.sig
prerelease: true
overwrite: true
release_name: "Continuous dev"
tag: dev