Jump to content

Here's a Script to Help You Release Scripts Quickly


mgm

Recommended Posts

Hi

 

I needed a build script for Windows, looked at a few options and scripts I used in the past but couldn't find any good matches so wrote a custom one. Sharing the resulting script feel free to try it out if you need one.
It is nothing special just doing a few tasks quicker in an automated manner. 

Probably there are better github/gitlab integration options but I couldn't find any hence this script.  Basically it works via linux shell bash on Windows. completely free software.

 

Some features of this script:

  • PREPROCESSOR
    You can comment your source code files with special tags, during the parsing phase, builder.sh will follow your instructions.
    To give an example, in configuration files there are values that I use during development & testing, such as: MINIMUM_WAIT_TIME_BETWEEN_TAXI_REQUESTS.
    Normally this value should be a long time like 15 minutes (so that one player won't be able to book all taxis) = 900 seconds.
    During testing I obviously do not wish to wait 15 minutes between each test call, so I set it to 10 seconds.
    When I take this code to release, I want that 10 seconds value to be removed, and 900 seconds value to be uncommented.

    In the past I did this manually but it is tiring and error prone. This script will do it for me. What do I exactly have in the file? It's like this:
    // --min wait time between bookings--
    // default: 900
    //mgmTfA_configgv_minimumWaitingTimeBetweenFixedDestinationTaxiBookingsInSecondsNumber = 900;//__builder___UNCOMMENT_THIS_LINE
    mgmTfA_configgv_minimumWaitingTimeBetweenFixedDestinationTaxiBookingsInSecondsNumber = 10;//__builder___DELETE_THIS_LINE

    As you can see both lines are there. Preprocessor will  delete the bottom line, and also uncomment the top line.

  • CODE MINIFICATION 
    It removes all comments, all subsequent whitespaces, all subsequent tabs which results in slightly smaller PBO files.

  • AUTO BUILD VERSION BUMP 
    Well this one is simple, takes v.0.5.4.1.build16 and makes it v.0.5.4.1.build17. Numbers are stored in files so the next one will of course be v.0.5.4.1.build18.

  • SINGLE FILE ARCHIVING 
    It takes the whole project (source code + documentation), then generates PBO files (@server, and MPmission), places them separately, copies in documentation, fixes any documentation strip-comment issues in case you actually wish to keep some files with comments (by copying them back over), then also copies in the commented source code  for good measure so that interested parties can inspect code with comments on, finally creates a single archive file from the whole output for single download. Creates a v.0.5.4.1.build17 or so directory

  • AUTOMATED INTEGRITY CHECKSUM
    File integrity shouldn't be a problem in theory but in practice I had some people complaining about zip/7z files not properly extracting, I guess it is best practice to add an easy-to-verify checksum to any release with GNUPG utils.
    Here is how it works, you run the script, it creates the sha256sum.txt file and places next to the single-release-file (so the  directory contents so far is: YourScript_v.0.5.4.1.build17.7z, sha256sum.txt) then copies in the sha256sum.exe file (20 kb or so), finally throws in a batch script RUN_TO_VERIFY_INTEGRITY.bat. If it is clicked on of course it checks the 7z file against sum and reports FAIL or OK

 

In summary, once you set it up for your environment, if you double click on this file, it generates a build.
If you put your git_sync.sh next to it, with another click you can upload it to your repo, thus [after doing the hard script development bit] your okay let's release this now effort comes down to two clicks.

I thought I could do this in an hour, well let's just say it took a bit longer than 'planned'. Hope it helps someone.

 

GitLab link to script doBuildNow.sh:      https://gitlab.com/themgm/Transport_for_Arma/blob/master/release_engineering/doBuildNow.sh

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
  • Discord

×
×
  • Create New...