chore(deps): bump juliangruber/sleep-action from 1 to 2 (#30) #89
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and test | |
on: | |
push: | |
branches: | |
- 'master' | |
- '*.*.*' | |
pull_request: | |
branches: | |
- 'master' | |
release: | |
types: [ created, edited ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Setup sourcepawn compiler | |
uses: rumblefrog/setup-sp@v1.2.2 | |
- name: Download dependencies | |
run: | | |
mkdir -p addons/sourcemod/plugins | |
wget "https://forums.alliedmods.net/attachment.php?attachmentid=188744&d=1618607414" -O system2.zip | |
unzip -o system2.zip -d addons/sourcemod/ | |
- name: Compile | |
run: | | |
spcomp \ | |
-iaddons/sourcemod/scripting/include \ | |
scripting/connector.sp \ | |
-o scripting/connector.smx | |
- name: Upload compiled plugin | |
uses: actions/upload-artifact@v3 | |
with: | |
name: connector | |
path: scripting/connector.smx | |
if-no-files-found: error | |
- name: Upload release | |
if: github.event_name == 'release' | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: scripting/connector.smx | |
tag: ${{ github.ref }} | |
overwrite: true | |
test: | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Download the plugin | |
uses: actions/download-artifact@v3 | |
with: | |
name: connector | |
path: connector.smx | |
- name: Build Docker image | |
uses: docker/build-push-action@v5 | |
with: | |
tags: connector:test | |
context: . | |
- name: Start Docker container | |
run: docker run --name connector -e "RCON_PASSWORD=123456" -d connector:test | |
- name: Sleep for 45s | |
uses: juliangruber/sleep-action@v2 | |
with: | |
time: 45s | |
- name: Check whether the connector is listed | |
run: docker exec connector /home/tf2/server/rcon -H 127.0.0.1 -p 27015 -P 123456 "sm plugins list" | grep "tf2pickup.org connector" | |
- name: Stop the container | |
run: docker stop connector |