Skip to content

Commit 1bd49be

Browse files
authored
Merge pull request #8 from Bombardier-C-Kram/master
Implement packaging
2 parents 2af0c00 + 4915639 commit 1bd49be

File tree

15 files changed

+252
-61
lines changed

15 files changed

+252
-61
lines changed

.github/workflows/action.yml

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
name: RayLib APL CI
2+
3+
on:
4+
push:
5+
branches:
6+
- '**'
7+
pull_request:
8+
branches:
9+
- '**'
10+
release:
11+
types: [published]
12+
workflow_dispatch:
13+
14+
jobs:
15+
build:
16+
name: Build
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Install Dyalog APL
20+
run: |
21+
DEBFILE=$(curl -s https://www.dyalog.com/uploads/php/download.dyalog.com/download.php?file=docker.metafile | awk -v v="19.0" '$0~v && /deb/ {print $3}')
22+
curl -o /tmp/dyalog.deb "${DEBFILE}"
23+
sudo apt install -y /tmp/dyalog.deb
24+
- name: Setup .NET
25+
uses: actions/setup-dotnet@v4
26+
with:
27+
dotnet-version: '8.X'
28+
- name: Checkout repository
29+
uses: actions/checkout@v4
30+
- name: Activate Tatin and Cider
31+
run: |
32+
unset DISPLAY
33+
cd "${GITHUB_WORKSPACE}"
34+
chmod +x "${GITHUB_WORKSPACE}/.github/workflows/activate.apls" "${GITHUB_WORKSPACE}/.github/workflows/update.apls"
35+
xvfb-run -a "${GITHUB_WORKSPACE}/.github/workflows/activate.apls"
36+
echo y | xvfb-run -a "${GITHUB_WORKSPACE}/.github/workflows/update.apls"
37+
- name: Build Project
38+
run: |
39+
unset DISPLAY
40+
export BATCH=true
41+
cd "${GITHUB_WORKSPACE}"
42+
chmod +x "${GITHUB_WORKSPACE}/.github/workflows/build.apls"
43+
xvfb-run -a "${GITHUB_WORKSPACE}/.github/workflows/build.apls"
44+
- name: Get Build Artifacts
45+
uses: actions/upload-artifact@v4
46+
with:
47+
name: package
48+
path: Dist/*-*-*.zip # Like bkaw-JWTAPL-2.1.0.zip
49+
50+
publish:
51+
name: Publish
52+
needs: build
53+
runs-on: ubuntu-latest
54+
if: ${{ github.event_name == 'release' && github.event.action == 'published' }}
55+
steps:
56+
- name: Install Dyalog APL
57+
run: |
58+
DEBFILE=$(curl -s https://www.dyalog.com/uploads/php/download.dyalog.com/download.php?file=docker.metafile | awk -v v="19.0" '$0~v && /deb/ {print $3}')
59+
curl -o /tmp/dyalog.deb "${DEBFILE}"
60+
sudo apt install -y /tmp/dyalog.deb
61+
- name: Setup .NET
62+
uses: actions/setup-dotnet@v4
63+
with:
64+
dotnet-version: '8.X'
65+
- name: Checkout repository
66+
uses: actions/checkout@v4
67+
- name: Activate Tatin and Cider
68+
run: |
69+
unset DISPLAY
70+
cd "${GITHUB_WORKSPACE}"
71+
chmod +x "${GITHUB_WORKSPACE}/.github/workflows/activate.apls" "${GITHUB_WORKSPACE}/.github/workflows/update.apls"
72+
xvfb-run -a "${GITHUB_WORKSPACE}/.github/workflows/activate.apls"
73+
echo y | xvfb-run -a "${GITHUB_WORKSPACE}/.github/workflows/update.apls"
74+
- name: Download a single artifact
75+
uses: actions/download-artifact@v4
76+
with:
77+
name: package
78+
- name: Publish Artifacts
79+
env:
80+
RELEASE_VERSION: ${{ github.event.release.tag_name }}
81+
TATIN_API_KEY: ${{ secrets.TATIN_API_KEY }}
82+
run: |
83+
export BATCH=true
84+
# Use $RELEASE_VERSION in your publish steps?
85+
echo "Publishing the build artifacts for version $RELEASE_VERSION..."
86+
cd "${GITHUB_WORKSPACE}"
87+
chmod +x "${GITHUB_WORKSPACE}/.github/workflows/publish.apls"
88+
xvfb-run -a "${GITHUB_WORKSPACE}/.github/workflows/publish.apls"

.github/workflows/activate.apls

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/usr/bin/dyalogscript DYALOG_INITSESSION=1
2+
⎕←'Loading Tatin and Cider...'
3+
⎕SE.(⍎⊃2⎕FIX'/StartupSession.aplf',⍨2⎕NQ#'GetEnvironment' 'DYALOG')
4+
⎕←⎕SE.UCMD 'Tools.Activate all'
5+
⎕←'Success loading Tatin and Cider'
6+
⎕off 0

.github/workflows/build.apls

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/usr/bin/dyalogscript DYALOG_INITSESSION=1
2+
⎕←'BUILD!'
3+
⎕PW←500
4+
⎕SE.(⍎⊃2⎕FIX'/StartupSession.aplf',⍨2⎕NQ#'GetEnvironment' 'DYALOG')
5+
⎕ML ⎕IO←1 0 ⍝ ⎕IO delana est
6+
⎕←⎕SE.UCMD 'ureset'
7+
⎕←⎕SE.UCMD 'Tatin.Version'
8+
parms←⎕ns ''
9+
parms.(projectPath targetPath version dependencyFolder)←'.' 'Dist' '' ''
10+
⎕SE.Tatin.BuildPackage parms
11+
⎕←'Built!'
12+
⎕off 0

.github/workflows/publish.apls

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/usr/bin/dyalogscript DYALOG_INITSESSION=1
2+
⎕PW←500
3+
⎕SE.(⍎⊃2⎕FIX'/StartupSession.aplf',⍨2⎕NQ#'GetEnvironment' 'DYALOG')
4+
⎕ML ⎕IO←1 0 ⍝ ⎕IO delana est
5+
package←∊⊃1 ⎕NPARTS⊃(⎕ninfo⍠('Wildcard' 1))'*.zip'
6+
⎕←'publishing: ',package
7+
apikey←(⊢2⎕NQ#'GetEnvironment',⊂)'TATIN_API_KEY'
8+
(⎕SE.Tatin.MyUserSettings.GetRegistry '[tatin]').api_key←apikey
9+
⎕SE.Tatin.MyUserSettings.Save 1
10+
⎕SE.Tatin.PublishPackage (package '[tatin]')
11+
⎕←'Published!!!'
12+
⎕off 0

.github/workflows/update.apls

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/usr/bin/dyalogscript DYALOG_INITSESSION=1
2+
⎕←'Updating Tatin'
3+
⎕PW←500
4+
⎕SE.(⍎⊃2⎕FIX'/StartupSession.aplf',⍨2⎕NQ#'GetEnvironment' 'DYALOG')
5+
⎕ML ⎕IO←1 0 ⍝ ⎕IO delana est
6+
⎕←⎕SE.UCMD 'ureset'
7+
⎕SE.UCMD 'UpdateTatin'
8+
⎕←'Updated'
9+
⎕off 0

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,9 @@ lib/
88
# Incomplete examples
99
examples/6_shaders
1010

11+
# build output directory
12+
out/
13+
Dist/
14+
1115
# vscode settings
1216
.vscode

README.md

8.39 KB

When making a script file like the raylib-apl's examples, I would recommend the .apls file extension and adding this line at the top of the script #!cd $dir && /usr/bin/dyalogscript $fileName. When running .apls files, remember to always be in their directory.

Using Tatin Package Manager

Tatin is a package manager for Dyalog APL.

  1. Install Tatin (if not already installed):

    ]Activate tatin
  2. Install raylib-apl:

    ]Tatin.InstallPackages raylibapl
  3. Use in your code:

    rl  raylibapl.raylib
    rl.Init raylibapl.TatinVars.HOME,'/link'

Using Link:

You may ]Link to the raylib-apl/link folder. This imports raylib.apln, rlgl.apln, and raymath.apln, each of which are from raylib. A 2d physics library called physac is also included as physac.apln, and a GUI library called raygui as raygui.apln.

apl-package.json

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
api: "",
3+
assets: "parse-raylib-apl",
4+
description: "raylib-apl is a library made to write cross-platform graphical applications using the Dyalog APL programming language",
5+
documentation: "https://github.com/Brian-ED/raylib-apl",
6+
files: "",
7+
group: "BrianED",
8+
io: 1,
9+
license: "MIT",
10+
lx: "",
11+
maintainer: "bed@dyalog.com",
12+
minimumAplVersion: "18.2",
13+
ml: 1,
14+
name: "raylibapl",
15+
os_lin: 1,
16+
os_mac: 1,
17+
os_win: 1,
18+
project_url: "https://github.com/Brian-ED/raylib-apl",
19+
source: "link",
20+
tags: "graphics,raylib",
21+
userCommandScript: "",
22+
version: "0.1.0+17",
23+
}

install-raylib.apls

Lines changed: 2 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,4 @@
11
#!cd $dir && /usr/bin/dyalogscript $fileName
22

3-
FullPath ← ∊1∘⎕NPARTS
4-
5-
Assert ← {⍺←'assertion failure' ⋄ 0∊⍵:⍺ ⎕SIGNAL 8 ⋄ shy←0}
6-
7-
PlatfromToLibFile ← {
8-
'Windows'≡⍵:'temp-c-raylib.dll'
9-
'Linux' ≡⍵:'libtemp-c-raylib.so'
10-
0 Assert⍨'Unknown platform (',⍵,')'
11-
}
12-
platform ← '-64'~⍨⊃#⎕WG'APLVersion'
13-
14-
version ← 'v4.0.0'
15-
libPath ← 'lib'
16-
⎕MkDir⍣(~⎕NExists libPath)⊢libPath
17-
fullLibFile ← FullPath libPath,'/',libFile←PlatfromToLibFile platform
18-
19-
git_clone_path ← 'https://www.github.com/Brian-ED/temp-c-raylib/releases/download/',version,'/',libFile
20-
21-
⍝ Expects library to not exist
22-
{
23-
~⎕NExists⍵:⍬
24-
txt←'raylib already installed. Delete it to re-install.',⎕UCS 10
25-
txt,←'rm ',⍵,⎕UCS 10
26-
txt Assert 0
27-
} fullLibFile
28-
29-
⍝ ---------------
30-
⍝ download raylib
31-
⍝ ---------------
32-
PlatformToInstallCmd ← {
33-
'Windows'≡⍵:'Powershell.exe -Command curl -o "',fullLibFile,'" ',git_clone_path ⍝ If errors: Curl was likely not found
34-
'Linux' ≡⍵:'curl -o "',fullLibFile,'" ',git_clone_path,' -L'
35-
0 Assert⍨'Unknown platform (',⍵,')'
36-
}
37-
38-
⎕CMD PlatformToInstallCmd platform
39-
40-
FileSize ← 2∘⎕NINFO
41-
'Downloading raylib failed from Github failed. Likely due to redirects not being followed.' Assert 0≢FileSize fullLibFile
42-
43-
⎕←'raylib installed successfully'
3+
2 ⎕FIX 'link/installraylib.aplf'
4+
installraylib 0

link/installraylib.aplf

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
∇ installraylib tatin;FullPath;Assert;PlatfromToLibFile;platform;version;libPath;fullLibFile;git_clone_path;PlatformToInstallCmd;FileSize
2+
FullPath ← ∊1∘⎕NPARTS
3+
4+
Assert ← {⍺←'assertion failure' ⋄ 0∊⍵:⍺ ⎕SIGNAL 8 ⋄ shy←0}
5+
6+
PlatfromToLibFile ← {
7+
'Windows'≡⍵:'temp-c-raylib.dll'
8+
'Linux' ≡⍵:'libtemp-c-raylib.so'
9+
'Mac' ≡⍵:'libtemp-c-raylib.dylib'
10+
0 Assert⍨'Unknown platform (',⍵,')'
11+
}
12+
platform ← '-64'~⍨⊃#⎕WG'APLVersion'
13+
14+
version ← 'v4.0.0'
15+
⍝ If Tatin, use TatinVars.HOME as prefix for library path
16+
:If tatin
17+
libPath ← FullPath TatinVars.HOME,'/lib'
18+
⍝libPath ← FullPath 'dependencies/TBD-raylibapl-0.1.0','/lib'
19+
:Else
20+
libPath ← 'lib'
21+
:EndIf
22+
⎕MkDir⍣(~⎕NExists libPath)⊢libPath
23+
fullLibFile ← FullPath libPath,'/',libFile←PlatfromToLibFile platform
24+
25+
git_clone_path ← 'https://www.github.com/Brian-ED/temp-c-raylib/releases/download/',version,'/',libFile
26+
27+
⍝ Expects library to not exist
28+
{
29+
~⎕NExists⍵:⍬
30+
txt←'raylib already installed. Delete it to re-install.',⎕UCS 10
31+
txt,←'rm ',⍵,⎕UCS 10
32+
txt Assert 0
33+
} fullLibFile
34+
35+
⍝ ---------------
36+
⍝ download raylib
37+
⍝ ---------------
38+
PlatformToInstallCmd ← {
39+
'Windows'≡⍵:'Powershell.exe -Command "Invoke-WebRequest -Uri ''',git_clone_path,''' -OutFile ''',fullLibFile,'''"' ⍝ If errors: Curl was likely not found
40+
'Linux' ≡⍵:'curl -o "',fullLibFile,'" ',git_clone_path,' -L'
41+
'Mac' ≡⍵:'curl -o "',fullLibFile,'" ',git_clone_path,' -L'
42+
0 Assert⍨'Unknown platform (',⍵,')'
43+
}
44+
45+
⎕CMD PlatformToInstallCmd platform
46+
47+
FileSize ← 2∘⎕NINFO
48+
'Downloading raylib failed from Github failed. Likely due to redirects not being followed.' Assert 0≢FileSize fullLibFile
49+
50+
⎕←'raylib installed successfully'
51+

0 commit comments

Comments
 (0)