Skip to content

Commit

Permalink
Merge pull request #1 from gammerce/change-structure
Browse files Browse the repository at this point in the history
Change directory structure
  • Loading branch information
budziam authored Oct 1, 2022
2 parents 6bbc6af + 6e6baa2 commit 21792e6
Show file tree
Hide file tree
Showing 14 changed files with 191 additions and 13 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/amxmodx-builder-master-workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Amxmodx Builder Master Workflow
on:
push:
branches:
- master
paths:
- amxmodx-builder/**
jobs:
main:
name: Build and push docker image to Docker Hub
runs-on: ubuntu-latest
strategy:
matrix:
include:
- version: "1.8.2"
build_url: "https://www.amxmodx.org/release/amxmodx-1.8.2-base-linux.tar.gz"
- version: "1.8.3"
build_url: "https://www.amxmodx.org/amxxdrop/1.8/amxmodx-1.8.3-dev-git5201-base-linux.tar.gz"
- version: "1.9.0"
build_url: "https://www.amxmodx.org/amxxdrop/1.9/amxmodx-1.9.0-git5241-base-linux.tar.gz"
- version: "1.10.0"
build_url: "https://www.amxmodx.org/amxxdrop/1.10/amxmodx-1.10.0-git5392-base-linux.tar.gz"
steps:
- name: Check out the repo
uses: actions/checkout@v2

- name: Set up QEMU
uses: docker/setup-qemu-action@v1

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and push to Docker Hub
uses: docker/build-push-action@v2
with:
context: ./amxmodx-builder
push: true
tags: budziam/amxmodx-builder:${{ matrix.version }}
build-args: |
BUILD_URL=${{ matrix.build_url }}
50 changes: 50 additions & 0 deletions .github/workflows/amxmodx-builder-pr-workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Amxmodx Builder Pull Request Workflow
on:
pull_request:
branches:
- master
paths:
- amxmodx-builder/**
jobs:
main:
name: Build docker image
runs-on: ubuntu-latest
strategy:
matrix:
include:
- version: "1.8.2"
build_url: "https://www.amxmodx.org/release/amxmodx-1.8.2-base-linux.tar.gz"
- version: "1.8.3"
build_url: "https://www.amxmodx.org/amxxdrop/1.8/amxmodx-1.8.3-dev-git5201-base-linux.tar.gz"
- version: "1.9.0"
build_url: "https://www.amxmodx.org/amxxdrop/1.9/amxmodx-1.9.0-git5241-base-linux.tar.gz"
- version: "1.10.0"
build_url: "https://www.amxmodx.org/amxxdrop/1.10/amxmodx-1.10.0-git5392-base-linux.tar.gz"
steps:
- name: Check out the repo
uses: actions/checkout@v2

- name: Get commit SHA
id: vars
run: echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"

- name: Set up QEMU
uses: docker/setup-qemu-action@v1

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and push to Docker Hub
uses: docker/build-push-action@v2
with:
context: ./amxmodx-builder
push: true
tags: budziam/amxmodx-builder:${{ matrix.version }}-${{ steps.vars.outputs.sha_short }}
build-args: |
BUILD_URL=${{ matrix.build_url }}
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
name: Publish docker image
name: Sourcemod Builder Master Workflow
on:
push:
branches:
- master
paths:
- sourcemod-builder/**
jobs:
main:
name: Build and push docker image to Docker Hub
runs-on: ubuntu-latest
strategy:
matrix:
include:
- sm_version: "1.10.0"
- version: "1.10.0"
build_url: "https://sm.alliedmods.net/smdrop/1.10/sourcemod-1.10.0-git6482-linux.tar.gz"
- sm_version: "1.11.0"
- version: "1.11.0"
build_url: "https://sm.alliedmods.net/smdrop/1.11/sourcemod-1.11.0-git6911-linux.tar.gz"
- sm_version: "1.12.0"
- version: "1.12.0"
build_url: "https://sm.alliedmods.net/smdrop/1.12/sourcemod-1.12.0-git6925-linux.tar.gz"
steps:
- name: Check out the repo
Expand All @@ -35,7 +37,8 @@ jobs:
- name: Build and push to Docker Hub
uses: docker/build-push-action@v2
with:
context: ./sourcemod-builder
push: true
tags: budziam/sourcemod-builder:${{ matrix.sm_version }}
tags: budziam/sourcemod-builder:${{ matrix.version }}
build-args: |
BUILD_URL=${{ matrix.build_url }}
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
name: Build docker image
name: Sourcemod Builder Pull Request Workflow
on:
pull_request:
branches:
- master
paths:
- sourcemod-builder/**
jobs:
main:
name: Build docker image
runs-on: ubuntu-latest
strategy:
matrix:
include:
- sm_version: "1.10.0"
- version: "1.10.0"
build_url: "https://sm.alliedmods.net/smdrop/1.10/sourcemod-1.10.0-git6482-linux.tar.gz"
- sm_version: "1.11.0"
- version: "1.11.0"
build_url: "https://sm.alliedmods.net/smdrop/1.11/sourcemod-1.11.0-git6911-linux.tar.gz"
- sm_version: "1.12.0"
- version: "1.12.0"
build_url: "https://sm.alliedmods.net/smdrop/1.12/sourcemod-1.12.0-git6925-linux.tar.gz"
steps:
- name: Check out the repo
Expand All @@ -39,7 +41,8 @@ jobs:
- name: Build and push to Docker Hub
uses: docker/build-push-action@v2
with:
context: ./sourcemod-builder
push: true
tags: budziam/sourcemod-builder:${{ matrix.sm_version }}-${{ steps.vars.outputs.sha_short }}
tags: budziam/sourcemod-builder:${{ matrix.version }}-${{ steps.vars.outputs.sha_short }}
build-args: |
BUILD_URL=${{ matrix.build_url }}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
SM builder ![Build](https://github.com/gammerce/sourcemod-builder/workflows/Build%20docker%20image/badge.svg)
Image Builder ![Build](https://github.com/gammerce/image-builder/workflows/Build%20docker%20image/badge.svg)
===
21 changes: 21 additions & 0 deletions amxmodx-builder/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
FROM ubuntu:18.04

ARG BUILD_URL

RUN dpkg --add-architecture i386
RUN apt-get update && apt-get install -y libc6:i386 libncurses5:i386 libstdc++6:i386 wget vim unzip inotify-tools

RUN useradd -m builder
USER builder

RUN mkdir /home/builder/sources

COPY ./compile.sh /home/builder/compile.sh
COPY ./watch.sh /home/builder/watch.sh

WORKDIR /home/builder
RUN wget -O build.tar.gz "${BUILD_URL}"
RUN tar -xzf build.tar.gz

WORKDIR /home/builder/addons/amxmodx/scripting
ENTRYPOINT ["/home/builder/compile.sh"]
File renamed without changes.
21 changes: 21 additions & 0 deletions amxmodx-builder/compile.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env bash

set -e

# Compile all sma files
for sourcefile in /home/builder/sources/*.sma; do
outfile="$( basename "$sourcefile" .sma).amxx"
echo "$( date +'%T' ) Compiling $sourcefile ... "

if [[ $1 == "test" ]]; then
if ./amxxpc -d0 $sourcefile -o/home/builder/builds/$outfile | grep -i "error"; then
exit 1
fi
else
./amxxpc -d2 $sourcefile -o/home/builder/builds/$outfile
fi
done

if [[ $1 == "watch" ]]; then
/home/builder/watch.sh
fi
13 changes: 13 additions & 0 deletions amxmodx-builder/watch.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/env bash

set -e

inotifywait -e close_write,moved_to,create -m /home/builder/sources/ |
while read -r directory events filename; do
sourcefile="/home/builder/sources/$filename"
outfile="$( basename "$sourcefile" .sma).amxx"

echo -n "$( date +'%T' ) Compiling $sourcefile ... "

./amxxpc $sourcefile -o/home/builder/builds/$outfile
done
Empty file added csgo/.gitkeep
Empty file.
4 changes: 2 additions & 2 deletions Dockerfile → sourcemod-builder/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ RUN apt-get install -y libc6:i386 libncurses5:i386 libstdc++6:i386 wget vim inot
RUN useradd builder
USER builder

COPY ./compile.sh /tmp/compile.sh
COPY ./watch.sh /tmp/watch.sh
COPY compile.sh /tmp/compile.sh
COPY watch.sh /tmp/watch.sh

WORKDIR /tmp
RUN wget -O build.tar.gz "${BUILD_URL}"
Expand Down
21 changes: 21 additions & 0 deletions sourcemod-builder/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2020 Gammerce

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
File renamed without changes.
File renamed without changes.

0 comments on commit 21792e6

Please sign in to comment.