Skip to content

Commit

Permalink
ci: Build in docker
Browse files Browse the repository at this point in the history
  • Loading branch information
nomeaning777 committed Nov 13, 2023
1 parent 14968f1 commit b2ca868
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 35 deletions.
58 changes: 23 additions & 35 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,51 +3,39 @@ name: CI
on: [push]

jobs:
build-wsl:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 #v3.0.0

- name: Build
working-directory: client
run: cargo build --release

- name: Strip Debug Symbols
run: strip target/release/wsld

- uses: actions/upload-artifact@v3
- uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v3.0.0
with:
name: 'wsld'
path: target/release/wsld
context: .
file: Dockerfile
cache-from: type=gha
cache-to: type=gha,mode=max
tags: wsld-builder:latest
push: false
load: true

- uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
prerelease: true
files: target/release/wsld
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Run builder container
run: docker run -v "$(pwd):/workspace" --name builder -d --user $UID:$GID --workdir /workspace wsld-builder:latest sleep infinity

build-windows:
runs-on: windows-latest
- name: Build (Linux)
run: docker exec --workdir /workspace/client builder cargo build --release

steps:
- uses: actions/checkout@v3
- name: Build (Windows)
run: docker exec --workdir /workspace/server builder cargo build --release --target x86_64-pc-windows-gnu

- name: Build
working-directory: server
run: cargo build --release
- name: Strip Debug Symbols
run: strip target/release/wsld

- uses: actions/upload-artifact@v3
with:
name: 'wsldhost.exe'
path: target/release/wsldhost.exe

- uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
prerelease: true
files: target/release/wsldhost.exe
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
name: 'wsld'
path: |
target/release/wsld
target/x86_64-pc-windows-gnu/release/wsldhost.exe
4 changes: 4 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
FROM rust:1.73.0-buster

RUN apt-get update && apt-get install -y mingw-w64 && apt-get clean && rm -rf /var/lib/apt/lists/*
RUN rustup target add x86_64-pc-windows-gnu

0 comments on commit b2ca868

Please sign in to comment.