119 lines
3.4 KiB
YAML
Raw Normal View History

name: Docker Image CI
on:
push:
branches: [ master ]
paths-ignore:
- '**.md'
- '.vscode/**'
pull_request:
workflow_dispatch:
jobs:
2024-10-17 16:10:36 +03:00
playtest:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
2024-10-17 16:13:39 +03:00
# branch:
# - steam_legacy
# - public
# mod:
# # - valve
# - cstrike
# # - czero
# # - dod
# # - gearbox
# # - tfc
# # - ricochet
# # - dmc
2024-10-17 16:10:36 +03:00
test: [
{ type: 'rehlds', file: 'cstrike-muliplayer-1', desc: 'CS: Multiplayer' },
2024-10-17 16:13:39 +03:00
# { 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' },
2024-10-17 16:10:36 +03:00
]
env:
imageName: testdemos_local
steps:
- uses: actions/checkout@v4
2024-10-17 16:17:19 +03:00
2024-10-17 16:35:46 +03:00
- uses: actions/cache@v4
with:
2024-10-17 16:54:21 +03:00
path: /tmp/.buildx-cache
key: ${{ runner.os }}-docker-${{ matrix.test.type }}
restore-keys: |
${{ runner.os }}-docker-
2024-10-17 16:35:46 +03:00
2024-10-17 16:10:36 +03:00
- name: Prepare
2024-10-17 16:20:19 +03:00
working-directory: ./testdemos_files
2024-10-17 16:10:36 +03:00
run: rsync -a deps/${{ matrix.test.type }}/* .
2024-10-17 16:35:46 +03:00
- name: Build container
2024-10-17 16:54:21 +03:00
run: |
docker build \
--cache-from=type=local,src=/tmp/.buildx-cache \
--cache-to=type=local,dest=/tmp/.buildx-cache-new,mode=max \
-t $imageName .
2024-10-17 16:35:46 +03:00
2024-10-17 16:10:36 +03:00
- name: Run test
env:
demo: ${{ matrix.test.file }}
desc: ${{ matrix.test.desc }}
2024-10-17 16:30:26 +03:00
run: |
docker run \
--env demo \
--env desc \
2024-10-17 16:35:46 +03:00
-t $imageName \
2024-10-17 16:30:26 +03:00
./runTest.sh
build:
2024-10-17 16:30:26 +03:00
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 }}
2024-09-24 02:11:53 +03:00
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 }}