Build Melee #37
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: build-melee | |
run-name: Build Melee | |
on: | |
push: | |
paths: [ "**" ] | |
pull_request: | |
env: | |
IMAGE_REPO: doldecomp/melee | |
jobs: | |
build-linux: | |
name: Linux | |
runs-on: ubuntu-latest | |
env: | |
REGISTRY: ghcr.io | |
OUTPUT: ${{ github.workspace }}/output | |
strategy: | |
matrix: | |
make_flags: ["GENERATE_MAP=1", "NON_MATCHING=1"] | |
fail-fast: false | |
steps: | |
- name: Get image name | |
env: | |
IMAGE_SUFFIX: build-linux:latest | |
run: | | |
echo "IMAGE=$IMAGE_REPO/$IMAGE_SUFFIX" >> $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: | | |
mkdir -p "$OUTPUT" | |
docker run --rm \ | |
--user "$(id -u):$(id -g)" \ | |
--volume "$PWD":/input:ro \ | |
--volume "$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: ${{ env.OUTPUT }}/ssbm.us.1.2/GALE01.map | |
if-no-files-found: error | |
- name: Set step summary | |
if: matrix.make_flags == 'GENERATE_MAP=1' | |
run: | | |
printf "\`\`\`\n%s\n\`\`\`" "$(cat "$OUTPUT/PROGRESS.md")" \ | |
>> $GITHUB_STEP_SUMMARY | |
build-windows: | |
if: false | |
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: | |
IMAGE_SUFFIX: build-windows:latest | |
shell: bash | |
run: | | |
echo "IMAGE=$IMAGE_REPO/$IMAGE_SUFFIX" >> $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: | |
IMAGE_SUFFIX: check-issues:latest | |
run: | | |
echo "IMAGE=$IMAGE_REPO/$IMAGE_SUFFIX" >> $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: | | |
docker run --rm \ | |
--user "$(id -u):$(id -g)" \ | |
--volume "$PWD:/input:ro" \ | |
"$REGISTRY/$IMAGE" |