Skip to content

Commit 0be9a28

Browse files
committed
Test github actions
1 parent 0490840 commit 0be9a28

File tree

2 files changed

+174
-171
lines changed

2 files changed

+174
-171
lines changed

.github/workflows/main.yml

Lines changed: 174 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,174 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
pull_request:
6+
workflow_dispatch:
7+
inputs:
8+
deploy:
9+
description: 'Do you want DEPLOYMENT as well?'
10+
required: false
11+
default: 'false'
12+
13+
14+
jobs:
15+
linux:
16+
name: Build and (optinally) deploy on Linux and Windows
17+
runs-on: ubuntu-24.04
18+
steps:
19+
- name: Checkout repository
20+
uses: actions/checkout@v4
21+
22+
- name: Current GIT repo in use
23+
run: bash build/show-git-info
24+
25+
- name: Set should-deploy flag
26+
id: set_deploy
27+
run: |
28+
should_deploy=false
29+
if [[ "${GITHUB_EVENT_NAME}" == "workflow_dispatch" && "${{ github.event.inputs.deploy }}" == "true" ]]; then
30+
should_deploy=true
31+
elif [[ "${GITHUB_EVENT_NAME}" != "pull_request" && "${{ github.event.head_commit.message }}" =~ \[DEPLOYMENT\] ]]; then
32+
should_deploy=true
33+
fi
34+
echo "should_deploy=$should_deploy" >> $GITHUB_ENV
35+
36+
- name: Show GITHUB_ENV file
37+
run: |
38+
ls -l $GITHUB_ENV || true
39+
cat $GITHUB_ENV || true
40+
41+
- name: Deployment request status
42+
if: env.should_deploy == 'true'
43+
run: echo "ENABLED (if you see this)"
44+
45+
- name: Install Ubuntu packages
46+
run: |
47+
sudo apt-get -y -yq update || true
48+
sudo apt-get -y -yq --no-install-suggests --no-install-recommends install alien bash binutils-mingw-w64-i686 binutils-mingw-w64-x86-64 bison build-essential bzip2 coreutils curl deborphan dpkg fakeroot file g++ gawk gcc gcc-mingw-w64-i686 gcc-mingw-w64-x86-64 git libc6-dev libc-bin libcurl4-openssl-dev libgtk-3-dev libreadline6-dev libsdl2-dev lsb-release make sed tar util-linux vim-common wget zip
49+
50+
- name: List of all installed packages
51+
run: dpkg -l | cat || true
52+
53+
- name: Show system status
54+
run: cat /etc/debian_version ; lsb_release -a ; yacc --version | head -n 1 ; gcc --version | head -n 1 ; g++ --version | head -n 1 ; make --version | head -n 1 ; git --version | head -n 1 ; gawk --version | head -n 1 ; bash --version | head -n 1 ; uname -a ; id -a ; echo "CWD is `pwd`" ; echo "PATH is $PATH" ; echo "Hostname is `hostname`" ; sudo lscpu || true ; uptime ; sudo /sbin/ip a || true ; df -h . ; ls -la .
55+
56+
- name: Show shell variables
57+
run: env || true
58+
59+
- name: Show native SDL2 status
60+
run: ls -l `which sdl2-config` || true ; sdl2-config --version --prefix --exec-prefix --cflags --libs --static-libs || true
61+
62+
- name: Configuring Xemu for Linux (native target)
63+
run: make RELEASE=yes config
64+
65+
- name: Building Xemu for Linux (native target)
66+
run: make -j 4 RELEASE=yes
67+
68+
- name: List of result binaries
69+
run: ls -l build/bin/*.native
70+
71+
- name: Installing Windows SDL2 cross-development components
72+
run: build/install-cross-win-mingw-sdl-on-linux.sh /usr/bin
73+
74+
- name: Show Windows SDL2 status
75+
run: echo "*** 64-bit Windows SDL2 status ***" ; ls -l `which x86_64-w64-mingw32-sdl2-config` || true ; x86_64-w64-mingw32-sdl2-config --version --prefix --exec-prefix --cflags --libs --static-libs || true ; echo "*** 32-bit Windows SDL2 status ***" ; ls -l `which i686-w64-mingw32-sdl2-config` || true ; i686-w64-mingw32-sdl2-config --version --prefix --exec-prefix --cflags --libs --static-libs || true
76+
77+
- name: Configuring Xemu for Windows (cross compilation, 64-bit target)
78+
run: make RELEASE=yes ARCH=win64 config
79+
80+
- name: Building Xemu for Windows (cross compilation, 64-bit target)
81+
run: make -j 4 RELEASE=yes ARCH=win64
82+
83+
- name: List of result binaries
84+
run: ls -l build/bin/*.win64
85+
86+
- name: Uptime so far
87+
run: uptime
88+
89+
- name: Conditional Deploy to Shared Repo (Linux)
90+
if: contains(github.event.head_commit.message, '[DEPLOYMENT]')
91+
run: |
92+
git config --global user.name "GitHub Actions"
93+
git config --global user.email "[email protected]"
94+
95+
# Clone shared deployment repo
96+
rm -rf /tmp/shared-deploy-repo
97+
git clone --depth 1 --branch main https://x-access-token:${{ secrets.DEPLOY_TOKEN }}@github.com/your-username/shared-deploy-repo.git /tmp/shared-deploy-repo
98+
99+
# Clear and replace linux folder
100+
rm -rf /tmp/shared-deploy-repo/linux
101+
mkdir -p /tmp/shared-deploy-repo/linux
102+
cp -r path/to/build/output/* /tmp/shared-deploy-repo/linux/
103+
104+
# Commit and push
105+
cd /tmp/shared-deploy-repo
106+
git add linux
107+
git commit -m "Linux deployment from $GITHUB_REPOSITORY ($GITHUB_SHA)"
108+
git push --force
109+
110+
macos:
111+
name: Build and (optinally) deploy on MacOS
112+
runs-on: macos-13
113+
steps:
114+
- name: Checkout repository
115+
uses: actions/checkout@v4
116+
117+
- name: Current GIT repo in use
118+
run: bash build/show-git-info
119+
120+
- name: Set should-deploy flag
121+
id: set_deploy
122+
run: |
123+
should_deploy=false
124+
if [[ "${GITHUB_EVENT_NAME}" == "workflow_dispatch" && "${{ github.event.inputs.deploy }}" == "true" ]]; then
125+
should_deploy=true
126+
elif [[ "${GITHUB_EVENT_NAME}" != "pull_request" && "${{ github.event.head_commit.message }}" =~ \[DEPLOYMENT\] ]]; then
127+
should_deploy=true
128+
fi
129+
echo "should_deploy=$should_deploy" >> $GITHUB_ENV
130+
131+
- name: Show GITHUB_ENV file
132+
run: |
133+
ls -l $GITHUB_ENV || true
134+
cat $GITHUB_ENV || true
135+
136+
- name: Deployment request status
137+
if: env.should_deploy == 'true'
138+
run: echo "ENABLED (if you see this)"
139+
140+
- name: Install build/deployment dependencies
141+
run: build/install-dependencies-osx.sh
142+
143+
- name: Configuring Xemu for Mac (native target)
144+
run: make RELEASE=yes config
145+
146+
- name: Building Xemu for Mac (native target)
147+
run: make -j 4 RELEASE=yes
148+
149+
- name: List of result binaries
150+
run: ls -l build/bin/*.native
151+
152+
- name: Uptime so far
153+
run: uptime
154+
155+
- name: Conditional Deploy to Shared Repo (macOS)
156+
if: contains(github.event.head_commit.message, '[DEPLOYMENT]')
157+
run: |
158+
git config --global user.name "GitHub Actions"
159+
git config --global user.email "[email protected]"
160+
161+
# Clone shared deployment repo
162+
rm -rf /tmp/shared-deploy-repo
163+
git clone --depth 1 --branch main https://x-access-token:${{ secrets.DEPLOY_TOKEN }}@github.com/your-username/shared-deploy-repo.git /tmp/shared-deploy-repo
164+
165+
# Clear and replace macos folder
166+
rm -rf /tmp/shared-deploy-repo/macos
167+
mkdir -p /tmp/shared-deploy-repo/macos
168+
cp -r path/to/build/output/* /tmp/shared-deploy-repo/macos/
169+
170+
# Commit and push
171+
cd /tmp/shared-deploy-repo
172+
git add macos
173+
git commit -m "macOS deployment from $GITHUB_REPOSITORY ($GITHUB_SHA)"
174+
git push --force

.travis.yml

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

0 commit comments

Comments
 (0)