diff options
| author | Aiden Grossman <aidengrossman@google.com> | 2024-12-13 18:00:57 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-12-13 10:00:57 -0800 |
| commit | a44915a8e55fae93da17f9ae2ca26f745e1f6f7d (patch) | |
| tree | 3ba2349c342521377b0e6d0d30007fecc00c8a77 /.github/workflows/build-ci-container-windows.yml | |
| parent | 229d78de31467f623e33716a30cb0c6d285d7683 (diff) | |
[Github] Add a windows CI container (#118206)
This patch adds a windows CI container mostly based off of the existing
container used for Buildkite
(https://github.com/google/llvm-premerge-checks/blob/a687e33c37fbdcf67b52805c8cf3a8ed145e3243/containers/buildkite-windows/Dockerfile#L1).
This is intended to be a starting point as we transition to Github
Actions with the eventual plan being to build a custom windows toolchain
similar to what we do on Linux.
Diffstat (limited to '.github/workflows/build-ci-container-windows.yml')
| -rw-r--r-- | .github/workflows/build-ci-container-windows.yml | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/.github/workflows/build-ci-container-windows.yml b/.github/workflows/build-ci-container-windows.yml new file mode 100644 index 000000000000..898cdce097e9 --- /dev/null +++ b/.github/workflows/build-ci-container-windows.yml @@ -0,0 +1,75 @@ +name: Build Windows CI Container + +permissions: + contents: read + +on: + push: + branches: + - main + paths: + - .github/workflows/build-ci-container-windows.yml + - '.github/workflows/containers/github-action-ci-windows/**' + pull_request: + branches: + - main + paths: + - .github/workflows/build-ci-container-windows.yml + - '.github/workflows/containers/github-action-ci-windows/**' + +jobs: + build-ci-container-windows: + if: github.repository_owner == 'llvm' + runs-on: windows-2019 + outputs: + container-name: ${{ steps.vars.outputs.container-name }} + container-name-tag: ${{ steps.vars.outputs.container-name-tag }} + container-filename: ${{ steps.vars.outputs.container-filename }} + steps: + - name: Checkout LLVM + uses: actions/checkout@v4 + with: + sparse-checkout: .github/workflows/containers/github-action-ci-windows + - name: Write Variables + id: vars + run: | + $tag = [int64](Get-Date -UFormat %s) + $container_name="ghcr.io/$env:GITHUB_REPOSITORY_OWNER/ci-windows-2019" + echo "container-name=${container_name}" >> $env:GITHUB_OUTPUT + echo "container-name-tag=${container_name}:${tag}" >> $env:GITHUB_OUTPUT + echo "container-filename=ci-windows-${tag}.tar" >> $env:GITHUB_OUTPUT + - name: Build Container + working-directory: .github/workflows/containers/github-action-ci-windows + run: | + docker build -t ${{ steps.vars.outputs.container-name-tag }} . + - name: Save container image + run: | + docker save ${{ steps.vars.outputs.container-name-tag }} > ${{ steps.vars.outputs.container-filename }} + - name: Upload container image + uses: actions/upload-artifact@v4 + with: + name: container + path: ${{ steps.vars.outputs.container-filename }} + retention-days: 14 + + push-ci-container: + if: github.event_name == 'push' + needs: + - build-ci-container-windows + permissions: + packages: write + runs-on: windows-2019 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + steps: + - name: Download container + uses: actions/download-artifact@v4 + with: + name: container + - name: Push Container + run: | + docker load -i ${{ needs.build-ci-container.outptus.container-filename }} + docker tag ${{ steps.vars.outputs.container-name-tag }} ${{ steps.vars.outputs.container-name }}:latest + docker login -u ${{ github.actor }} -p $env:GITHUB_TOKEN ghcr.io + docker push ${{ needs.build-ci-container.outputs.container-name-tag }} + docker push ${{ needs.build-ci-container.outputs.container-name }}:latest |
