aboutsummaryrefslogtreecommitdiff
path: root/.github/workflows/ci.yml
blob: e6048a57df41c2b0d7f387ffcb4415e8e98ee530 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
name: CI
on: [push, pull_request]

env:
  BUILD_PROFILE: Release
  NORTHSTAR_VERSION: 0.0.0.${{github.run_number}}

jobs:
  build:
    runs-on: windows-2022
    steps:
      - name: Checkout
        uses: actions/checkout@v3
        with:
          submodules: 'true'
      - name: Setup msvc
        uses: ilammy/msvc-dev-cmd@v1
      - name: Configure cmake
        run: cmake -G "Ninja" -DCMAKE_BUILD_TYPE:STRING="${{ env.BUILD_PROFILE }}"
      - name: Setup resource file version
        shell: bash
        run: |
          sed -i 's/DEV/${{ env.NORTHSTAR_VERSION }}/g' primedev/primelauncher/resources.rc
          sed -i 's/DEV/${{ env.NORTHSTAR_VERSION }}/g' primedev/resources.rc
          FILEVERSION=$(echo ${{ env.NORTHSTAR_VERSION }} | tr '.' ',' | sed -E 's/-rc[0-9]+//' | tr -d '[:alpha:]')
          sed -i "s/0,0,0,1/${FILEVERSION}/g" primedev/ns_version.h
      - name: Build
        run: cmake --build .
      - name: Extract Short Commit Hash
        id: extract
        shell: bash
        run: echo commit=$(git rev-parse --short HEAD) >> $GITHUB_OUTPUT
      - name: Upload Build Artifact
        uses: actions/upload-artifact@v3
        with:
          name: NorthstarLauncher-${{ steps.extract.outputs.commit }}
          path: |
            game/

  format-check:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v3
    - uses: DoozyX/clang-format-lint-action@v0.16.2
      with:
        source: 'primedev'
        exclude: 'primedev/include primedev/thirdparty primedev/wsockproxy'
        extensions: 'h,cpp'
        clangFormatVersion: 16
        style: file

  format-check-cmake-files:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v3
    - uses: puneetmatharu/cmake-format-lint-action@v1.0.4
      with:
        args: "--in-place"
    - run: |
        git diff --exit-code