diff --git a/.github/actions/install_lima_from_artifact/action.yml b/.github/actions/install_lima_from_artifact/action.yml new file mode 100644 index 000000000000..349b4d7271a7 --- /dev/null +++ b/.github/actions/install_lima_from_artifact/action.yml @@ -0,0 +1,25 @@ +name: install lima from artifact +description: install lima from artifact +inputs: + artifact: + description: artifact to install + required: true +runs: + using: "composite" + steps: + - uses: actions/download-artifact@v4 + with: + name: ${{ inputs.artifact }} + path: _artifacts + - name: Install lima from downloaded archive on Linux + if: runner.os == 'Linux' + run: | + sudo make uninstall + sudo tar -C /usr/local -xvf _artifacts/${{ inputs.artifact }} --no-same-owner + shell: bash + - name: Install lima from downloaded archive on macOS + if: runner.os == 'macOS' + run: | + make uninstall || true + tar -C /usr/local -xvmf _artifacts/${{ inputs.artifact }} --no-same-owner + shell: bash diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 000000000000..c5011b62a341 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,54 @@ +name: build lima +run-name: build lima on ${{ inputs.runs-on }} using go ${{ inputs.go-version }} + +on: + workflow_call: + inputs: + go-version: + type: string + description: 'The version of Go to use' + required: false + default: '1.22.x' + runs-on: + type: string + description: 'The type of runner to use' + required: true + outputs: + artifact: + description: 'The name of the artifact' + value: ${{ jobs.build.outputs.artifact }} + +jobs: + build: + name: "Build on ${{ inputs.runs-on }} using go ${{ inputs.go-version }}" + runs-on: ${{ inputs.runs-on }} + timeout-minutes: 30 + outputs: + artifact: ${{ steps.set-output.outputs.artifact }} + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - uses: actions/setup-go@v5 + with: + go-version: ${{ inputs.go-version }} + - name: Make + run: make + - name: Make install on Linux + if: runner.os == 'Linux' + run: sudo make install + - name: Make install on macOS + if: runner.os == 'macOS' + run: make install + - name: set output + id: set-output + run: echo "artifact=lima-${{ inputs.runs-on }}.tar.gz" >> $GITHUB_OUTPUT + - name: create archive + run: | + mkdir -p _artifacts + tar -C _output/ -czvf _artifacts/${{ steps.set-output.outputs.artifact }} ./ + - name: upload archive + uses: actions/upload-artifact@v4 + with: + name: ${{ steps.set-output.outputs.artifact }} + path: _artifacts/${{ steps.set-output.outputs.artifact }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f262834c79da..9b11e3501ce3 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -146,6 +146,12 @@ jobs: if: always() run: type C:\Users\runneradmin\.lima\wsl2\ha.stderr.log + build-on-macos-12: + name: "Build on macOS 12" + uses: ./.github/workflows/build.yml + with: + runs-on: macos-12 + integration: name: Integration tests runs-on: macos-12 @@ -198,10 +204,17 @@ jobs: if: always() run: ./hack/debug-cache.sh + build-on-ubuntu: + name: "Build on Ubuntu" + uses: ./.github/workflows/build.yml + with: + runs-on: ubuntu-22.04 + # Non-default templates are tested on Linux instances of GHA, # as they seem more stable than macOS instances. integration-linux: name: Integration tests (on Linux) + needs: build-on-ubuntu runs-on: ubuntu-22.04 timeout-minutes: 120 strategy: @@ -222,13 +235,9 @@ jobs: - uses: actions/checkout@v4 with: fetch-depth: 1 - - uses: actions/setup-go@v5 + - uses: ./.github/actions/install_lima_from_artifact with: - go-version: 1.22.x - - name: Make - run: make - - name: Install - run: sudo make install + artifact: ${{ needs.build-on-ubuntu.outputs.artifact }} - name: Cache image used by templates/${{ matrix.template }} uses: ./.github/actions/setup_cache_for_template with: @@ -262,6 +271,7 @@ jobs: colima: name: Colima + needs: build-on-ubuntu runs-on: ubuntu-22.04 timeout-minutes: 120 strategy: @@ -280,10 +290,9 @@ jobs: with: path: ~/.cache/lima/download key: ${{ runner.os }}-colima-${{ matrix.colima-version }} - - name: Make - run: make - - name: Install - run: sudo make install + - uses: ./.github/actions/install_lima_from_artifact + with: + artifact: ${{ needs.build-on-ubuntu.outputs.artifact }} - name: Install colima run: | git clone https://github.com/abiosoft/colima @@ -312,19 +321,16 @@ jobs: vmnet: name: "VMNet test" + needs: build-on-macos-12 runs-on: macos-12 timeout-minutes: 120 steps: - uses: actions/checkout@v4 with: fetch-depth: 1 - - uses: actions/setup-go@v5 + - uses: ./.github/actions/install_lima_from_artifact with: - go-version: 1.22.x - - name: Make - run: make - - name: Install - run: make install + artifact: ${{ needs.build-on-macos-12.outputs.artifact }} - name: Cache image used by vmnet.yaml uses: ./.github/actions/setup_cache_for_template with: @@ -388,8 +394,15 @@ jobs: - if: always() uses: ./.github/actions/upload_failure_logs_if_exists + build-on-macos-13: + name: "Build on macOS 13" + uses: ./.github/workflows/build.yml + with: + runs-on: macos-13 + vz: name: "vz" + needs: build-on-macos-13 runs-on: macos-13 timeout-minutes: 120 strategy: @@ -402,13 +415,9 @@ jobs: - uses: actions/checkout@v4 with: fetch-depth: 1 - - uses: actions/setup-go@v5 + - uses: ./.github/actions/install_lima_from_artifact with: - go-version: 1.22.x - - name: Make - run: make - - name: Install - run: make install + artifact: ${{ needs.build-on-macos-13.outputs.artifact }} - name: Cache image used by templates/${{ matrix.template }} uses: ./.github/actions/setup_cache_for_template with: