Skip to content

Integration Test

Integration Test #362

name: Integration Test
on:
push:
branches:
- main
- dev
schedule:
- cron: '55 22 */3 * *'
workflow_dispatch:
env:
DOTNET_CLI_TELEMETRY_OPTOUT: true
DOTNET_NOLOGO: true
DOTNET_SDK_VERSION: 8.0.x
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
integration:
concurrency:
group: integration
if: ${{ github.actor == github.repository_owner }}
strategy:
max-parallel: 1 # only 1 else asf may crash due to parallel login using the same config file
matrix:
configuration: [Release]
asf_docker_tag: [latest, main, released]
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/[email protected]
timeout-minutes: 5
with:
submodules: recursive
- name: Setup .NET Core
timeout-minutes: 5
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ env.DOTNET_SDK_VERSION }}
- name: Verify .NET Core
run: dotnet --info
- name: Build ${{ matrix.configuration }}
uses: nick-fields/retry@v3
with:
timeout_minutes: 10
max_attempts: 10
shell: pwsh
command: dotnet build -c "${{ matrix.configuration }}" -p:ContinuousIntegrationBuild=true -p:UseAppHost=false -p:isolate=true --nologo
- name: Populate config.zip
shell: python
run: |
import base64
data = rb'''${{ secrets.CONFIGZIP_B64 }}'''
with open('config.zip', 'wb') as f:
f.write(base64.b64decode(data))
- name: Extract config.zip
run: unzip -qq config.zip
- name: Create plugin dir
run: |
mkdir -p plugins/ASFFreeGames
cp --archive -f ASFFreeGames/bin/${{ matrix.configuration }}/*/ASFFreeGames.* plugins/ASFFreeGames/
du -h plugins
- name: run docker
shell: python
timeout-minutes: 60
run: |
import subprocess
import sys
cmd = r"""docker run -e "ASF_CRYPTKEY=${{ secrets.ASF_CRYPTKEY }}" -v `pwd`/config:/app/config -v `pwd`/plugins:/app/plugins --name asf --pull always justarchi/archisteamfarm:${{ matrix.asf_docker_tag }}"""
with open('out.txt', 'ab+') as out, subprocess.Popen(cmd, shell=True, stdout=out, stderr=out) as process:
def flush_out() -> str:
out.flush()
out.seek(0)
output = out.read()
output = output.decode()
print(output)
return output
exit_code = None
try:
exit_code = process.wait(timeout=120)
except (TimeoutError, subprocess.TimeoutExpired):
print("Process reached timeout as expected")
process.kill()
exit_code = process.wait(timeout=10)
if exit_code is None:
process.terminate()
output = flush_out()
assert 'CollectGames() [FreeGames] found' in output, "unable to start docker with ASFFreeGames installed"
sys.exit(0)
print(f'Process stopped earlier than expected with {exit_code} code', file=sys.stderr)
flush_out()
if exit_code != 0:
sys.exit(exit_code)
sys.exit(111)
- name: compress artifact files
continue-on-error: true
if: always()
run: |
mkdir -p tmp_7z
openssl rand -base64 32 | tr -d '\r\n' > archive_pass.txt
echo ::add-mask::$(cat archive_pass.txt)
if [[ -z "${{ secrets.SEVENZIP_PASSWORD }}" ]]; then
export SEVENZIP_PASSWORD="$(cat archive_pass.txt)"
echo "**One must set SEVENZIP_PASSWORD seceret**" >> $GITHUB_STEP_SUMMARY
echo "- output.7z created with a random password good luck guessing ..." >> $GITHUB_STEP_SUMMARY
fi
7z a -t7z -m0=lzma2 -mx=9 -mhe=on -ms=on -p"${{ secrets.SEVENZIP_PASSWORD || env.SEVENZIP_PASSWORD }}" tmp_7z/output.7z config.zip out.txt
- name: Upload 7z artifact
continue-on-error: true
if: always()
uses: actions/[email protected]
with:
name: ${{ matrix.configuration }}_${{ matrix.asf_docker_tag }}_stdout
path: tmp_7z/output.7z