introduces macos and windows runners in build step #783
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
name: CI Build | |
on: | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
jobs: | |
matrix: | |
runs-on: ubuntu-latest | |
outputs: | |
matrix: ${{ steps.set-matrix.outputs.matrix }} | |
steps: | |
- uses: actions/checkout@v3 | |
- id: set-matrix | |
run: | | |
# Full matrix | |
# ubuntu_versions=$( cat k8s-versions.json | jq '{version: [keys[] as $k | .[$k].versions[] | .k8s as $v | "\($k) \($v)"], os: ["ubuntu-latest"]}' -c ) | |
# macos_versions=$(cat k8s-versions.json | jq '{ version: [to_entries[] as $k | "\($k.key) \($k.value.versions[-1].k8s)"]}') | |
# matrix=$( echo $ubuntu_versions | jq --argjson macos_versions "$(echo -n $macos_versions)" '.os as $os | .version as $version | {version: $version, os: $os, include: [{version: $macos_versions.version, os: "macos-13"}]}' -c ) | |
# echo $matrix | |
# echo "::set-output name=matrix::$matrix" | |
# MacOs Single Test | |
matrix=$( echo '{"version":"ApiServerContainer 1.30.0","os":["macos-13"]}' | jq -c '.') | |
echo $matrix | |
echo "::set-output name=matrix::$matrix" | |
check-matrix: | |
runs-on: ubuntu-latest | |
needs: matrix | |
steps: | |
- name: Check matrix definition | |
run: | | |
matrix='${{ needs.matrix.outputs.matrix }}' | |
echo $matrix | |
echo $matrix | jq . | |
build: | |
needs: matrix | |
strategy: | |
matrix: ${{ fromJson(needs.matrix.outputs.matrix) }} | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Setup docker (missing on MacOS) | |
if: runner.os == 'macos' | |
run: | | |
brew install docker colima docker-buildx | |
colima start --network-address | |
colima ls | |
# For testcontainers to find the Colima socket | |
# https://github.com/abiosoft/colima/blob/main/docs/FAQ.md#cannot-connect-to-the-docker-daemon-at-unixvarrundockersock-is-the-docker-daemon-running | |
sudo ln -sf $HOME/.colima/default/docker.sock /var/run/docker.sock | |
echo "TESTCONTAINERS_DOCKER_SOCKET_OVERRIDE=/var/run/docker.sock" >> $GITHUB_ENV | |
echo "TESTCONTAINERS_HOST_OVERRIDE=$(colima ls -j | jq -r '.address')" >> $GITHUB_ENV | |
# echo "DOCKER_HOST=unix://${HOME}/.colima/default/docker.sock" >> $GITHUB_ENV | |
- uses: actions/checkout@v3 | |
- name: Set up JDK 11 | |
uses: actions/setup-java@v2 | |
with: | |
java-version: '11' | |
distribution: 'adopt' | |
- name: Build with Gradle | |
env: | |
CONTAINER_FILTER: ${{ matrix.version }} | |
run: ./gradlew build | |
- name: Upload Test Results | |
if: always() | |
uses: actions/upload-artifact@v2 | |
with: | |
name: Test Results | |
path: build/test-results/test/*.xml | |
publish-test-results: | |
name: "Publish Tests Results" | |
needs: build | |
runs-on: ubuntu-latest | |
permissions: | |
checks: write | |
pull-requests: write | |
if: always() | |
steps: | |
- name: Download Artifacts | |
uses: actions/download-artifact@v2 | |
with: | |
path: artifacts | |
- name: Publish Test Results | |
uses: EnricoMi/publish-unit-test-result-action@v2 | |
with: | |
junit_files: "artifacts/**/*.xml" |