Skip to content

Commit beb2003

Browse files
committed
move commands to script
1 parent d011579 commit beb2003

File tree

2 files changed

+61
-45
lines changed

2 files changed

+61
-45
lines changed

.github/workflows/build.yml

Lines changed: 26 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -9,71 +9,52 @@ jobs:
99
steps:
1010
- uses: actions/checkout@v4
1111
- name: Install build dependencies
12-
run: sudo apt install mkdocs python3-pip libtinfo5
13-
- name: Acquire sources
12+
run: sudo apt install mkdocs python3-pip libtinfo5 fish
13+
- name: Prepare build
1414
run: |
1515
curl https://hg.sr.ht/~duangle/majoreo/raw/eo | python3 - init majoreo
1616
hg clone https://hg.sr.ht/~duangle/scopes/
17-
- id: build-default
18-
name: Build (default)
17+
- id: build
18+
name: Build
1919
working-directory: ./scopes
2020
run: |
21-
hg checkout default
22-
ARTIFACT_NAME="scopes-unstable-linux-$(date "+%Y-%m-%d")-$(hg identify --template '{id|short}')-default"
23-
echo "artifact-name-default=$ARTIFACT_NAME" >> $GITHUB_OUTPUT
24-
# patch genie recipe
25-
cp -f ../workarounds/genie.eo ./external/recipes/genie.eo
26-
yes | ./build.sh --silent-progress
27-
tar -czf $ARTIFACT_NAME.tar.gz --exclude "bin/eo" bin/ doc/ include/ lib/ testing/ CREDITS.md LICENSE.md
21+
fish ../build.fish linux
2822
- name: Artifact (default)
2923
uses: actions/upload-artifact@v4
3024
with:
31-
name: ${{ steps.build-default.outputs.artifact-name-default }}
32-
path: scopes/${{ steps.build-default.outputs.artifact-name-default }}.tar.gz
33-
- id: build-based
34-
name: Build (based)
35-
working-directory: ./scopes
36-
run:
37-
|
38-
hg checkout based
39-
ARTIFACT_NAME="scopes-unstable-linux-$(date "+%Y-%m-%d")-$(hg identify --template '{id|short}')-based"
40-
echo "artifact-name-based=$ARTIFACT_NAME" >> $GITHUB_OUTPUT
41-
# patch genie recipe
42-
cp -f ../workarounds/genie.eo ./external/recipes/genie.eo
43-
yes | ./build.sh --silent-progress
44-
rm ./bin/eo
45-
tar -czf $ARTIFACT_NAME.tar.gz --exclude "bin/eo" bin/ doc/ include/ lib/ testing/ CREDITS.md LICENSE.md
25+
name: ${{ steps.build.outputs.artifact-name-default }}
26+
path: scopes/${{ steps.build.outputs.artifact-name-default }}.tar.gz
4627
- name: Artifact (based)
4728
uses: actions/upload-artifact@v4
4829
with:
49-
name: ${{ steps.build-based.outputs.artifact-name-based }}
50-
path: scopes/${{ steps.build-based.outputs.artifact-name-based }}.tar.gz
30+
name: ${{ steps.build.outputs.artifact-name-based }}
31+
path: scopes/${{ steps.build.outputs.artifact-name-based }}.tar.gz
5132
windows:
5233
runs-on: windows-latest
5334
defaults:
5435
run:
5536
shell: msys2 {0}
5637
steps:
38+
- uses: actions/checkout@v4
5739
- uses: msys2/setup-msys2@v2
5840
- name: Install build dependencies
59-
run: pacman -S --noconfirm make mingw64/mingw-w64-x86_64-python mingw64/mingw-w64-x86_64-python-pip zip unzip mingw64/mingw-w64-x86_64-gcc mingw64/mingw-w64-x86_64-libxml2
60-
- id: build-default
61-
name: Build
41+
run: pacman -S --noconfirm make mingw64/mingw-w64-x86_64-python mingw64/mingw-w64-x86_64-python-pip zip unzip mingw64/mingw-w64-x86_64-gcc mingw64/mingw-w64-x86_64-libxml2 fish mercurial
42+
- name: Prepare build
6243
run: |
63-
ARTIFACT_NAME="scopes-unstable-windows-$(date "+%Y-%m-%d")-default"
64-
echo "artifact-name-default=$ARTIFACT_NAME" >> $GITHUB_OUTPUT
65-
wget "https://hg.sr.ht/~duangle/majoreo/raw/eo" -O ./eo
66-
chmod +x ./eo
67-
./eo init
68-
./eo import scopes
69-
./eo install -y scopes-source-unstable
70-
./build_mingw.sh --silent-progress
71-
- name: Cleanup
44+
curl https://hg.sr.ht/~duangle/majoreo/raw/eo | python3 - init majoreo
45+
hg clone https://hg.sr.ht/~duangle/scopes/
46+
- id: build
47+
name: Build
48+
working-directory: ./scopes
7249
run: |
73-
rm -f ./bin/eo ./bin/genie.exe
74-
- run: zip -r ${{ steps.build-default.outputs.artifact-name-default }}.zip bin/ doc/ include/ lib/ testing/ CREDITS.md LICENSE.md
75-
- name: Distribution Artifact
50+
fish ../build.fish windows
51+
- name: Artifact (default)
52+
uses: actions/upload-artifact@v4
53+
with:
54+
name: ${{ steps.build.outputs.artifact-name-default }}
55+
path: scopes/${{ steps.build.outputs.artifact-name-default }}.zip
56+
- name: Artifact (based)
7657
uses: actions/upload-artifact@v4
7758
with:
78-
name: ${{ steps.build-default.outputs.artifact-name-default }}
79-
path: ${{ steps.build-default.outputs.artifact-name-default }}.zip
59+
name: ${{ steps.build.outputs.artifact-name-based }}
60+
path: scopes/${{ steps.build.outputs.artifact-name-based }}.zip

build.fish

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/usr/bin/env fish
2+
3+
set os_name $argv[1]
4+
set build_script build.sh
5+
if test $os_name = "windows"
6+
set build_script build_mingw.sh
7+
end
8+
9+
function package_linux -a name
10+
tar -czf "$name.tar.gz" --exclude "bin/eo" bin/ doc/ include/ lib/ testing/ CREDITS.md LICENSE.md
11+
end
12+
13+
function package_windows -a name
14+
zip -r "$name.zip" bin/ doc/ include/ lib/ testing/ CREDITS.md LICENSE.md -x "./bin/eo" "./bin/genie.exe"
15+
end
16+
17+
function artifact -a branch
18+
set -l revision (hg identify --template '{id|short}')
19+
set artifact_name "scopes-unstable-$os_name-(date '+%Y-%m-%d')-$revision-$branch"
20+
echo "artifact-name-$branch=$artifact_name" >> $GITHUB_OUTPUT
21+
22+
hg checkout $branch
23+
# patch genie recipe
24+
cp -f ../workarounds/genie.eo ./external/recipes/genie.eo
25+
yes | ./$build_script --silent-progress
26+
27+
if test $os_name = "windows"
28+
package_windows $artifact_name
29+
else
30+
package_linux $artifact_name
31+
end
32+
end
33+
34+
artifact default
35+
artifact based

0 commit comments

Comments
 (0)