Skip to content

Commit feb9051

Browse files
committed
add AndroidStudio + DBeaver, remove Google Chrome
1 parent 64882ef commit feb9051

13 files changed

+266
-91
lines changed
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
name: "build and release"
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- "main"
8+
schedule:
9+
- cron: "00 01 * * *"
10+
workflow_dispatch:
11+
12+
jobs:
13+
build:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v4
18+
with:
19+
fetch-depth: 0
20+
- name: Create cache folder
21+
run: |
22+
sudo mkdir --parents /media/saved-cache
23+
sudo chown -R "$(whoami)" /media/saved-cache
24+
- name: Get cache
25+
uses: actions/cache/restore@v4
26+
with:
27+
path: /media/saved-cache
28+
key: docker-development-desktop-build-cache-${{ github.run_id }}
29+
restore-keys: docker-development-desktop-build-cache
30+
- name: Import cache
31+
run: |
32+
if (ls /media/saved-cache/*.tar.zst); then
33+
docker run --pull always --rm \
34+
--volume "/media/saved-cache:/media/saved-cache" \
35+
--volume "docker-development-desktop-build-cache:/media/build-cache" \
36+
--workdir /media \
37+
madebytimo/scripts \
38+
compress.sh --decompress /media/saved-cache/*.tar.zst
39+
rm /media/saved-cache/*.tar.zst
40+
fi
41+
- name: Set secrets and variables
42+
run: |
43+
mkdir data-local
44+
echo "latest_version=$(git describe --tags --abbrev=0)" >> "$GITHUB_ENV"
45+
echo "version=$(cat Version.txt)" >> "$GITHUB_ENV"
46+
if [[ -n '${{ secrets.UNITY_LICENSE_FILE }}' ]]; then
47+
echo '${{ secrets.UNITY_LICENSE_FILE }}' > data-local/unity-license.ulf
48+
fi
49+
if [[ -n '${{ secrets.DOCKER_REGISTRY_USERNAME }}' ]]; then
50+
echo ${{ secrets.DOCKER_REGISTRY_PASSWORD }} | \
51+
docker login --username ${{ secrets.DOCKER_REGISTRY_USERNAME }} \
52+
--password-stdin ${{ secrets.DOCKER_REGISTRY_URL }}
53+
fi
54+
- name: Prepare environment
55+
run: |
56+
if [[ -f builder/docker.sh ]]; then
57+
docker buildx create --use
58+
fi
59+
- name: Build
60+
if: ${{ github.event_name != 'schedule'}}
61+
run: |
62+
if [[ ${{ github.ref }} == 'refs/heads/main' ]]; then
63+
builder/build.sh --publish
64+
else
65+
builder/build.sh
66+
fi
67+
- name: Build update base
68+
if: ${{ github.event_name == 'schedule'}}
69+
run: builder/build.sh --publish --update-base
70+
- name: Upload
71+
uses: actions/upload-artifact@v4
72+
with:
73+
name: ${{ env.version }}
74+
path: builds/*
75+
- name: Release
76+
if: ${{ github.ref == 'refs/heads/main' && env.latest_version != env.version }}
77+
uses: softprops/action-gh-release@v2
78+
with:
79+
files: builds/*
80+
tag_name: ${{ env.version }}
81+
- name: Export cache
82+
run: |
83+
docker run --pull always --rm \
84+
--volume "/media/saved-cache:/media/saved-cache" \
85+
--volume "docker-development-desktop-build-cache:/media/build-cache" \
86+
madebytimo/scripts \
87+
compress.sh --fast --output /media/saved-cache/build-cache /media/build-cache
88+
sudo chown -R "$(whoami)" /media/saved-cache
89+
- name: Delete old caches
90+
env:
91+
GH_TOKEN: ${{ github.token }}
92+
run: |
93+
for CACHE in $(gh cache list --key Factory-build-cache --ref ${{ github.ref}} \
94+
| cut --fields 1); do
95+
echo "Deleting cache \"$CACHE\"."
96+
gh cache delete "$CACHE"
97+
done
98+
- name: Set cache
99+
uses: actions/cache/save@v4
100+
with:
101+
path: /media/saved-cache
102+
key: docker-development-desktop-build-cache-${{ github.run_id }}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: "Check version increment"
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
8+
jobs:
9+
check:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout new
13+
uses: actions/checkout@v4
14+
with:
15+
path: new
16+
- name: Checkout old
17+
uses: actions/checkout@v4
18+
with:
19+
path: old
20+
ref: refs/heads/main
21+
- name: Setup Node.js
22+
uses: actions/setup-node@v4
23+
- name: Download script
24+
run: |
25+
curl --silent --output check-version-increment.sh \
26+
https://gitlab.com/madebyTimo/scripts-development/-/raw/main/scripts/\
27+
check-version-increment.sh \
28+
&& chmod +x check-version-increment.sh
29+
- name: Test version increment
30+
run: |
31+
BRANCH="${GITHUB_HEAD_REF#/ref/head}"
32+
echo "Branch to check: $BRANCH"
33+
if [[ "$BRANCH" == @(feature|bugfix)/* ]]; then
34+
./check-version-increment.sh --file --new new/Version.txt \
35+
--old old/Version.txt
36+
else
37+
[[ $(cat new/Version.txt) == $(cat old/Version.txt) ]]
38+
fi

.github/workflows/docker-build-and-push.yaml

Lines changed: 0 additions & 23 deletions
This file was deleted.

.github/workflows/docker-update-base-and-push.yaml

Lines changed: 0 additions & 20 deletions
This file was deleted.
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: 'Static code analysis'
2+
3+
on:
4+
push:
5+
workflow_dispatch:
6+
7+
jobs:
8+
analyze:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Get cache
12+
uses: actions/cache/restore@v4
13+
with:
14+
path: /media/saved-cache
15+
key: docker-development-desktop-build-cache-${{ github.run_id }}
16+
restore-keys: docker-development-desktop-build-cache
17+
- name: Import cache
18+
run: |
19+
if (ls /media/saved-cache/*.tar.zst); then
20+
docker run --pull always --rm \
21+
--volume "/media/saved-cache:/media/saved-cache" \
22+
--volume "docker-development-desktop-build-cache:/media/build-cache" \
23+
--workdir /media \
24+
madebytimo/scripts \
25+
compress.sh --decompress /media/saved-cache/*.tar.zst
26+
rm /media/saved-cache/*.tar.zst
27+
fi
28+
- name: Checkout
29+
uses: actions/checkout@v4
30+
- name: Download script
31+
run: |
32+
curl --silent --output /usr/local/bin/static-code-analysis.sh \
33+
https://gitlab.com/madebyTimo/scripts-development/-/raw/main/scripts/\
34+
static-code-analysis.sh \
35+
&& chmod +x /usr/local/bin/static-code-analysis.sh
36+
- name: Analyze
37+
run: static-code-analysis.sh
38+
env:
39+
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
40+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
41+
- name: Publish result
42+
if: success() || failure()
43+
run: cat test-results/*.txt >> $GITHUB_STEP_SUMMARY
44+
- name: Export cache
45+
run: |
46+
docker run --pull always --rm \
47+
--volume "/media/saved-cache:/media/saved-cache" \
48+
--volume "docker-development-desktop-build-cache:/media/build-cache" \
49+
madebytimo/scripts \
50+
compress.sh --fast --output /media/saved-cache/build-cache /media/build-cache
51+
sudo chown -R "$(whoami)" /media/saved-cache
52+
- name: Delete old caches
53+
env:
54+
GH_TOKEN: ${{ github.token }}
55+
run: |
56+
for CACHE in $(gh cache list --key Factory-build-cache --ref ${{ github.ref}} \
57+
| cut --fields 1); do
58+
echo "Deleting cache \"$CACHE\"."
59+
gh cache delete "$CACHE"
60+
done
61+
- name: Set cache
62+
uses: actions/cache/save@v4
63+
with:
64+
path: /media/saved-cache
65+
key: docker-development-desktop-build-cache-${{ github.run_id }}

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# folders
22
.idea
3+
.temp*
34
.vscode
45
builds
56
data-local
@@ -10,3 +11,6 @@ test-results
1011
# files
1112
.iml
1213
package-lock.json
14+
15+
# exclude
16+
!.vscode/launch.json

Dockerfile

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
FROM madebytimo/development
22

3-
RUN install-autonomous.sh install Chromium DesktopBasics Firefox GoogleChrome IntellijIdea \
4-
ScriptsDesktop UnityHub VSCode \
5-
&& apt update -qq && apt install -y -qq cinnamon dbus dbus-x11 x11vnc xserver-xorg-video-dummy \
6-
&& rm -rf /var/lib/apt/lists/*
7-
83
COPY files/locale.gen /etc/locale.gen
94
COPY --from=madebytimo/development-desktop:v0.0.1-base-2023-07-11 /opt/meshinstall.sh \
105
/opt/meshinstall.sh
116

12-
RUN locale-gen \
7+
RUN apt update -qq && apt install -y -qq cinnamon dbus dbus-x11 xserver-xorg-video-dummy \
8+
&& install-autonomous.sh install AndroidStudio Chromium DBeaver DesktopBasics Firefox \
9+
IntellijIdea ScriptsDesktop UnityHub VncServer VSCode \
10+
&& rm -rf /var/lib/apt/lists/* \
11+
\
12+
&& locale-gen \
1313
&& chmod +x /opt/meshinstall.sh \
1414
&& usermod --append --groups audio,video,plugdev,netdev,bluetooth,lp,scanner user \
1515
&& echo "X11Forwarding yes" >> /etc/ssh/sshd_config \
@@ -18,8 +18,6 @@ RUN locale-gen \
1818
COPY files/xorg-dummy.conf /app/templates/xorg-dummy.conf
1919
COPY --chown=user files/autostart /media/user/.config/autostart
2020

21-
COPY files/start-desktop.sh /opt/start-desktop.sh
22-
2321
ENV DBUS_SESSION_BUS_ADDRESS="unix:path=/run/user/bus"
2422
ENV DISPLAY_RESOLUTION="1280x720"
2523
ENV DISPLAY=":0"
@@ -29,7 +27,7 @@ ENV MESHCENTRAL_GROUP_ID=""
2927
ENV USER_PASSWORD=""
3028

3129
RUN mv /entrypoint.sh /entrypoint-development.sh
32-
COPY entrypoint.sh /entrypoint.sh
30+
COPY files/entrypoint.sh files/start-desktop.sh /usr/local/bin/
3331

34-
ENTRYPOINT [ "/entrypoint.sh" ]
35-
CMD [ "/opt/start-desktop.sh" ]
32+
ENTRYPOINT [ "entrypoint.sh" ]
33+
CMD [ "start-desktop.sh" ]

Version.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v0.0.1
1+
v0.1.0

builder/build.sh

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/usr/bin/env bash
2+
set -e
3+
4+
SCRIPT_DIR="$(dirname "$(realpath "$0")")"
5+
6+
# help message
7+
for ARGUMENT in "$@"; do
8+
if [ "$ARGUMENT" == "-h" ] || [ "$ARGUMENT" == "--help" ]; then
9+
echo "usage: $(basename "$0")"
10+
echo "Run all scripts in the same folder."
11+
echo "All arguments are passed to the build scripts."
12+
exit
13+
fi
14+
done
15+
16+
mapfile -t BUILD_SCRIPTS -d '' < <(find "$SCRIPT_DIR" -name '*.sh' -not -name "$(basename "$0")")
17+
for BUILD_SCRIPT in "${BUILD_SCRIPTS[@]}"; do
18+
echo "Start \"$(basename "${BUILD_SCRIPT}")\""
19+
"$BUILD_SCRIPT" "$@"
20+
echo "Finished \"$(basename "${BUILD_SCRIPT}")\""
21+
done

0 commit comments

Comments
 (0)