Skip to content

Commit

Permalink
Gh actions (#762)
Browse files Browse the repository at this point in the history
Add pipeline to lint and build the php http server
  • Loading branch information
jacob-grahn authored Sep 11, 2024
1 parent b4b9827 commit 2fe4b26
Show file tree
Hide file tree
Showing 16 changed files with 32 additions and 801 deletions.
17 changes: 8 additions & 9 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Platform Racing 2

on: [push]
permissions:
packages: write

Expand All @@ -9,7 +9,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: 'Login to GitHub Container Registry'
uses: docker/login-action@v3
with:
Expand All @@ -22,12 +22,11 @@ jobs:
./vendor/bin/phpmd common,functions,http_server,multiplayer_server,policy_server text unusedcode
./vendor/bin/phpcs --standard=PSR2 common functions http_server multiplayer_server policy_server
- name: Build HTTP
if: github.ref == 'refs/heads/main'
run: |
docker build -t pr2-http --file docker/http_server.dockerfile .
if [ "$GITHUB_REF_NAME" == "main" ]; then
tag="$(date +%F-%H-%M)-$GITHUB_REF_NAME-$GITHUB_SHA"
docker tag pr2-http ghcr.io/jacob-grahn/platform-racing-2-http:latest
docker push ghcr.io/jacob-grahn/platform-racing-2-http:latest
docker tag pr2-http ghcr.io/jacob-grahn/platform-racing-2-http:$tag
docker push ghcr.io/jacob-grahn/platform-racing-2-http:$tag
fi
tag="$(date +%F-%H-%M)-$GITHUB_REF_NAME-$GITHUB_SHA"
docker tag pr2-http ghcr.io/jacob-grahn/platform-racing-2-http:latest
docker push ghcr.io/jacob-grahn/platform-racing-2-http:latest
docker tag pr2-http ghcr.io/jacob-grahn/platform-racing-2-http:$tag
docker push ghcr.io/jacob-grahn/platform-racing-2-http:$tag
3 changes: 1 addition & 2 deletions common/queries/campaigns.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,8 @@ function campaign_update($pdo, $campaign_id, $levels)
throw new Exception('Nine levels must be specified.');
}

foreach ($levels as $key => $data) {
foreach ($levels as $key => $level) {
$level_num = $key + 1;
$level = $levels[$key];

// sanity: all info present?
if (empty($level->level_id) || empty($level->prize_type) || empty($level->prize_id)) {
Expand Down
2 changes: 1 addition & 1 deletion common/queries/follows.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,4 +106,4 @@ function followers_select($pdo, $user_id)
}

return $stmt->fetchAll(PDO::FETCH_OBJ);
}
}
2 changes: 1 addition & 1 deletion common/queries/guilds.php
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ function guild_select_members($pdo, $guild_id, $suppress_error = false)

// add group string to all members before returning
$members = $stmt->fetchAll(PDO::FETCH_OBJ);
$members = array_map(function($user) {
$members = array_map(function ($user) {
$user->group = get_group_info($user)->str;
return $user;
}, $members);
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"require-dev": {
"squizlabs/php_codesniffer": "3.*",
"squizlabs/php_codesniffer": "^3.0",
"phpmd/phpmd" : "@stable"
}
}
Loading

0 comments on commit 2fe4b26

Please sign in to comment.