mirror of
https://github.com/rehlds/testdemos.git
synced 2025-03-04 09:35:33 +03:00
119 lines
3.4 KiB
YAML
119 lines
3.4 KiB
YAML
name: Docker Image CI
|
|
|
|
on:
|
|
push:
|
|
branches: [ master ]
|
|
paths-ignore:
|
|
- '**.md'
|
|
- '.vscode/**'
|
|
pull_request:
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
playtest:
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
# branch:
|
|
# - steam_legacy
|
|
# - public
|
|
# mod:
|
|
# # - valve
|
|
# - cstrike
|
|
# # - czero
|
|
# # - dod
|
|
# # - gearbox
|
|
# # - tfc
|
|
# # - ricochet
|
|
# # - dmc
|
|
test: [
|
|
{ type: 'rehlds', file: 'cstrike-muliplayer-1', desc: 'CS: Multiplayer' },
|
|
# { type: 'rehlds', file: 'rehlds-phys-single1', desc: 'Half-Life: Physics singleplayer' },
|
|
# { type: 'rehlds', file: 'crossfire-1-multiplayer-1', desc: 'Half-Life: Multiplayer on crossfire map' },
|
|
# { type: 'rehlds', file: 'shooting-hl-1', desc: 'Half-Life: Shooting with several weapons' },
|
|
# { type: 'regamedll', file: 'cstrike-basic-1', desc: 'CS: Testing jumping, scenarios, shooting etc' },
|
|
]
|
|
env:
|
|
imageName: testdemos_local
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: actions/cache@v4
|
|
with:
|
|
path: /tmp/.buildx-cache
|
|
key: ${{ runner.os }}-docker-${{ matrix.test.type }}
|
|
restore-keys: |
|
|
${{ runner.os }}-docker-
|
|
|
|
- name: Prepare
|
|
working-directory: ./testdemos_files
|
|
run: rsync -a deps/${{ matrix.test.type }}/* .
|
|
|
|
- name: Build container
|
|
run: |
|
|
docker build \
|
|
--cache-from=type=local,src=/tmp/.buildx-cache \
|
|
--cache-to=type=local,dest=/tmp/.buildx-cache-new,mode=max \
|
|
-t $imageName .
|
|
|
|
- name: Run test
|
|
env:
|
|
demo: ${{ matrix.test.file }}
|
|
desc: ${{ matrix.test.desc }}
|
|
run: |
|
|
docker run \
|
|
--env demo \
|
|
--env desc \
|
|
-t $imageName \
|
|
./runTest.sh
|
|
|
|
build:
|
|
if: false
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
branch:
|
|
- steam_legacy
|
|
- public
|
|
mod:
|
|
# - valve
|
|
- cstrike
|
|
# - czero
|
|
# - dod
|
|
# - gearbox
|
|
# - tfc
|
|
# - ricochet
|
|
# - dmc
|
|
|
|
env:
|
|
needToPush: ${{ github.ref == 'refs/heads/master' }}
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4.2.0
|
|
- uses: docker/setup-buildx-action@v3.7.0
|
|
- name: Log in to Docker Hub
|
|
if: ${{ env.needToPush }}
|
|
uses: docker/login-action@v3.3.0
|
|
with:
|
|
username: ${{ vars.DOCKER_USERNAME }}
|
|
password: ${{ secrets.DOCKER_PERSONAL_ACCESS_TOKEN }}
|
|
|
|
- name: Build and push Docker image
|
|
uses: docker/build-push-action@v6.7.0
|
|
env:
|
|
OWNER: ${{ vars.DOCKER_USERNAME }}
|
|
REPO: ${{ vars.DOCKER_REPOSITORY }}
|
|
TAG: ${{ matrix.branch }}
|
|
with:
|
|
context: .
|
|
file: ./Dockerfile
|
|
push: ${{ env.needToPush }}
|
|
tags: |
|
|
${{ env.OWNER }}/${{ env.REPO }}:${{ env.TAG }}
|
|
${{ env.TAG == 'steam_legacy' && format('{0}/{1}:latest', env.OWNER, env.REPO) || null}}
|
|
build-args: |
|
|
APPBRANCH=${{ matrix.branch }}
|
|
MOD=${{ matrix.mod }}
|
|
cache-from: type=gha,scope=build-${{ matrix.mod }}-${{ matrix.branch }}
|
|
cache-to: type=gha,mode=max,scope=build-${{ matrix.mod }}-${{ matrix.branch }} |