diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 71313ca0..866c6a7d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,7 +14,7 @@ jobs: strategy: matrix: - os: [ubuntu-latest, macos-latest] + os: [ubuntu-latest, macos-latest, windows-latest] steps: - uses: actions/checkout@v4 @@ -41,19 +41,24 @@ jobs: strategy: matrix: - os: [ubuntu-latest, macos-latest] + os: [ubuntu-latest, macos-latest, windows-latest] steps: - uses: actions/checkout@v4 - run: ./scripts/install-protobuf.sh - - env: - # runc::tests::test_exec needs $XDG_RUNTIME_DIR to be set - XDG_RUNTIME_DIR: /tmp/dummy-xdr - run: | + - run: | # runc-shim::cgroup::test_add_cgroup needs root permission to set cgroup mkdir -p /tmp/dummy-xdr sudo -E $(command -v cargo) test sudo -E $(command -v cargo) test --all-features + if: ${{ !contains(matrix.os, 'windows') }} + env: + # runc::tests::test_exec needs $XDG_RUNTIME_DIR to be set + XDG_RUNTIME_DIR: /tmp/dummy-xdr + - run: | + cargo test + cargo test --all-features + if: ${{ contains(matrix.os, 'windows') }} # Collect build timings # See https://blog.rust-lang.org/2022/04/07/Rust-1.60.0.html#cargo---timings @@ -81,8 +86,8 @@ jobs: - uses: actions/checkout@v4 - uses: EmbarkStudios/cargo-deny-action@v1 - integration: - name: Integration + linux-integration: + name: Linux Integration runs-on: ${{ matrix.os }} timeout-minutes: 40 @@ -139,6 +144,58 @@ jobs: run: | sudo -E PATH=$PATH make integration working-directory: src/github.com/containerd/containerd + + windows-integration: + name: Windows Integration + runs-on: ${{ matrix.os }} + timeout-minutes: 40 + + strategy: + matrix: + os: [windows-latest] + containerd: [1.7.0] + + steps: + - name: Checkout extensions + uses: actions/checkout@v4 + + - name: Install containerd + run: | + $ErrorActionPreference = "Stop" + + # Install containerd https://github.com/containerd/containerd/blob/v1.7.0/docs/getting-started.md#installing-containerd-on-windows + # Download and extract desired containerd Windows binaries + curl.exe -L https://github.com/containerd/containerd/releases/download/v${{ matrix.containerd }}/containerd-${{ matrix.containerd }}-windows-amd64.tar.gz -o containerd-windows-amd64.tar.gz + tar.exe xvf .\containerd-windows-amd64.tar.gz + + # Copy and configure + mkdir "$Env:ProgramFiles\containerd" + Copy-Item -Path ".\bin\*" -Destination "$Env:ProgramFiles\containerd" -Recurse -Force + cd $Env:ProgramFiles\containerd\ + .\containerd.exe config default | Out-File config.toml -Encoding ascii + + # Review the configuration. Depending on setup you may want to adjust: + # - the sandbox_image (Kubernetes pause image) + # - cni bin_dir and conf_dir locations + Get-Content config.toml + + # Register and start service + .\containerd.exe --register-service + Start-Service containerd + working-directory: ${{ runner.temp }} + - name: Run integration test + run: | + $ErrorActionPreference = "Stop" + + get-service containerd + $env:TTRPC_ADDRESS="\\.\pipe\containerd-containerd.ttrpc" + + # run the example + cargo run -p containerd-shim --example skeleton -- -namespace default -id 1234 -address "\\.\pipe\containerd-containerd" -publish-binary ./bin/containerd start + ps skeleton + cargo run -p containerd-shim-protos --example shim-proto-connect \\.\pipe\containerd-shim-17630016127144989388-pipe + $skeleton = get-process skeleton -ErrorAction SilentlyContinue + if ($skeleton) { exit 1 } # Currently Github actions UI supports no masks to mark matrix jobs as required to pass status checks. # This means that every time version of Go, containerd, or OS is changed, a corresponding job should @@ -151,7 +208,7 @@ jobs: name: Report required job statuses runs-on: ubuntu-latest # List job dependencies which are required to pass status checks in order to be merged via merge queue. - needs: [checks, tests, deny, integration] + needs: [checks, tests, deny, linux-integration, windows-integration] if: ${{ always() }} steps: - run: exit 1