Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: reusable workflows for tileset composers #2106

Merged
merged 1 commit into from
Aug 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 4 additions & 68 deletions .github/workflows/ASCII_Overmap_ci_build.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,5 @@
# performs CI builds using compose.py from
# https://github.com/CleverRaven/Cataclysm-DDA
#
# This action is triggered by any PR against the master branch as well
# as on any push to the master branch itself
# that changes any file in gfx/ASCII_Overmap folder
name: ASCII_Overmap composer

env:
TILESET: ASCII_Overmap
COMPOSE_ARGS: --use-all
BUILD_DIR: build

on:
push:
branches:
Expand All @@ -27,60 +16,7 @@ on:

jobs:
build:
name: CI Build
runs-on: ubuntu-latest
steps:
- name: Install Dependencies
uses: awalsh128/cache-apt-pkgs-action@v1
with:
packages: musl python3 python3-pip libvips42

# re-installing libvips; caching it won't set it up the way we need it
# still cache it because we'll make it work somehow
- run: sudo apt-get update; sudo apt-get install libvips42
- run: pip3 install pyvips

- name: Checkout Code
uses: actions/checkout@v3

- name: Build
id: build
run: |
mkdir "$BUILD_DIR"
wget -q -P "$BUILD_DIR" https://raw.githubusercontent.com/CleverRaven/Cataclysm-DDA/master/tools/gfx_tools/compose.py \
|| echo "Error: Failed to get compose.py"

python3 "$BUILD_DIR/compose.py" --feedback CONCISE --loglevel INFO $COMPOSE_ARGS "gfx/$TILESET" "$BUILD_DIR"
[ -f "gfx/$TILESET/fallback.png" ] && cp "gfx/$TILESET/fallback.png" "$BUILD_DIR/"

artifact_name="$TILESET-dev-git-${GITHUB_SHA::7}"

