====SSH====
===Ajout d'une clé SSH===
Pour pouvoir pousser sur un dépôt automatiquement.
* Création de la clé
Il faut commencer par [[prog:ssh|créer la clé d'authentification]] (sans mot de passe, au format ''RSA PRIVATE KEY'').
* Ajout de la clé au dépôt à modifier
Puis ouvrir le fichier ''file.key.pub'' et créer une clé de déploiement à l'adresse [[https://github.com/USER/PROJET/settings/keys]]
{{:prog:ssh:ssh_github_deploy_keys.png?400|}}
Bien sûr, cocher ''Allow write access''.
* Ajout de la clé au dépôt voulant pousser vers le dépôt à modifier
Ajouter le contenu du fichier key converti au format ''%%-----BEGIN RSA PRIVATE KEY-----%%'' (voir [[prog:ssh#creation_d_une_cle|Création d'une clé]]) à l'adresse [[https://github.com/USER/PROJET/settings/secrets/actions]]
{{:prog:github:ssh_github_actions_secrets.png?400|}}
* Configurer le projet pour utiliser la clé
- name: Install SSH key
uses: shimataro/ssh-key-action@v2
with:
key: ${{ secrets.SSH_KEY_TRAVIS_CI }}
known_hosts: # write here the content of `ssh-keyscan localhost` when executed on the CI machine of course.
- name: Publish results
run: |
eval `ssh-agent`
# ~/.ssh/id_rsa is when shimataro/ssh-key-action@v2 installed the key.
ssh-add ~/.ssh/id_rsa
git clone depot_a_modifier
cd xxx
# insert modification
git add
git commit -m "text"
# Here you should success
git push
Sous Windows, ''ssh-keyscan localhost'' ne fonctionne pas. On peut directement mettre le résultat de ''ssh-keyscan -t rsa github.com''.
====Serveurs====
===/proc/cpuinfo===
2 processeurs :
processor : 1 et 2
vendor_id : GenuineIntel
cpu family : 6
model : 79
model name : Intel(R) Xeon(R) CPU E5-2673 v4 @ 2.30GHz
stepping : 1
microcode : 0xffffffff
cpu MHz : 2294.686
cache size : 51200 KB
physical id : 0
siblings : 2
core id : 0
cpu cores : 2
apicid : 0
initial apicid : 0
fpu : yes
fpu_exception : yes
cpuid level : 20
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc rep_good nopl xtopology cpuid pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 movbe popcnt aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch invpcid_single pti fsgsbase bmi1 hle avx2 smep bmi2 erms invpcid rtm rdseed adx smap xsaveopt md_clear
bugs : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs taa itlb_multihit
bogomips : 4589.37
clflush size : 64
cache_alignment : 64
address sizes : 46 bits physical, 48 bits virtual
power management:
===/etc/apt/sources.list===
## Note, this file is written by cloud-init on first boot of an instance
## modifications made here will not survive a re-bundle.
## if you wish to make changes you can:
## a.) add 'apt_preserve_sources_list: true' to /etc/cloud/cloud.cfg
## or do the same in user-data
## b.) add sources in /etc/apt/sources.list.d
## c.) make changes to template file /etc/cloud/templates/sources.list.tmpl
# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://azure.archive.ubuntu.com/ubuntu/ focal main restricted
# deb-src http://azure.archive.ubuntu.com/ubuntu/ focal main restricted
## Major bug fix updates produced after the final release of the
## distribution.
deb http://azure.archive.ubuntu.com/ubuntu/ focal-updates main restricted
# deb-src http://azure.archive.ubuntu.com/ubuntu/ focal-updates main restricted
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
deb http://azure.archive.ubuntu.com/ubuntu/ focal universe
# deb-src http://azure.archive.ubuntu.com/ubuntu/ focal universe
deb http://azure.archive.ubuntu.com/ubuntu/ focal-updates universe
# deb-src http://azure.archive.ubuntu.com/ubuntu/ focal-updates universe
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb http://azure.archive.ubuntu.com/ubuntu/ focal multiverse
# deb-src http://azure.archive.ubuntu.com/ubuntu/ focal multiverse
deb http://azure.archive.ubuntu.com/ubuntu/ focal-updates multiverse
# deb-src http://azure.archive.ubuntu.com/ubuntu/ focal-updates multiverse
## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
deb http://azure.archive.ubuntu.com/ubuntu/ focal-backports main restricted universe multiverse
# deb-src http://azure.archive.ubuntu.com/ubuntu/ focal-backports main restricted universe multiverse
## Uncomment the following two lines to add software from Canonical's
## 'partner' repository.
## This software is not part of Ubuntu, but is offered by Canonical and the
## respective vendors as a service to Ubuntu users.
# deb http://archive.canonical.com/ubuntu focal partner
# deb-src http://archive.canonical.com/ubuntu focal partner
deb http://security.ubuntu.com/ubuntu focal-security main restricted
# deb-src http://security.ubuntu.com/ubuntu focal-security main restricted
deb http://security.ubuntu.com/ubuntu focal-security universe
# deb-src http://security.ubuntu.com/ubuntu focal-security universe
deb http://security.ubuntu.com/ubuntu focal-security multiverse
# deb-src http://security.ubuntu.com/ubuntu focal-security multiverse
===env===
Voir [[https://docs.github.com/en/actions/reference/environment-variables|Environment variables]] {{ :prog:githubactions:environment_variables_-_github_docs_2021-06-27_15_28_16_.html |Archive du 24/06/2021 le 27/06/2021}}
SELENIUM_JAR_PATH=/usr/share/java/selenium-server-standalone.jar
CONDA=/usr/share/miniconda
GITHUB_WORKSPACE=/home/runner/work/jessica/jessica
JAVA_HOME_11_X64=/usr/lib/jvm/adoptopenjdk-11-hotspot-amd64
GITHUB_PATH=/home/runner/work/_temp/_runner_file_commands/add_path_199a78a9-6d56-44de-96e0-31e3d0ec5c8d
GITHUB_ACTION=run2
JAVA_HOME=/usr/lib/jvm/adoptopenjdk-11-hotspot-amd64
GITHUB_RUN_NUMBER=286
GRADLE_HOME=/usr/share/gradle-7.0.2
XDG_CONFIG_HOME=/home/runner/.config
DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
ANT_HOME=/usr/share/ant
JAVA_HOME_8_X64=/usr/lib/jvm/adoptopenjdk-8-hotspot-amd64
HOMEBREW_PREFIX="/home/linuxbrew/.linuxbrew"
HOMEBREW_CLEANUP_PERIODIC_FULL_DAYS=3650
BOOTSTRAP_HASKELL_NONINTERACTIVE=1
***
PIPX_BIN_DIR=/opt/pipx_bin
DEPLOYMENT_BASEPATH=/opt/runner
GITHUB_ACTIONS=true
ANDROID_NDK_LATEST_HOME=/usr/local/lib/android/sdk/ndk/22.1.7171670
GITHUB_SHA=5bcc406df60fcf617baec49cf66436cfac3f35d8
POWERSHELL_DISTRIBUTION_CHANNEL=GitHub-Actions-ubuntu20
DOTNET_MULTILEVEL_LOOKUP=0
GITHUB_REF=refs/heads/master
RUNNER_OS=Linux
HOME=/home/runner
GITHUB_API_URL=https://api.github.com
LANG=C.UTF-8
RUNNER_TRACKING_ID=github_0c419c59-170c-44ec-90e9-9b7328f5b6ba
RUNNER_TEMP=/home/runner/work/_temp
GITHUB_ENV=/home/runner/work/_temp/_runner_file_commands/set_env_199a78a9-6d56-44de-96e0-31e3d0ec5c8d
GITHUB_EVENT_PATH=/home/runner/work/_temp/_github_workflow/event.json
INVOCATION_ID=82c3e95da20a49b79e0f36288d8232d1
GITHUB_EVENT_NAME=workflow_run
GITHUB_RUN_ID=976282352
ANDROID_NDK_HOME=/usr/local/lib/android/sdk/ndk-bundle
HOMEBREW_NO_AUTO_UPDATE=1
GITHUB_ACTOR=bansan85
NVM_DIR=/home/runner/.nvm
ANDROID_HOME=/usr/local/lib/android/sdk
GOROOT_1_14_X64=/opt/hostedtoolcache/go/1.14.15/x64
GITHUB_GRAPHQL_URL=https://api.github.com/graphql
RUNNER_USER=runner
ACCEPT_EULA=Y
USER=runner
GITHUB_SERVER_URL=https://github.com
HOMEBREW_CELLAR="/home/linuxbrew/.linuxbrew/Cellar"
PIPX_HOME=/opt/pipx
GECKOWEBDRIVER=/usr/local/share/gecko_driver
CHROMEWEBDRIVER=/usr/local/share/chrome_driver
SHLVL=1
ANDROID_SDK_ROOT=/usr/local/lib/android/sdk
VCPKG_INSTALLATION_ROOT=/usr/local/share/vcpkg
HOMEBREW_REPOSITORY="/home/linuxbrew/.linuxbrew/Homebrew"
RUNNER_TOOL_CACHE=/opt/hostedtoolcache
ImageVersion=20210614.1
DOTNET_NOLOGO=1
GRAALVM_11_ROOT=/usr/local/graalvm/graalvm-ce-java11-21.1.0
GITHUB_JOB=build
AZURE_EXTENSION_DIR=/opt/az/azcliextensions
PERFLOG_LOCATION_SETTING=RUNNER_PERFLOG
GITHUB_REPOSITORY=bansan85/jessica
CHROME_BIN=/usr/bin/google-chrome
ANDROID_NDK_ROOT=/usr/local/lib/android/sdk/ndk-bundle
GITHUB_RETENTION_DAYS=90
JOURNAL_STREAM=8:22578
RUNNER_WORKSPACE=/home/runner/work/jessica
LEIN_HOME=/usr/local/lib/lein
LEIN_JAR=/usr/local/lib/lein/self-installs/leiningen-2.9.6-standalone.jar
GITHUB_ACTION_REPOSITORY=
PATH=/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin:/home/runner/.local/bin:/opt/pipx_bin:/usr/share/rust/.cargo/bin:/home/runner/.config/composer/vendor/bin:/usr/local/.ghcup/bin:/home/runner/.dotnet/tools:/snap/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
RUNNER_PERFLOG=/home/runner/perflog
GITHUB_BASE_REF=
CI=true
SWIFT_PATH=/usr/share/swift/usr/bin
ImageOS=ubuntu20
GITHUB_REPOSITORY_OWNER=bansan85
GITHUB_HEAD_REF=
GITHUB_ACTION_REF=
GITHUB_WORKFLOW=Emscripten
DEBIAN_FRONTEND=noninteractive
GOROOT_1_15_X64=/opt/hostedtoolcache/go/1.15.13/x64
AGENT_TOOLSDIRECTORY=/opt/hostedtoolcache
GOROOT_1_16_X64=/opt/hostedtoolcache/go/1.16.5/x64
_=/usr/bin/env
====Exemples====
===Projets en cmake===
En plus de la configuration / compilation / test avec cmake, il y a une procédure pour initialiser et commiter vers un dépôt externe.
Sous Linux :
{{gh>https://github.com/bansan85/jessica/blob/master/.github/workflows/build-linux.yml}}
Sous Windows, inclus vcpkg :
{{gh>https://github.com/bansan85/jessica/blob/master/.github/workflows/build-windows.yml}}
====Variables====
* Variable globale ''github''
''github.event.workflow_run.conclusion'' : ''success'' / ''failure'' en fonction du succès du précédent workflow.
''github.event.workflow_run.head_branch'' : ''master'' ou le nom de la branche.
Pour avoir la liste de tous les paramètres et leurs valeurs, on peut simplement ajouter dans un workflow :
- name: Show github variable
env:
GITHUB_VAR: ${{ toJSON(github) }}
run: exit 0
[[https://docs.github.com/en/actions/reference/events-that-trigger-workflows|workflow]] {{ :prog:githubactions:events_that_trigger_workflows_-_github_docs_2021-05-09_20_16_52_.html |Archive du 05/05/2021 le 09/05/2021}}
* Variable globale de github et double quote
Certaines variables à l'intérieur de la variable globale ''github'' peuvent contenir des doubles quotes. Par exemple, ''github.event.head_commit.message'' contient le log du commit.
Cela pose un problème si on veut utiliser utiliser cette variable dans un script bash car il est impossible de faire une substitution des double quotes.
La solution est de passer par une variable d'environnement pour enfin utiliser la substitution bash ''%%${variable//\"/\"\"}%%'':
- env:
COMMIT_MESSAGE: ${{ github.event.head_commit.message }}
run: |
echo "${COMMIT_MESSAGE//\"/\"\"}"
====Fonctions====
Quand on utilise une fonction, les variables n'ont pas à être ''%%${{ xxx }}%%'':
if: contains(matrix.cc, 'clang')
Dans ce cas, il n'est plus possible d'utiliser le formatage : ''Compilateur : %%${{ matrix.cc }}%%''. Il faut utiliser la fonction ''format'' :
if: contains( format('Compilateur : {0}', matrix.cc), 'clang')
[[https://docs.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions|Context and expression syntax for GitHub Actions]] {{ :prog:githubactions:context_and_expression_syntax_for_github_actions_-_github_docs_2021-06-12_19_03_51_.html |Archive du 25/05/2021 le 12/06/2021}}
====Marketplace====
===codecov===
Envoyer les données à codecov :
git clone --depth 1 https://github.com/henry2cox/lcov.git -b diffcov_initial
./lcov/bin/lcov --capture --directory build --gcov-tool /usr/bin/gcov-10 --rc lcov_branch_coverage=1 --output-file build/coverage.info
./lcov/bin/lcov --remove build/coverage.info "/usr/include/*" --rc lcov_branch_coverage=1 -o build/coverage2.info
bash <(curl -s https://codecov.io/bash) -f build/coverage2.info
Le badge par défaut : [[https://codecov.io/gh/bansan85/jessica/branch/master/graph/badge.svg]] {{https://codecov.io/gh/bansan85/jessica/branch/master/graph/badge.svg}}
* Flags coté validation github
Les flags peuvent se définir de deux façons différentes. Soit les flags pour la validation des build Github, soit les flags pour le badge.
Pour la validation des build Github, un simple fichier de configuration est possible. Il va s'occuper de séparer les pourcentages de couverture en fonction des chemins des fichiers.
---
coverage:
status:
project:
backend:
target: auto
paths:
- src/backend
- include/jessica
Cela va bien ajouter une ligne. Exemple ci-dessous avec ''demo'' et ''index''.
{{:prog:githubactions:codecov-check.png?544|}}
Il est possible de désactiver la validation d'une build en fonction des indicateurs de couverture.
---
coverage:
status:
patch: false
project: false
* Flags coté badge
Par contre, les flags ne fonctionnent pas avec les badges. Pour les faire fonctionner, il faut pousser une couverture de code spécifique au flag dédié avec l'option ''-F''.
git clone --depth 1 https://github.com/henry2cox/lcov.git -b diffcov_initial
./lcov/bin/lcov --capture --directory build --gcov-tool /usr/bin/gcov-10 --rc lcov_branch_coverage=1 --output-file build/coverage.info
./lcov/bin/lcov --remove build/coverage.info "/usr/include/*" --rc lcov_branch_coverage=1 -o build/coverage2.info
bash <(curl -s https://codecov.io/bash) -f build/coverage2.info
./lcov/bin/lcov --extract build/coverage.info "*/include/jessica/*" "*/src/backend/*" --rc lcov_branch_coverage=1 -o build/coverage_backend.info
bash <(curl -s https://codecov.io/bash) -f build/coverage_backend.info -F backend
Là, le badge ''https://codecov.io/gh/bansan85/jessica/branch/master/graph/badge.svg?flag=backend'' fonctionne.