RCM_CI #225
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
# 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" ] | |
tags: | |
- v* | |
pull_request: | |
branches: [ "dev" ] | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
env: | |
RCM_CHECKOUT: "." | |
PYTHON_VERSION: "3.10.11" | |
PYENV_VERSION: "2.3.35" | |
PARAMIKO_PULL: "2258" | |
PARAMIKO_COMMIT: "1a45c7ec74cf8ee1d537e3ca032e7fef40fa62b3" | |
TURBOVNC_DOWNLOAD: "https://github.com/TurboVNC/turbovnc/releases/download" | |
TURBOVNC_EXTERNAL: "rcm/client/external/turbovnc" | |
SMALLSTEP_DOWNLOAD: "https://github.com/smallstep/cli/releases/download" | |
SMALLSTEP_VERSION: "0.25.2" | |
SMALLSTEP_EXTERNAL: "rcm/client/external/step" | |
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
jobs: | |
# This workflow contains a single job called "build" | |
build: | |
strategy: | |
matrix: | |
os: | |
- windows-latest | |
- ubuntu-latest | |
- ubuntu-20.04 | |
turbovnc-version: | |
- '3.1' | |
- '2.2.7' | |
include: | |
- os: macos-latest | |
turbovnc-version: 'none' | |
# 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: | |
- name: Install Qt missing libraries (linux only) | |
uses: awalsh128/cache-apt-pkgs-action@latest | |
if: ${{ contains(matrix.os, 'ubuntu') }} | |
with: | |
packages: qtbase5-dev qt5-qmake qtwayland5 | |
version: 1.0-${{ matrix.os }} | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- name: Checkout RCM | |
uses: actions/[email protected] | |
# CACHE | |
- name: (GHO) Cache pyenv | |
uses: actions/[email protected] | |
id: cache-pyenv | |
with: | |
path: .pyenv | |
key: pyenv-${{ env.PYENV_VERSION }}-python-${{ env.PYTHON_VERSION }}-${{ matrix.os }} | |
- name: (GHO) Cache venv | |
uses: actions/[email protected] | |
id: cache-venv | |
with: | |
path: .venv | |
key: venv-${{ hashFiles( format('{0}/rcm/client/requirements.txt', env.RCM_CHECKOUT ) ) }}-paramiko-${{ env.PARAMIKO_PULL }}-${{env.PARAMIKO_COMMIT}}-${{ matrix.os }} | |
- name: (GHO) Cache turbovnc | |
uses: actions/[email protected] | |
id: cache-turbovnc | |
with: | |
path: ${{ env.RCM_CHECKOUT }}/${{ env.TURBOVNC_EXTERNAL }} | |
key: turbovnc-${{ matrix.turbovnc-version }}-${{ matrix.os }} | |
- name: (GHO) Cache step | |
uses: actions/[email protected] | |
id: cache-step | |
with: | |
path: ${{ env.RCM_CHECKOUT }}/${{ env.SMALLSTEP_EXTERNAL }} | |
key: step-${{ matrix.os }} | |
# PYTHON | |
- name: Setup pyenv environment | |
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: ${{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" | |
# VENV | |
- name: Install venv | |
uses: carlkidcrypto/[email protected] | |
if: ${{ steps.cache-venv.outputs.cache-hit != 'true' }} | |
with: | |
macos: . "${RCM_CHECKOUT}/scripts/ci/03-install-venv.sh" | |
linux: . "${RCM_CHECKOUT}/scripts/ci/03-install-venv.sh" | |
windows: . "${env:RCM_CHECKOUT}\scripts\ci\03-install-venv.ps1" | |
# TURBOVNC | |
- name: Extract TurboVNC | |
uses: carlkidcrypto/[email protected] | |
if: ${{ steps.cache-turbovnc.outputs.cache-hit != 'true' }} | |
env: | |
TURBOVNC_VERSION : ${{ matrix.turbovnc-version }} | |
with: | |
linux: . "${RCM_CHECKOUT}/scripts/ci/04a-extract-turbovnc-ubuntu.sh" | |
windows: . "${env:RCM_CHECKOUT}\scripts\ci\04a-extract-turbovnc.ps1" | |
- name: Patch TurboVNC 3.x | |
uses: carlkidcrypto/[email protected] | |
if: ${{ steps.cache-turbovnc.outputs.cache-hit != 'true' && startsWith(matrix.turbovnc-version, '3') }} | |
env: | |
ORIG_LINE : 'jdk.tls.disabledAlgorithms=SSLv3, TLSv1, TLSv1.1, RC4, DES, MD5withRSA,' | |
NEW_LINE : 'jdk.tls.disabledAlgorithms=SSLv3, RC4, DES, MD5withRSA,' | |
with: | |
linux: . "${RCM_CHECKOUT}/scripts/ci/04b-patch-turbovnc-linux.sh" | |
windows: . "${env:RCM_CHECKOUT}\scripts\ci\04b-patch-turbovnc.ps1" | |
# EXTERNAL STEP | |
- name: External step | |
uses: carlkidcrypto/[email protected] | |
if: ${{ steps.cache-step.outputs.cache-hit != 'true' }} | |
with: | |
linux: . "${RCM_CHECKOUT}/scripts/ci/05-extract-step-linux.sh" | |
windows: . "${env:RCM_CHECKOUT}\scripts\ci\05-extract-step.ps1" | |
# EXTERNAL PLINK | |
- name: External plink (windows) | |
uses: carlkidcrypto/[email protected] | |
with: | |
windows: . "${env:RCM_CHECKOUT}\scripts\ci\06-download-plink.ps1" | |
# PYINSTALLER | |
- name: Build pyinstaller | |
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 | |
mv rcm rcm_bck | |
find dist -type f -name "RCM${EXT}" -exec cp '{}' . \; | |
find 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 }} | |
- name: (GHO)(TAG) Upload exe to release | |
if: ${{ github.event_name == 'push' && contains(github.ref, 'refs/tags/') }} | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
file: RCM${{ env.EXT }} | |
asset_name: RCM-client_${{ matrix.os }}_turbovnc_${{ matrix.turbovnc-version }}${{ env.EXT }} | |
prerelease: true | |
overwrite: true | |
tag: ${{ github.ref }} | |
- name: (GHO)(TAG) Upload sign to release | |
if: ${{ github.event_name == 'push' && contains(github.ref, 'refs/tags/') }} | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
file: RCM.sig | |
asset_name: RCM-client_${{ matrix.os }}_turbovnc_${{ matrix.turbovnc-version }}.sig | |
prerelease: true | |
overwrite: true | |
tag: ${{ github.ref }} | |
- name: (GHO) Upload exe | |
if: ${{ github.event_name != 'push' && !contains(github.ref, 'refs/tags/') }} | |
uses: actions/[email protected] | |
with: | |
name: RCM-client-${{ matrix.os }}-turbovnc-${{ matrix.turbovnc-version }} | |
path: | | |
RCM${{ env.EXT }} | |
RCM.sig | |
RCM.pub | |
- name: (GHO) Upload dir | |
if: ${{ github.event_name != 'push' && !contains(github.ref, 'refs/tags/') }} | |
uses: actions/[email protected] | |
with: | |
name: RCM-client-${{ matrix.os }}-turbovnc-${{ matrix.turbovnc-version }}-dir | |
path: | | |
RCM.zip | |
RCM-zip.sig | |
RCM.pub | |
- name: (GHO) Restore RCM-repo | |
shell: bash | |
run: | | |
rm -rf RCM RCM.exe RCM-dir | |
mv rcm_bck rcm | |
upload-public-key: | |
runs-on: ubuntu-latest | |
if: ${{ github.event_name == 'push' && contains(github.ref, 'refs/tags/') }} | |
steps: | |
- name: (GHO) Sign image with a key | |
run: echo "${{ env.COSIGN_PUBLIC_KEY }}" > RCM.pub | |
env: | |
COSIGN_PUBLIC_KEY: ${{ secrets.COSIGN_PUBLIC_KEY }} | |
- name: (GHO)(TAG) Upload exe to release | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
file: RCM.pub | |
asset_name: RCM.pub | |
prerelease: true | |
overwrite: true | |
tag: ${{ github.ref }} | |
nightly-link: | |
runs-on: ubuntu-latest | |
if: ${{ always() }} && ${{ github.event_name != 'push' && !contains(github.ref, 'refs/tags/') }} | |
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" |