mkdir "$artifact_name"
mv "${BUILD_DIR}"/*.png "$artifact_name"
cp "$BUILD_DIR/tile_config.json" "$artifact_name"
cp "gfx/$TILESET/tileset.txt" "$artifact_name"

echo "ARTIFACT-NAME=$artifact_name" >> $GITHUB_OUTPUT

- name: Upload Artifacts
uses: actions/[email protected]
with:
name: ${{ steps.build.outputs.ARTIFACT-NAME }}
path: ${{ steps.build.outputs.ARTIFACT-NAME }}

- name: Compare IDs with ${{ github.base_ref }}
id: compare
if: github.base_ref
run: |
echo "Switching to the target branch ${{ github.base_ref }} to get differences between ID lists"
git fetch --no-tags --prune --no-recurse-submodules --depth=1 origin +${{ github.base_ref }}
git checkout origin/${{ github.base_ref }}

mkdir "$BUILD_DIR/base_json/"
python3 "$BUILD_DIR/compose.py" $COMPOSE_ARGS --only-json "gfx/$TILESET" "$BUILD_DIR/base_json/"

wget -q -P "$BUILD_DIR" https://raw.githubusercontent.com/CleverRaven/Cataclysm-DDA/master/tools/gfx_tools/list_tileset_ids.py \
|| echo "Error: Failed to get list_tileset_ids.py"

echo -e "\nDifferences in IDs:"
(diff -u0 <(python3 "$BUILD_DIR/list_tileset_ids.py" "$BUILD_DIR/base_json/") <(python3 "$BUILD_DIR/list_tileset_ids.py" "$BUILD_DIR/")) | tail -n +3
uses: ./.github/workflows/composer_template.yml
with:
tileset: ASCII_Overmap
composer-args: --use-all
73 changes: 4 additions & 69 deletions .github/workflows/Altica_ci_build.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,5 @@
# performs CI builds using compose.py from
# https://github.com/CleverRaven/Cataclysm-DDA
#
# This action is triggered by any PR against the master branch as well
# as on any push to the master branch itself
# that changes any file in gfx/Altica folder
name: Altica composer

env:
TILESET: Altica
COMPOSE_ARGS: --use-all --obsolete-fillers
BUILD_DIR: build

on:
push:
branches:
Expand All @@ -29,61 +18,7 @@ on:

jobs:
build:
name: CI Build
runs-on: ubuntu-latest
steps:
- name: Install Dependencies
uses: awalsh128/cache-apt-pkgs-action@v1
with:
packages: musl python3 python3-pip libvips42

# re-installing libvips; caching it won't set it up the way we need it
# still cache it because we'll make it work somehow
- run: sudo apt-get update; sudo apt-get install libvips42
- run: pip3 install pyvips

- name: Checkout Code
uses: actions/checkout@v3

- name: Build
id: build
run: |
mkdir "$BUILD_DIR"
wget -q -P "$BUILD_DIR" https://raw.githubusercontent.com/CleverRaven/Cataclysm-DDA/master/tools/gfx_tools/compose.py \
|| echo "Error: Failed to get compose.py"

python3 "$BUILD_DIR/compose.py" --feedback CONCISE --loglevel INFO $COMPOSE_ARGS "gfx/$TILESET" "$BUILD_DIR"
[ -f "gfx/$TILESET/fallback.png" ] && cp "gfx/$TILESET/fallback.png" "$BUILD_DIR/"

artifact_name="$TILESET-dev-git-${GITHUB_SHA::7}"

mkdir "$artifact_name"
mv "${BUILD_DIR}"/*.png "$artifact_name"
cp "$BUILD_DIR/tile_config.json" "$artifact_name"
cp "gfx/$TILESET/tileset.txt" "$artifact_name"
cp "gfx/$TILESET/layering.json" "$artifact_name"

echo "ARTIFACT-NAME=$artifact_name" >> $GITHUB_OUTPUT

- name: Upload Artifacts
uses: actions/[email protected]
with:
name: ${{ steps.build.outputs.ARTIFACT-NAME }}
path: ${{ steps.build.outputs.ARTIFACT-NAME }}

- name: Compare IDs with ${{ github.base_ref }}
id: compare
if: github.base_ref
run: |
echo "Switching to the target branch ${{ github.base_ref }} to get differences between ID lists"
git fetch --no-tags --prune --no-recurse-submodules --depth=1 origin +${{ github.base_ref }}
git checkout origin/${{ github.base_ref }}

mkdir "$BUILD_DIR/base_json/"
python3 "$BUILD_DIR/compose.py" $COMPOSE_ARGS --only-json "gfx/$TILESET" "$BUILD_DIR/base_json/"

wget -q -P "$BUILD_DIR" https://raw.githubusercontent.com/CleverRaven/Cataclysm-DDA/master/tools/gfx_tools/list_tileset_ids.py \
|| echo "Error: Failed to get list_tileset_ids.py"

echo -e "\nDifferences in IDs:"
(diff -u0 <(python3 "$BUILD_DIR/list_tileset_ids.py" "$BUILD_DIR/base_json/") <(python3 "$BUILD_DIR/list_tileset_ids.py" "$BUILD_DIR/")) | tail -n +3
uses: ./.github/workflows/composer_template.yml
with:
tileset: Altica
composer-args: --use-all --obsolete-fillers
73 changes: 4 additions & 69 deletions .github/workflows/Chibi_ci_build.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,5 @@
# performs CI builds using compose.py from
# https://github.com/CleverRaven/Cataclysm-DDA
#
# This action is triggered by any PR against the master branch as well
# as on any push to the master branch itself
# that changes any file in gfx/UltimateCataclysm, gfx/MShockXotto+/ or gfx/Chibi_Ultica/ folders
name: Chibi_Ultica composer

env:
TILESET: Chibi_Ultica
COMPOSE_ARGS: --use-all
BUILD_DIR: build

on:
push:
branches:
Expand Down Expand Up @@ -53,61 +42,7 @@ on:

jobs:
build:
name: CI Build
runs-on: ubuntu-latest
steps:
- name: Install Dependencies
uses: awalsh128/cache-apt-pkgs-action@v1
with:
packages: musl python3 python3-pip libvips42

# re-installing libvips; caching it won't set it up the way we need it
# still cache it because we'll make it work somehow
- run: sudo apt-get update; sudo apt-get install libvips42
- run: pip3 install pyvips

- name: Checkout Code
uses: actions/checkout@v3

- name: Build
id: build
run: |
mkdir "$BUILD_DIR"
wget -q -P "$BUILD_DIR" https://raw.githubusercontent.com/CleverRaven/Cataclysm-DDA/master/tools/gfx_tools/compose.py \
|| echo "Error: Failed to get compose.py"

python3 "$BUILD_DIR/compose.py" --feedback CONCISE --loglevel INFO $COMPOSE_ARGS "gfx/$TILESET" "$BUILD_DIR"
[ -f "gfx/$TILESET/fallback.png" ] && cp "gfx/$TILESET/fallback.png" "$BUILD_DIR/"

artifact_name="$TILESET-dev-git-${GITHUB_SHA::7}"

mkdir "$artifact_name"
mv "${BUILD_DIR}"/*.png "$artifact_name"
cp "$BUILD_DIR/tile_config.json" "$artifact_name"
cp "gfx/$TILESET/tileset.txt" "$artifact_name"
cp "gfx/$TILESET/layering.json" "$artifact_name"

echo "ARTIFACT-NAME=$artifact_name" >> $GITHUB_OUTPUT

- name: Upload Artifacts
uses: actions/[email protected]
with:
name: ${{ steps.build.outputs.ARTIFACT-NAME }}
path: ${{ steps.build.outputs.ARTIFACT-NAME }}

- name: Compare IDs with ${{ github.base_ref }}
id: compare
if: github.base_ref
run: |
echo "Switching to the target branch ${{ github.base_ref }} to get differences between ID lists"
git fetch --no-tags --prune --no-recurse-submodules --depth=1 origin +${{ github.base_ref }}
git checkout origin/${{ github.base_ref }}

mkdir "$BUILD_DIR/base_json/"
python3 "$BUILD_DIR/compose.py" $COMPOSE_ARGS --only-json "gfx/$TILESET" "$BUILD_DIR/base_json/"

wget -q -P "$BUILD_DIR" https://raw.githubusercontent.com/CleverRaven/Cataclysm-DDA/master/tools/gfx_tools/list_tileset_ids.py \
|| echo "Error: Failed to get list_tileset_ids.py"

echo -e "\nDifferences in IDs:"
(diff -u0 <(python3 "$BUILD_DIR/list_tileset_ids.py" "$BUILD_DIR/base_json/") <(python3 "$BUILD_DIR/list_tileset_ids.py" "$BUILD_DIR/")) | tail -n +3
uses: ./.github/workflows/composer_template.yml
with:
tileset: Chibi_Ultica
composer-args: --use-all
72 changes: 4 additions & 68 deletions .github/workflows/HitButton_iso_ci_build.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,5 @@
# performs CI builds using compose.py from
# https://github.com/CleverRaven/Cataclysm-DDA
#
# This action is triggered by any PR against the master branch as well
# as on any push to the master branch itself
# that changes any file in gfx/HitButton_iso folder
name: HitButton iso composer

env:
TILESET: HitButton_iso
COMPOSE_ARGS: --use-all
BUILD_DIR: build

on:
push:
branches:
Expand All @@ -27,60 +16,7 @@ on:

jobs:
build:
name: CI Build
runs-on: ubuntu-latest
steps:
- name: Install Dependencies
uses: awalsh128/cache-apt-pkgs-action@v1
with:
packages: musl python3 python3-pip libvips42

# re-installing libvips; caching it won't set it up the way we need it
# still cache it because we'll make it work somehow
- run: sudo apt-get update; sudo apt-get install libvips42
- run: pip3 install pyvips

- name: Checkout Code
uses: actions/checkout@v3

- name: Build
id: build
run: |
mkdir "$BUILD_DIR"
wget -q -P "$BUILD_DIR" https://raw.githubusercontent.com/CleverRaven/Cataclysm-DDA/master/tools/gfx_tools/compose.py \
|| echo "Error: Failed to get compose.py"

python3 "$BUILD_DIR/compose.py" --feedback CONCISE --loglevel INFO $COMPOSE_ARGS "gfx/$TILESET" "$BUILD_DIR"
[ -f "gfx/$TILESET/fallback.png" ] && cp "gfx/$TILESET/fallback.png" "$BUILD_DIR/"

artifact_name="$TILESET-dev-git-${GITHUB_SHA::7}"

mkdir "$artifact_name"
mv "${BUILD_DIR}"/*.png "$artifact_name"
cp "$BUILD_DIR/tile_config.json" "$artifact_name"
cp "gfx/$TILESET/tileset.txt" "$artifact_name"

echo "ARTIFACT-NAME=$artifact_name" >> $GITHUB_OUTPUT

- name: Upload Artifacts
uses: actions/[email protected]
with:
name: ${{ steps.build.outputs.ARTIFACT-NAME }}
path: ${{ steps.build.outputs.ARTIFACT-NAME }}

- name: Compare IDs with ${{ github.base_ref }}
id: compare
if: github.base_ref
run: |
echo "Switching to the target branch ${{ github.base_ref }} to get differences between ID lists"
git fetch --no-tags --prune --no-recurse-submodules --depth=1 origin +${{ github.base_ref }}
git checkout origin/${{ github.base_ref }}

mkdir "$BUILD_DIR/base_json/"
python3 "$BUILD_DIR/compose.py" $COMPOSE_ARGS --only-json "gfx/$TILESET" "$BUILD_DIR/base_json/"

wget -q -P "$BUILD_DIR" https://raw.githubusercontent.com/CleverRaven/Cataclysm-DDA/master/tools/gfx_tools/list_tileset_ids.py \
|| echo "Error: Failed to get list_tileset_ids.py"

echo -e "\nDifferences in IDs:"
(diff -u0 <(python3 "$BUILD_DIR/list_tileset_ids.py" "$BUILD_DIR/base_json/") <(python3 "$BUILD_DIR/list_tileset_ids.py" "$BUILD_DIR/")) | tail -n +3
uses: ./.github/workflows/composer_template.yml
with:
tileset: HitButton_iso
composer-args: --use-all
Loading