Skip to content

Build Melee

Build Melee #1050

Workflow file for this run

name: build-melee
run-name: Build Melee
on:
push:
paths: [ "**" ]
pull_request:
jobs:
build-linux:
name: Linux
runs-on: ubuntu-latest
env:
REGISTRY: ghcr.io
strategy:
matrix:
make_flags: ["GENERATE_MAP=1", "NON_MATCHING=1"]
fail-fast: false
steps:
- name: Get image name
env:
EVENT_NAME: ${{ github.event_name }}
PUSH_REPO_NAME: ${{ github.repository }}
PR_REPO_NAME: ${{ github.event.repository.full_name }}
IMAGE_SUFFIX: build-linux:latest
run: |
result=""
case "$EVENT_NAME" in
push)
result="$PUSH_REPO_NAME"
;;
pull_request)
result="$PR_REPO_NAME"
;;
esac
result=$(echo "$result/$IMAGE_SUFFIX" | tr '[:upper:]' '[:lower:]')
echo "IMAGE=$result" >> $GITHUB_ENV
- name: Checkout Melee repository
uses: actions/checkout@v3
- name: Log into container registry
uses: docker/[email protected]
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Pull build image
run: docker pull "$REGISTRY/$IMAGE"
- name: Build Melee
env:
MAKE_FLAGS: ${{ matrix.make_flags }}
run: |
docker run --rm \
--volume "$PWD:/input:ro" \
--volume /tmp/output:/output \
--env MAKE_FLAGS="$MAKE_FLAGS" \
"$REGISTRY/$IMAGE"
- name: Upload map
if: matrix.make_flags == 'GENERATE_MAP=1'
uses: actions/upload-artifact@v3
with:
name: GALE01.map
path: /tmp/output/ssbm.us.1.2/GALE01.map
- name: Set step summary
if: matrix.make_flags == 'GENERATE_MAP=1'
run: |
printf "\`\`\`\n%s\n\`\`\`" "$(cat /tmp/output/PROGRESS.md)" \
>> $GITHUB_STEP_SUMMARY
build-windows:
name: Windows
runs-on: windows-latest
env:
REGISTRY: ghcr.io
MAKE_FLAGS: ${{ matrix.make_flags }}
strategy:
matrix:
make_flags: ["GENERATE_MAP=1", "NON_MATCHING=1"]
fail-fast: false
steps:
- name: Get image name
env:
EVENT_NAME: ${{ github.event_name }}
PUSH_REPO_NAME: ${{ github.repository }}
PR_REPO_NAME: ${{ github.event.repository.full_name }}
IMAGE_SUFFIX: build-windows:latest
shell: bash
run: |
result=""
case "$EVENT_NAME" in
push)
result="$PUSH_REPO_NAME"
;;
pull_request)
result="$PR_REPO_NAME"
;;
esac
result=$(echo "$result/$IMAGE_SUFFIX" | tr '[:upper:]' '[:lower:]')
echo "IMAGE=$result" >> $GITHUB_ENV
- name: Checkout Melee repository
uses: actions/checkout@v3
- name: Log into container registry
uses: docker/[email protected]
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Pull build image
shell: bash
run: docker pull "$REGISTRY/$IMAGE"
- name: Build Melee
env:
MAKE_FLAGS: ${{ matrix.make_flags }}
run: |
$output = New-Item `
-Path "$env:TEMP/Output" `
-ItemType Directory `
-Force
# the container's user needs to be able to write to the runner's dir
icacls $output /T /grant 'Everyone:(OI)(CI)(F)'
docker run --rm `
--volume "${PWD}:C:/Input:ro" `
--volume "${output}:C:/Output" `
--env MAKE_FLAGS="$env:MAKE_FLAGS" `
"$env:REGISTRY/$env:IMAGE"
check-issues:
name: Issues
runs-on: ubuntu-latest
env:
REGISTRY: ghcr.io
steps:
- name: Get image name
env:
EVENT_NAME: ${{ github.event_name }}
PUSH_REPO_NAME: ${{ github.repository }}
PR_REPO_NAME: ${{ github.event.repository.full_name }}
IMAGE_SUFFIX: check-issues:latest
run: |
result=""
case "$EVENT_NAME" in
push)
result="$PUSH_REPO_NAME"
;;
pull_request)
result="$PR_REPO_NAME"
;;
esac
result=$(echo "$result/$IMAGE_SUFFIX" | tr '[:upper:]' '[:lower:]')
echo "IMAGE=$result" >> $GITHUB_ENV
- name: Checkout Melee repository
uses: actions/checkout@v3
- name: Log into container registry
uses: docker/[email protected]
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Pull build image
run: docker pull "$REGISTRY/$IMAGE"
- name: Check for code issues
run: |
result=$(docker run --rm \
--volume "$PWD:/input:ro" \
"$REGISTRY/$IMAGE")
echo "$result"
printf "\`\`\`\n%s\n\`\`\`" "$result" >> $GITHUB_STEP_SUMMARY