Skip to content

Commit 879de78

Browse files
committed
feat: add github action for automated tests (unfinished)
1 parent 3cdab42 commit 879de78

File tree

4 files changed

+101
-44
lines changed

4 files changed

+101
-44
lines changed

.github/workflows/tests.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Tests
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
jobs:
12+
tests:
13+
runs-on: windows-latest
14+
15+
steps:
16+
- name: Checkout repository
17+
uses: actions/[email protected]
18+
19+
- name: Fetch Simba 2 download URL
20+
id: simba-url
21+
shell: bash
22+
run: |
23+
url="https://raw.githubusercontent.com/Villavu/Simba-Build-Archive/refs/heads/main/latest.win64"
24+
baseUrl=$(curl -s "$url" | sed 's/win64\.zip$//')
25+
echo "Base URL: $baseUrl"
26+
echo "::set-output name=baseUrl::$baseUrl"
27+
28+
- name: Download Simba 2.0 (64-bit)
29+
shell: bash
30+
run: |
31+
baseUrl="${{ steps.fetch-url.outputs.baseUrl }}"
32+
downloadUrl="${baseUrl}win64.zip"
33+
echo "Download URL (64-bit): $downloadUrl"
34+
outputFile="$RUNNER_TEMP/downloaded64.zip"
35+
curl -o "$outputFile" "$downloadUrl"
36+
unzip -o "$outputFile" -d ./tests
37+
rm -f "$outputFile"
38+
39+
- name: Download Simba 2.0 (32-bit)
40+
shell: bash
41+
run: |
42+
baseUrl="${{ steps.fetch-url.outputs.baseUrl }}"
43+
downloadUrl="${baseUrl}win32.zip"
44+
echo "Download URL (32-bit): $downloadUrl"
45+
outputFile="$RUNNER_TEMP/downloaded32.zip"
46+
curl -o "$outputFile" "$downloadUrl"
47+
unzip -o "$outputFile" -d ./tests
48+
rm -f "$outputFile"
49+
50+
- name: Run tests
51+
run: |
52+
cd ./tests
53+
ls

.github/workflows/version.yml

Lines changed: 44 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,54 @@
1-
name: CalVer
1+
name: Version
22

33
on:
44
push:
55
branches:
66
- main
77

88
jobs:
9-
bump-version:
9+
version:
1010
runs-on: ubuntu-latest
1111

1212
steps:
13-
- name: Checkout repository
14-
uses: actions/[email protected]
15-
16-
- name: Get current date
17-
id: date
18-
run: |
19-
echo "CURRENT_YEAR=$(date +'%Y')" >> $GITHUB_ENV
20-
echo "CURRENT_MONTH=$(date +'%m')" >> $GITHUB_ENV
21-
echo "CURRENT_DAY=$(date +'%d')" >> $GITHUB_ENV
22-
23-
- name: Get commit hash
24-
id: commit-hash
25-
run: echo "COMMIT_HASH=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
26-
27-
- name: Update version.simba
28-
run: |
29-
sed -i "s/SRLT_VERSION_YEAR: Integer = .*/SRLT_VERSION_YEAR: Integer = $CURRENT_YEAR;/" version.simba
30-
sed -i "s/SRLT_VERSION_MONTH: Integer = .*/SRLT_VERSION_MONTH: Integer = $CURRENT_MONTH;/" version.simba
31-
sed -i "s/SRLT_VERSION_DAY: Integer = .*/SRLT_VERSION_DAY: Integer = $CURRENT_DAY;/" version.simba
32-
sed -i "s/SRLT_VERSION_COMMIT_HASH: String = .*/SRLT_VERSION_COMMIT_HASH: String = '$COMMIT_HASH';/" version.simba
33-
34-
- name: Commit changes
35-
run: |
36-
git config --global user.name "Wasp Bot"
37-
git config --global user.email "[email protected]"
38-
git add version.simba
39-
git commit -m "Automatic version bump to $CURRENT_YEAR.$CURRENT_MONTH.$CURRENT_DAY-$COMMIT_HASH"
40-
git push
41-
42-
- name: Create new tag
43-
id: tag
44-
run: |
45-
TAG_NAME="$CURRENT_YEAR.$CURRENT_MONTH.$CURRENT_DAY-$COMMIT_HASH"
46-
echo "TAG_NAME=$TAG_NAME" >> $GITHUB_ENV
47-
git tag $TAG_NAME
48-
git push origin $TAG_NAME
49-
50-
- name: Create release
51-
run: |
52-
gh release create $TAG_NAME --generate-notes
53-
env:
54-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
13+
- name: Checkout repository
14+
uses: actions/[email protected]
15+
16+
- name: Get current date
17+
id: date
18+
run: |
19+
echo "CURRENT_YEAR=$(date +'%Y')" >> $GITHUB_ENV
20+
echo "CURRENT_MONTH=$(date +'%m')" >> $GITHUB_ENV
21+
echo "CURRENT_DAY=$(date +'%d')" >> $GITHUB_ENV
22+
23+
- name: Get commit hash
24+
id: commit-hash
25+
run: echo "COMMIT_HASH=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
26+
27+
- name: Update version.simba
28+
run: |
29+
sed -i "s/SRLT_VERSION_YEAR: Integer = .*/SRLT_VERSION_YEAR: Integer = $CURRENT_YEAR;/" version.simba
30+
sed -i "s/SRLT_VERSION_MONTH: Integer = .*/SRLT_VERSION_MONTH: Integer = $CURRENT_MONTH;/" version.simba
31+
sed -i "s/SRLT_VERSION_DAY: Integer = .*/SRLT_VERSION_DAY: Integer = $CURRENT_DAY;/" version.simba
32+
sed -i "s/SRLT_VERSION_COMMIT_HASH: String = .*/SRLT_VERSION_COMMIT_HASH: String = '$COMMIT_HASH';/" version.simba
33+
34+
- name: Commit changes
35+
run: |
36+
git config --global user.name "Wasp Bot"
37+
git config --global user.email "[email protected]"
38+
git add version.simba
39+
git commit -m "Automatic version bump to $CURRENT_YEAR.$CURRENT_MONTH.$CURRENT_DAY-$COMMIT_HASH"
40+
git push
41+
42+
- name: Create new tag
43+
id: tag
44+
run: |
45+
TAG_NAME="$CURRENT_YEAR.$CURRENT_MONTH.$CURRENT_DAY-$COMMIT_HASH"
46+
echo "TAG_NAME=$TAG_NAME" >> $GITHUB_ENV
47+
git tag $TAG_NAME
48+
git push origin $TAG_NAME
49+
50+
- name: Create release
51+
run: |
52+
gh release create $TAG_NAME --generate-notes
53+
env:
54+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

tests/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Tests
2+
Automated tests to ensure the library is working as expected.

tests/compile.simba

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
{$I SRLT/osrs.simba}
2+

0 commit comments

Comments
 (0)