Skip to content

Commit

Permalink
Fix (ci): Ensure test-build jobs precede test-update jobs to corr…
Browse files Browse the repository at this point in the history
…ectly test incremental builds (#112)

Previously, the `test-update` job ran independently of the `test-build` job. The `test-update` job was not an incremental build based on the `test-build` job.

Now, the two independent jobs are combined as one job, with `test-build` preceeding `test-update`. This properly tests incremental builds using the local docker cache. In order to prevent `test-update` from pulling a remote `:latest` image, but to use the `:latest` from the preceeding `test-build` step's build cache, `NO_PULL` is added for `PIPELINE=update`.

Co-authored-by: leo <[email protected]>
Co-authored-by: joe <[email protected]>
  • Loading branch information
leojonathanoh and joeltimothyoh authored Mar 5, 2023
1 parent f6f3a09 commit d483030
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 18 deletions.
23 changes: 6 additions & 17 deletions .github/workflows/ci-master-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,15 @@ jobs:
if: github.event_name != 'pull_request' || github.repository_owner != 'startersclan'
steps:
- uses: actions/checkout@v3
- name: Test
- name: Test build
run: |
set -a
. ./test/build-hlds-cstrike.env
./build.sh
env:
STEAM_USERNAME: ${{ secrets.STEAM_USERNAME }}
STEAM_PASSWORD: ${{ secrets.STEAM_PASSWORD }}

test-update-hlds:
runs-on: ubuntu-20.04
if: github.event_name != 'pull_request' || github.repository_owner != 'startersclan'
steps:
- uses: actions/checkout@v3
- name: Test
- name: Test update
run: |
set -a
. ./test/update-hlds-cstrike.env
Expand All @@ -43,20 +37,15 @@ jobs:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: Test
- name: Test build
run: |
set -a
. ./test/build-srcds-hl2mp.env
./build.sh
env:
STEAM_USERNAME: ${{ secrets.STEAM_USERNAME }}
STEAM_PASSWORD: ${{ secrets.STEAM_PASSWORD }}

test-update-srcds:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: Test
- name: Test update
run: |
set -a
. ./test/update-srcds-hl2mp.env
Expand All @@ -67,7 +56,7 @@ jobs:

dockerhub-description-hlds:
runs-on: ubuntu-20.04
needs: [test-build-hlds, test-update-hlds]
needs: [test-build-hlds]
if: github.ref == 'refs/heads/master'
strategy:
matrix:
Expand Down Expand Up @@ -110,7 +99,7 @@ jobs:

dockerhub-description-srcds:
runs-on: ubuntu-20.04
needs: [test-build-srcds, test-update-srcds]
needs: [test-build-srcds]
if: github.ref == 'refs/heads/master'
strategy:
matrix:
Expand Down
6 changes: 5 additions & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
# FIX_APPMANIFEST= # bool - optional and only applicable to APPID=90
# LATEST=true # bool - optional
# CACHE= # bool - optional
# NO_PULL= # bool - optional
# NO_TEST= # bool - optional
# NO_PUSH= # bool - optional
# STEAM_LOGIN= # bool - optional
Expand Down Expand Up @@ -66,6 +67,7 @@ elif [ "$PIPELINE" = 'update' ]; then
APPID=${APPID:?err}
GAME=${GAME:?err}
GAME_UPDATE_COUNT=${GAME_UPDATE_COUNT:?err}
NO_PULL=${NO_PULL:-}
NO_TEST=${NO_TEST:-}
NO_PUSH=${NO_PUSH:-}
STEAM_LOGIN=${STEAM_LOGIN:-}
Expand Down Expand Up @@ -154,7 +156,9 @@ if [ "$PIPELINE" = 'build' ]; then
elif [ "$PIPELINE" = 'update' ]; then
GAME_IMAGE="$GAME_IMAGE_LATEST"
date
time docker pull "$GAME_IMAGE"
if [ ! "$NO_PULL" = 'true' ]; then
time docker pull "$GAME_IMAGE"
fi
date
time docker build \
--secret id=STEAM_USERNAME,env=STEAM_USERNAME \
Expand Down
1 change: 1 addition & 0 deletions test/update-hlds-cstrike.env
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ GAME_VERSION=1127
APPID=90
GAME=cstrike
GAME_UPDATE_COUNT=1
NO_PULL=true
NO_TEST=
NO_PUSH=true
STEAM_LOGIN=true
1 change: 1 addition & 0 deletions test/update-srcds-hl2mp.env
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ GAME_VERSION=6630498
APPID=232370
GAME=hl2mp
GAME_UPDATE_COUNT=1
NO_PULL=true
NO_TEST=
NO_PUSH=true
STEAM_LOGIN=

0 comments on commit d483030

Please sign in to comment.