diff --git a/.github/actions/build-front-end/action.yaml b/.github/actions/build-front-end/action.yaml new file mode 100644 index 00000000..7967ad42 --- /dev/null +++ b/.github/actions/build-front-end/action.yaml @@ -0,0 +1,10 @@ +name: Front-end build +description: Builds the Liberation front-end. +runs: + using: composite + steps: + - name: Build client + shell: powershell + run: | + cd client + npm run build diff --git a/.github/actions/mypy/action.yaml b/.github/actions/mypy/action.yaml new file mode 100644 index 00000000..d4ac95ad --- /dev/null +++ b/.github/actions/mypy/action.yaml @@ -0,0 +1,16 @@ +name: mypy +description: Type checks Python code. +runs: + using: composite + steps: + - name: mypy game + shell: powershell + run: | + ./venv/scripts/activate + mypy game + + - name: mypy tests + shell: powershell + run: | + ./venv/scripts/activate + mypy tests diff --git a/.github/actions/setup-liberation-js/action.yaml b/.github/actions/setup-liberation-js/action.yaml new file mode 100644 index 00000000..b40d26c5 --- /dev/null +++ b/.github/actions/setup-liberation-js/action.yaml @@ -0,0 +1,15 @@ +name: Liberation JS set-up +description: Sets up the Liberation Javascript environment. +runs: + using: composite + steps: + - name: Set up Node + uses: actions/setup-node@v2 + with: + node-version: "16" + + - name: npm ci + shell: powershell + run: | + cd client + npm ci diff --git a/.github/actions/setup-liberation-python/action.yaml b/.github/actions/setup-liberation-python/action.yaml new file mode 100644 index 00000000..079b6195 --- /dev/null +++ b/.github/actions/setup-liberation-python/action.yaml @@ -0,0 +1,22 @@ +name: Liberation Python set-up +description: Sets up the Liberation Python environment. +runs: + using: composite + steps: + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: "3.10" + + - name: Install environment + shell: powershell + run: | + python -m venv ./venv + + - name: Install dependencies + shell: powershell + run: | + ./venv/scripts/activate + python -m pip install -r requirements.txt + # For some reason the shiboken2.abi3.dll is not found properly, so I copy it instead + Copy-Item .\venv\Lib\site-packages\shiboken2\shiboken2.abi3.dll .\venv\Lib\site-packages\PySide2\ -Force diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index cbb6f1cd..0729ebe9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -10,50 +10,21 @@ jobs: with: submodules: true - - name: Set up Python - uses: actions/setup-python@v2 - with: - python-version: "3.10" + - name: Set up Python environment + uses: ./.github/actions/setup-liberation-python - - name: Set up Node - uses: actions/setup-node@v2 - with: - node-version: "16" + - name: Set up JS environment + uses: ./.github/actions/setup-liberation-js - - name: Install environment - run: | - python -m venv ./venv - - - name: Install dependencies - run: | - ./venv/scripts/activate - python -m pip install -r requirements.txt - # For some reason the shiboken2.abi3.dll is not found properly, so I copy it instead - Copy-Item .\venv\Lib\site-packages\shiboken2\shiboken2.abi3.dll .\venv\Lib\site-packages\PySide2\ -Force - - - name: mypy game - run: | - ./venv/scripts/activate - mypy game - - - name: mypy tests - run: | - ./venv/scripts/activate - mypy tests + - name: mypy + uses: ./.github/actions/mypy - name: update build number run: | [IO.File]::WriteAllLines($pwd.path + "\resources\buildnumber", $env:GITHUB_RUN_NUMBER) - - name: npm ci - run: | - cd client - npm ci - - - name: Build client - run: | - cd client - npm run build + - name: Build front-end + uses: ./.github/actions/build-front-end - name: Build binaries run: | @@ -62,7 +33,9 @@ jobs: pyinstaller pyinstaller.spec - name: Create archive - run: Compress-Archive -Path .\dist\dcs_liberation\ -DestinationPath dist\dcs_liberation.zip + run: + Compress-Archive -Path .\dist\dcs_liberation\ -DestinationPath + dist\dcs_liberation.zip - uses: actions/upload-artifact@v2 with: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 75c82204..b6ad4834 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -12,40 +12,21 @@ jobs: with: submodules: true - - name: Set up Python - uses: actions/setup-python@v2 - with: - python-version: "3.10" + - name: Set up Python environment + uses: ./.github/actions/setup-liberation-python - - name: Set up Node - uses: actions/setup-node@v2 - with: - node-version: "16" - - - name: Install environment - run: | - python -m venv ./venv - - - name: Install dependencies - run: | - ./venv/scripts/activate - python -m pip install -r requirements.txt - # For some reason the shiboken2.abi3.dll is not found properly, so I copy it instead - Copy-Item .\venv\Lib\site-packages\shiboken2\shiboken2.abi3.dll .\venv\Lib\site-packages\PySide2\ -Force + - name: Set up JS environment + uses: ./.github/actions/setup-liberation-js - name: Finalize version run: | New-Item -ItemType file resources\final - - name: npm ci - run: | - cd client - npm ci + - name: mypy + uses: ./.github/actions/mypy - - name: mypy game - run: | - ./venv/scripts/activate - mypy game + - name: Build front-end + uses: ./.github/actions/build-front-end - name: Build binaries run: |