Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DRAFT] Switch windows runner #1580

Draft
wants to merge 16 commits into
base: main
Choose a base branch
from
325 changes: 204 additions & 121 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -88,108 +88,191 @@ jobs:
SKIP_PODMAN: 1
SKIP_DOCKER: 1

- name: test (linux)
task-name: test

- name: test (macos)
task-name: test
os: macos-13-large
env:
SKIP_PODMAN: 1
SKIP_DOCKER: 1
# only until we fix some broken tests, as we need it to pass
# in order to enable the caching
continue-on-error: true
# - name: test (linux)
# task-name: test

# - name: test (macos)
# task-name: test
# os: macos-13-large
# env:
# SKIP_PODMAN: 1
# SKIP_DOCKER: 1
# # only until we fix some broken tests, as we need it to pass
# # in order to enable the caching
# continue-on-error: true

- name: test (wsl)
# runner does not support running containers
task-name: als:test-without-ee
log-name: als-test-without-ee
# https://github.com/actions/virtual-environments/issues/5151
os: devtools-win-x64
shell: "wsl-bash {0}"
env:
SKIP_PODMAN: 1
SKIP_DOCKER: 1
os: devtools-vscode-win11-x64
shell: bash
# /bin/cp /etc/skel/.bashrc ~/
# echo '. "$HOME/.asdf/asdf.sh"' >> ~/.bashrc
# echo 'export ASDF_DIR="$HOME/.asdf"' >> ~/.bashrc
steps:
- uses: actions/checkout@v4
# - uses: actions/checkout@v4
# with:
# fetch-depth: 0 # we need tags for dynamic versioning
# show-progress: false

# # https://github.com/marketplace/actions/setup-wsl
# - name: Activate WSL
# uses: Ubuntu/WSL/.github/actions/wsl-install@main
# with:
# distro: Ubuntu-22.04
# echo '. "$HOME/.asdf/asdf.sh"' >> ~/.bashrc


- name: Checkout in WSL
uses: alisonlhart/WSL/.github/actions/wsl-checkout@main
with:
fetch-depth: 0 # we need tags for dynamic versioning
show-progress: false
distro: Ubuntu-22.04
working-dir: /tmp/github/

# https://github.com/marketplace/actions/setup-wsl
- name: Activate WSL
if: contains(matrix.shell, 'wsl')
uses: Vampire/[email protected]
- name: Install dependencies
uses: Ubuntu/WSL/.github/actions/wsl-bash@main
with:
distro: Ubuntu-22.04
working-dir: /tmp/github/
exec: |
apt install -y curl dbus dirmngr docker gawk git gpg gpg-agent jq make podman python3-dev python3-full python3-venv qemu-user-static tar unzip xvfb apt-transport-https ca-certificates software-properties-common
apt install -y libnss3-dev libasound2 libgdk-pixbuf2.0-dev libgtk-3-dev libxss-dev
git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.14.0
. "$HOME/.asdf/asdf.sh"
asdf plugin add direnv
asdf plugin add nodejs
asdf plugin add python
asdf plugin add task
asdf plugin add yarn
asdf install
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -
add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
apt install -y docker-ce docker-ce-cli containerd.io
direnv --version
task --version
yarn --version
node --version
python3 --version
podman --version
docker --version

- name: task setup - wsl
uses: Ubuntu/WSL/.github/actions/wsl-bash@main
with:
distro: Ubuntu-22.04
working-dir: /tmp/github/
exec: |
. "$HOME/.asdf/asdf.sh"
export NODE_OPTIONS=--max_old_space_size=8192
task setup
- name: task package - wsl
uses: Ubuntu/WSL/.github/actions/wsl-bash@main
with:
distro: Ubuntu-22.04
working-dir: /tmp/github/
exec: |
. "$HOME/.asdf/asdf.sh"
export NODE_OPTIONS=--max_old_space_size=8192
task package ${{ matrix.env.TASKFILE_ARGS }}
- name: task unit
uses: Ubuntu/WSL/.github/actions/wsl-bash@main
with:
distribution: Ubuntu-22.04
set-as-default: "true"
# '-i' seems to be the only option that loads .bashrc file that we need
# https://github.com/Vampire/setup-wsl/discussions/54
wsl-shell-command: "bash -i -eo pipefail"
# https://github.com/MicrosoftDocs/WSL/blob/main/WSL/wsl-config.md#L159
wsl-conf: |
[automount]
enabled = true
root = /
options = "metadata,umask=077"
[boot]
command=/etc/init.d/dbus start
[interop]
enabled = false
appendWindowsPath = false
[network]
hostname = wsl
additional-packages: curl
dbus
dirmngr
gawk
git
gpg
gpg-agent
jq
make
python3-dev
python3-full
python3-venv
qemu-user-static
tar
unzip
xvfb
# asdf nodejs plugin requires: dirmngr gpg curl gawk
distro: Ubuntu-22.04
working-dir: /tmp/github/
exec: |
. "$HOME/.asdf/asdf.sh"
export NODE_OPTIONS=--max_old_space_size=8192
task unit ${{ matrix.env.TASKFILE_ARGS }}

