Skip to content

Commit

Permalink
Add Windows Docker Image
Browse files Browse the repository at this point in the history
  • Loading branch information
kazuki0824 committed Aug 7, 2023
1 parent 519da46 commit 3afd357
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 19 deletions.
11 changes: 11 additions & 0 deletions .github/workflows/Windows.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
ARG IMAGE=mcr.microsoft.com/dotnet/framework/runtime:4.8.1
FROM ${IMAGE}
SHELL ["powershell", "-command"]

RUN Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointsManager]::ServerCertificationCallback = {$true}; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
RUN choco install cmake --installargs 'ADD_CMAKE_TO_PATH=System' -y
RUN choco install rustup.install llvm mingw -y
RUN choco install visualstudio2022buildtools -y
RUN choco install rustup.install -y

RUN rustup default stable-gnu
61 changes: 61 additions & 0 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Docker

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

on:
workflow_dispatch:
push:
branches: [ main ]
pull_request:
branches: [ main ]

env:
# Use docker.io for Docker Hub if empty
REGISTRY: ghcr.io
# github.repository as <account>/<repo>
IMAGE_NAME: ${{ github.repository }}


jobs:
publish:
runs-on: windows-latest
timeout-minutes: 60
permissions:
contents: read
packages: write
# This is used to complete the identity challenge
# with sigstore/fulcio when running outside of PRs.
id-token: write

steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
submodules: recursive

# Workaround: https://github.com/docker/build-push-action/issues/461
- name: Setup Docker buildx
uses: docker/setup-buildx-action@4b4e9c3e2d4531116a6f8ba8e71fc6e2cb6e6c8c

# Login against a Docker registry except on PR
# https://github.com/docker/login-action
- name: Log into registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/login-action@465a07811f14bebb1938fbed4728c6a1ff8901fc
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

# Build and push Docker image with Buildx (don't push on PR)
# https://github.com/docker/build-push-action
- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@2eb1c1961a95fc15694676618e422e8ba1d63825
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
21 changes: 2 additions & 19 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ jobs:
if: matrix.os == 'alpine:latest'
build-windows:
runs-on: windows-latest
container:
image: ghcr.io/${{ github.repository }}
strategy:
fail-fast: false
matrix:
Expand All @@ -72,20 +74,6 @@ jobs:
- nightly-x86_64-pc-windows-gnu
- nightly-x86_64-pc-windows-msvc
steps:
- name: Install or Update Clang and LLVM for bindgen
run: |
choco install llvm -y --force
- name: Update MinGW
if: endsWith(matrix.toolchain, 'gnu')
run: |
choco install mingw -y --force
- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v1.3.1
if: endsWith(matrix.toolchain, 'msvc')
- uses: fbactions/setup-winsdk@v1
if: endsWith(matrix.toolchain, 'msvc')

- name: Setup Rust toolchain
uses: ructions/toolchain@master
with:
Expand All @@ -99,10 +87,5 @@ jobs:
- name: Check
run: cargo check --workspace --verbose
- name: Run tests
if: endsWith(matrix.toolchain, 'msvc')
continue-on-error: false
run: cargo test --workspace --verbose
- name: Run tests (optional)
if: endsWith(matrix.toolchain, 'gnu')
continue-on-error: true
run: cargo test --workspace --verbose

0 comments on commit 3afd357

Please sign in to comment.