Outils pour utilisateurs

Outils du site


prog:githubactions

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentesRévision précédente
Prochaine révision
Révision précédente
prog:githubactions [2021/04/20 22:22] – Ajout de codecov.io rootprog:githubactions [2021/07/14 23:55] (Version actuelle) – [Variables] : ajout du code yaml pour afficher une variable du workflow root
Ligne 1: Ligne 1:
-====Github actions====+====SSH====
 ===Ajout d'une clé SSH=== ===Ajout d'une clé SSH===
  
Ligne 45: Ligne 45:
  
 Sous Windows, ''ssh-keyscan localhost'' ne fonctionne pas. On peut directement mettre le résultat de ''ssh-keyscan -t rsa github.com''. 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=== ===/proc/cpuinfo===
  
Ligne 78: Ligne 80:
 </code> </code>
  
-===Exemples===+===/etc/apt/sources.list===
  
-  * cmake+<code bash> 
 +## 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'
 +## '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 
 +</code> 
 + 
 +===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}} 
 + 
 +<code bash> 
 +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 
 +</code> 
 + 
 +====Exemples==== 
 + 
 +===Projets en cmake===
  
-En plus de cmake, il y a une procédure pour initialiser et commiter vers un dépôt externe.+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 : Sous Linux :
Ligne 92: Ligne 249:
 {{gh>https://github.com/bansan85/jessica/blob/master/.github/workflows/build-windows.yml}} {{gh>https://github.com/bansan85/jessica/blob/master/.github/workflows/build-windows.yml}}
  
 +====Variables====
  
-====Extensions====+  * 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 : 
 + 
 +<code yaml> 
 +      - name: Show github variable 
 +        env: 
 +          GITHUB_VAR: ${{ toJSON(github) }} 
 +        run: exit 0 
 +</code> 
 + 
 +[[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//\"/\"\"}%%'': 
 + 
 +<code yaml> 
 +      - env: 
 +          COMMIT_MESSAGE: ${{ github.event.head_commit.message }} 
 +        run: | 
 +          echo "${COMMIT_MESSAGE//\"/\"\"}" 
 +</code> 
 +====Fonctions==== 
 + 
 +Quand on utilise une fonction, les variables n'ont pas à être ''%%${{ xxx }}%%'': 
 + 
 +<code yaml> 
 +if: contains(matrix.cc, 'clang'
 +</code> 
 + 
 +Dans ce cas, il n'est plus possible d'utiliser le formatage : ''Compilateur : %%${{ matrix.cc }}%%''. Il faut utiliser la fonction ''format''
 + 
 +<code yaml> 
 +if: contains( format('Compilateur : {0}', matrix.cc), 'clang'
 +</code> 
 + 
 +[[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=== ===codecov===
Ligne 108: Ligne 312:
 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}} 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+  * 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. 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.
Ligne 129: Ligne 333:
  
 {{:prog:githubactions:codecov-check.png?544|}} {{:prog:githubactions:codecov-check.png?544|}}
 +
 +Il est possible de désactiver la validation d'une build en fonction des indicateurs de couverture.
 +
 +<file yaml .codecov.yml>
 +---
 +coverage:
 +    status:
 +        patch: false
 +        project: false
 +</file>
 +
 +  * 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''. 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''.
prog/githubactions.1618950122.txt.gz · Dernière modification : 2021/04/20 22:22 de root