# - name: task ui - wsl
# uses: Ubuntu/WSL/.github/actions/wsl-bash@main
# with:
# distro: Ubuntu-22.04
# working-dir: /tmp/github/vscode-ansible
# exec: |
# . "$HOME/.asdf/asdf.sh"
# export NODE_OPTIONS=--max_old_space_size=8192
# task ui ${{ matrix.env.TASKFILE_ARGS }}
- name: task e2e - wsl
uses: Ubuntu/WSL/.github/actions/wsl-bash@main
with:
distro: Ubuntu-22.04
working-dir: /tmp/github/
exec: |
. "$HOME/.asdf/asdf.sh"
export NODE_OPTIONS=--max_old_space_size=8192
task e2e ${{ matrix.env.TASKFILE_ARGS }}
- name: task als - wsl
uses: Ubuntu/WSL/.github/actions/wsl-bash@main
with:
distro: Ubuntu-22.04
working-dir: /tmp/github/
exec: |
. "$HOME/.asdf/asdf.sh"
export NODE_OPTIONS=--max_old_space_size=8192
task als ${{ matrix.env.TASKFILE_ARGS }}

# - name: task package
# id: package
# run: task package ${{ matrix.env.TASKFILE_ARGS }}

# - name: task ${{ matrix.task-name }}
# if: "${{ !contains(matrix.name, 'test') }}"
# run: task ${{ matrix.task-name }} ${{ matrix.env.TASKFILE_ARGS }}

# - name: task unit
# if: contains(matrix.name, 'test')
# run: task unit ${{ matrix.env.TASKFILE_ARGS }}

# - name: task ui
# # https://github.com/ansible/vscode-ansible/issues/1451
# if: "${{ contains(matrix.name, 'test') && !contains(matrix.name, 'wsl') }}"
# run: task ui ${{ matrix.env.TASKFILE_ARGS }}

# - name: task e2e
# # https://github.com/ansible/vscode-ansible/issues/1451
# if: "${{ contains(matrix.name, 'test') && !contains(matrix.name, 'wsl') }}"
# run: task e2e ${{ matrix.env.TASKFILE_ARGS }}

# - name: task als
# # https://github.com/ansible/vscode-ansible/issues/1451
# if: contains(matrix.name, 'test')
# run: task als ${{ matrix.env.TASKFILE_ARGS }}

# - name: task unit - wsl
# uses: Ubuntu/WSL/.github/actions/wsl-bash@main
# with:
# distro: Ubuntu-22.04
# working-dir: /tmp/github/
# exec: |
# task unit ${{ matrix.env.TASKFILE_ARGS }}
# wsl-conf: |
# [automount]
# enabled = true
# root = /
# options = "metadata,umask=077"
# [boot]
# command=/etc/init.d/dbus start
# [interop]
# enabled = false
# appendWindowsPath = false
# [network]
# hostname = wsl

- name: Setup asdf
if: ${{ !contains(matrix.shell, 'wsl') }}
if: ${{ !contains(matrix.name, 'wsl') }}
uses: asdf-vm/actions/install@v3

- name: Setup python
if: ${{ !contains(matrix.shell, 'wsl') }}
if: ${{ !contains(matrix.name, 'wsl') }}
uses: actions/setup-python@v5
with:
python-version: "3.11"

- 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 direnv
asdf plugin add nodejs
asdf plugin add python
asdf plugin add task
asdf plugin add yarn
asdf install
direnv --version
task --version
yarn --version
node --version
python3 --version

- name: Activate direnv
if: ${{ !contains(matrix.shell, 'wsl') }}
if: ${{ !contains(matrix.name, 'wsl') }}
run: |
set -x
asdf direnv setup --shell bash --version latest
Expand All @@ -201,7 +284,7 @@ jobs:
asdf exec direnv exec . bash -c 'echo "${VIRTUAL_ENV}/bin"' >> "$GITHUB_PATH"

