This repository has been archived by the owner on Oct 9, 2024. It is now read-only.
Update README.md with links to vscode-ansible docs #842
Workflow file for this run
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
# alternative KISS pipeline to bloated ci.yml, modeled after vscode-ansible one. | |
name: task | |
# Controls when the action will run. Triggers the workflow on push or pull request | |
# events but only for the main branch | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} | |
cancel-in-progress: true | |
env: | |
FORCE_COLOR: "1" # make mocha output colorful | |
# https://docs.github.com/en/actions/learn-github-actions/environment-variables | |
# https://devblogs.microsoft.com/commandline/share-environment-vars-between-wsl-and-windows/ | |
WSLENV: HOSTNAME:CI:FORCE_COLOR:GITHUB_ACTION:GITHUB_ACTION_PATH/p:GITHUB_ACTION_REPOSITORY:GITHUB_WORKFLOW:GITHUB_WORKSPACE/p:GITHUB_PATH/p | |
# We define a hostname because otherwise the variable might not always be accessible on runners. | |
HOSTNAME: gha | |
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
jobs: | |
test: | |
env: | |
# to expose matrix job name to steps, which is not possible with expansions | |
JOB_NAME: ${{ matrix.name || matrix.task-name }} | |
SKIP_PODMAN: ${{ matrix.skip_podman || '0' }} | |
SKIP_DOCKER: ${{ matrix.skip_docker || '0' }} | |
name: ${{ matrix.name || matrix.task-name }} | |
# The type of runner that the job will run on | |
runs-on: ${{ matrix.os || 'ubuntu-22.04' }} | |
defaults: | |
run: | |
shell: ${{ matrix.shell || 'bash'}} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- ubuntu-22.04 | |
task-name: | |
- vscode | |
- test | |
- test-node-lts | |
upload-artifact: | |
- false | |
name: | |
- false | |
include: | |
- name: lint | |
task-name: lint | |
- name: docs | |
task-name: docs | |
- name: test-without-ee (wsl) | |
# runner does not support running container | |
task-name: test-without-ee | |
# https://github.com/actions/virtual-environments/issues/5151 | |
os: windows-2022 | |
shell: "wsl-bash {0}" | |
- name: test-without-ee (macos) | |
os: macos-12 | |
# runner does not support running container | |
task-name: test-without-ee | |
skip_docker: "1" | |
skip_podman: "1" | |
steps: | |
- name: Disable autocrlf | |
if: contains(matrix.os, 'windows') | |
run: |- | |
git config --global core.autocrlf false | |
git config --global core.eol lf | |
shell: bash # <-- keep it here to avoid using default shell | |
- uses: actions/checkout@v4 | |
- name: Setup asdf | |
if: "!contains(matrix.shell, 'wsl')" | |
uses: asdf-vm/actions/install@v3 | |
# https://github.com/marketplace/actions/setup-wsl | |
- name: Activate WSL | |
if: "contains(matrix.shell, 'wsl')" | |
uses: Vampire/setup-wsl@v2.0.2 | |
with: | |
set-as-default: 'true' | |
# we want to load user profile | |
# https://github.com/Vampire/setup-wsl#wsl-shell-command | |
wsl-shell-command: "bash -l -euo pipefail" | |
# https://github.com/MicrosoftDocs/WSL/blob/main/WSL/wsl-config.md#L159 | |
wsl-conf: | | |
[automount] | |
enabled = true | |
root = / | |
options = "metadata,umask=077" | |
[interop] | |
enabled = false | |
appendWindowsPath = false | |
[network] | |
hostname = wsl | |
additional-packages: | |
curl | |
dirmngr | |
gawk | |
git | |
gpg | |
make | |
python3-dev | |
python3-pip | |
python3-venv | |
qemu-user-static | |
xvfb | |
# asdf nodejs plugin requires: dirmngr gpg curl gawk | |
- name: Set up Python ${{ matrix.python_version || '3.10' }} | |
if: "!contains(matrix.shell, 'wsl')" | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python_version || '3.10' }} | |
- name: Enable caching | |
if: "!contains(matrix.shell, 'wsl')" | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.cache/npm | |
~/.cache/pip | |
~/.cache/yarn | |
~/Library/Caches/pip | |
key: > | |
${{ runner.os }}-${{ matrix.task-name }}-${{ hashFiles( | |
'package.json', | |
'package-lock.json', | |
'.config/Dockerfile' | |
) }} | |
- name: Enable caching for podman-machine | |
uses: actions/cache@v4 | |
if: "contains(matrix.os, 'macos')" | |
with: | |
path: | | |
~/.local/share/containers | |
~/.config/containers | |
key: ${{ runner.os }}-${{ matrix.task-name }}-${{ hashFiles('package.json', 'yarn.lock', '.config/Dockerfile', '**/Taskfile.yml', 'tools/*.*') }} | |
- name: Install asdf inside WSL | |
if: "contains(matrix.shell, 'wsl')" | |
run: | | |
set -ex | |
git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.14.0 | |
echo '. "$HOME/.asdf/asdf.sh"' >> ~/.bashrc | |
export ASDF_DIR="$HOME/.asdf" | |
. "$HOME/.asdf/asdf.sh" | |
asdf plugin add nodejs | |
asdf plugin add python | |
asdf plugin add task | |
asdf install | |
asdf info | |
- run: task setup | |
- name: task ${{ matrix.task-name }} | |
run: task -v ${{ matrix.task-name }} | |
### Uncomment to hold the runner node for debugging | |
# - uses: actions/checkout@v2 | |
# - name: Setup tmate session | |
# if: ${{ failure() }} | |
# uses: mxschmitt/action-tmate@v3 | |
- name: Gather logs | |
if: ${{ always() }} | |
run: | | |
mkdir -p out/vscode | |
cp -r ../vscode-ansible/out/userdata/logs/* out/vscode || true | |
- name: Upload test logs | |
if: ${{ always() }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: logs-${{ matrix.os }}-${{ matrix.task-name }}.zip | |
path: | | |
out/vscode | |
out/e2eTestReport | |
out/log | |
out/test-resources/settings/logs | |
out/userdata/logs | |
if-no-files-found: ignore | |
retention-days: 15 | |
- name: Stop services | |
if: "contains(matrix.os, 'macos')" | |
# Stopping podman machine is needed or caching it will fail | |
run: | | |
command -v podman && { | |
podman machine stop | |
while [[ "$(podman machine ls --format '{{.Running}}' \ | |
--noheading || true)" != "false" ]]; do | |
sleep 1 | |
echo -n . | |
done | |
echo . | |
} | |
continue-on-error: true | |
check: # This job does nothing and is only used for the branch protection | |
if: always() | |
runs-on: ubuntu-22.04 | |
needs: | |
- test | |
steps: | |
- name: Decide whether the needed jobs succeeded or failed | |
uses: re-actors/alls-green@release/v1 | |
with: | |
jobs: ${{ toJSON(needs) }} |