- name: Ensure virtualenv is active (direnv)
if: ${{ !contains(matrix.shell, 'wsl') }}
if: ${{ !contains(matrix.name, 'wsl') }}
run: |
set -x
test "${VIRTUAL_ENV:-}" = "${HOME}/.local/share/virtualenvs/vsa"
Expand Down Expand Up @@ -230,40 +313,40 @@ jobs:
# ~/.config/containers
# key: ${{ runner.os }}-${{ matrix.task-name }}-${{ hashFiles('package.json', 'yarn.lock', '.config/requirements.txt', '**/Taskfile.yml', 'tools/*.*') }}

- name: task setup
# starting podman machine can randomly get stuck on macos
timeout-minutes: 25
run: task setup

## uncomment to debug on GHA runner
# - name: Setup tmate session
# uses: mxschmitt/action-tmate@v3
- name: task package
id: package
run: task package ${{ matrix.env.TASKFILE_ARGS }}

- name: task ${{ matrix.task-name }}
if: "${{ !contains(matrix.name, 'test') }}"
run: task ${{ matrix.task-name }} ${{ matrix.env.TASKFILE_ARGS }}

- name: task unit
if: contains(matrix.name, 'test')
run: task unit ${{ matrix.env.TASKFILE_ARGS }}

- name: task ui
# https://github.com/ansible/vscode-ansible/issues/1451
if: "${{ contains(matrix.name, 'test') && !contains(matrix.name, 'wsl') }}"
run: task ui ${{ matrix.env.TASKFILE_ARGS }}

- name: task e2e
# https://github.com/ansible/vscode-ansible/issues/1451
if: "${{ contains(matrix.name, 'test') && !contains(matrix.name, 'wsl') }}"
run: task e2e ${{ matrix.env.TASKFILE_ARGS }}

- name: task als
# https://github.com/ansible/vscode-ansible/issues/1451
if: contains(matrix.name, 'test')
run: task als ${{ matrix.env.TASKFILE_ARGS }}
# - name: task setup
# # starting podman machine can randomly get stuck on macos
# timeout-minutes: 25
# run: task setup

# ## uncomment to debug on GHA runner
# # - name: Setup tmate session
# # uses: mxschmitt/action-tmate@v3
# - name: task package
# id: package
# run: task package ${{ matrix.env.TASKFILE_ARGS }}

# - name: task ${{ matrix.task-name }}
# if: "${{ !contains(matrix.name, 'test') }}"
# run: task ${{ matrix.task-name }} ${{ matrix.env.TASKFILE_ARGS }}

# - name: task unit
# if: contains(matrix.name, 'test')
# run: task unit ${{ matrix.env.TASKFILE_ARGS }}

# - name: task ui
# # https://github.com/ansible/vscode-ansible/issues/1451
# if: "${{ contains(matrix.name, 'test') && !contains(matrix.name, 'wsl') }}"
# run: task ui ${{ matrix.env.TASKFILE_ARGS }}

# - name: task e2e
# # https://github.com/ansible/vscode-ansible/issues/1451
# if: "${{ contains(matrix.name, 'test') && !contains(matrix.name, 'wsl') }}"
# run: task e2e ${{ matrix.env.TASKFILE_ARGS }}

# - name: task als
# # https://github.com/ansible/vscode-ansible/issues/1451
# if: contains(matrix.name, 'test')
# run: task als ${{ matrix.env.TASKFILE_ARGS }}

- name: Upload vsix artifact
if: ${{ matrix.name == 'test (linux)' }}
Expand Down Expand Up @@ -350,7 +433,7 @@ jobs:
path: .

- name: Upload als test coverage data [1/4]
uses: codecov/codecov-action@v4.5.0
uses: codecov/codecov-action@v4
with:
name: als
files: ./*/coverage/als/lcov.info
Expand All @@ -360,7 +443,7 @@ jobs:
use_oidc: true # cspell:ignore oidc

- name: Upload unit test coverage data [2/4]
uses: codecov/codecov-action@v4.5.0
uses: codecov/codecov-action@v4
with:
name: unit
files: ./*/coverage/unit/lcov.info
Expand All @@ -370,7 +453,7 @@ jobs:
use_oidc: true # cspell:ignore oidc

- name: Upload ui test coverage data [3/4]
uses: codecov/codecov-action@v4.5.0
uses: codecov/codecov-action@v4
with:
name: unit
files: ./*/coverage/ui/lcov.info
Expand All @@ -380,7 +463,7 @@ jobs:
use_oidc: true # cspell:ignore oidc

- name: Upload e2e test coverage data [4/4]
uses: codecov/codecov-action@v4.5.0
uses: codecov/codecov-action@v4
with:
name: e2e
files: ./*/coverage/e2e/lcov.info
Expand Down
Loading