-
Notifications
You must be signed in to change notification settings - Fork 0
205 lines (173 loc) · 6.72 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
name: build
# Controls when the action will run.
on:
# Triggers the workflow on push event only for all branches
push:
branches: [ main, master, develop ]
#pull_request:
# branches: [ main, master ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
# This workflow contains a single job called "build"
setup-sdk:
runs-on: ubuntu-22.04
steps:
- name: Cache sdk
id: cache-sdk
uses: actions/cache@v2
with:
path: |
cc65/**/*
orix-sdk/**/*
md2hlp/**/*
orix-software/**/*
oricutron/**/*
key: ${{ secrets.CACHE_ID }}-orix-sdk_
- name: Checkout cc65
if: steps.cache-sdk.outputs.cache-hit != 'true'
uses: actions/checkout@v2
with:
repository: cc65/cc65
path: cc65
- name: Checkout orix-sdk
if: steps.cache-sdk.outputs.cache-hit != 'true'
uses: actions/checkout@v2
with:
repository: assinie/orix-sdk
path: orix-sdk
- name: Checkout md2hlp
if: steps.cache-sdk.outputs.cache-hit != 'true'
uses: actions/checkout@v2
with:
repository: assinie/md2hlp
path: md2hlp
- name: Compilation CC65
if: steps.cache-sdk.outputs.cache-hit != 'true'
run: make -C cc65 >/dev/null
- name: Prepare environment for orix-sdk
if: steps.cache-sdk.outputs.cache-hit != 'true'
run: |
git clone --no-checkout --depth 1 --single-branch --branch master https://github.com/orix-software/shell orix-software/shell
cd orix-software/shell
git config --local core.sparseCheckout true
echo "src/include" >> .git/info/sparse-checkout
git checkout
cd ../..
# git clone --no-checkout --depth 1 --single-branch --branch master https://github.com/orix-software/kernel orix-software/kernel
# cd orix-software/kernel
# git config --local core.sparseCheckout true
# echo "src/include" >> .git/info/sparse-checkout
# git checkout
- name: Prepare environment for oricutron
if: steps.cache-sdk.outputs.cache-hit != 'true'
run: |
sudo apt-get install -y xvfb libgtk-3-0 libgtk-3-dev libsdl1.2debian libsdl1.2-dev
git clone https://github.com/pete-gordon/oricutron.git
cd oricutron && make && pwd && cd .. && ls -l && echo ${GITHUB_WORKSPACE}
echo Timeout oricutron : $secret.TMOUT_ORICUTRON
# - name: Compile orix-sdk
# if: steps.cache-sdk.outputs.cache-hit != 'true'
# working-directory: orix-sdk
# run: mkdir -p build/{lib,bin} && CC65_HOME=${GITHUB_WORKSPACE}/cc65 make lib
- name: Display tools
run: |
PATH=$PATH:${GITHUB_WORKSPACE}/cc65/bin
cc65 -V
ls -l ${GITHUB_WORKSPACE}
ls -lR orix-sdk
ls -l cc65/bin
pwd
build:
# The type of runner that the job will run on
needs: setup-sdk
runs-on: ubuntu-22.04
outputs:
version: ${{ steps.job_vars.outputs.VERSION }}
repo_name: ${{ steps.job_vars.outputs.REPO_NAME }}
steps:
- uses: actions/checkout@v2
with:
ssh-key: ${{ secrets.SSH_PRIVATE_KEY }}
- name: Set job variables
id: job_vars
run: |
echo "::set-output name=VERSION::$(cat VERSION)"
echo "::set-output name=REPO_NAME::${GITHUB_REPOSITORY##*/}"
- name: Install sdk
uses: actions/cache@v2
with:
path: |
cc65/**/*
orix-sdk/**/*
md2hlp/**/*
orix-software/**/*
oricutron/**/*
key: ${{ secrets.CACHE_ID }}-orix-sdk_
- name: Prepare environment for project
run: |
ls -l && ls -l ../
mv cc65 ../ && mv orix-software ../ && mv orix-sdk ../ && mv md2hlp ../
- name: Compile project
run: CC65_HOME=${GITHUB_WORKSPACE}/../cc65 make
- name: List build directory content
run: ls -lR build
- name: Unit-test with oricutron
run: |
git clone https://github.com/orix-software/docker-unit-test.git
cd docker-unit-test && bash install.sh ${GITHUB_WORKSPACE} && cd ..
cp build/usr/share/kernel/kernelsd.rom ${GITHUB_WORKSPACE}/oricutron/roms/kernel.rom
cat tests/unit_test/xopen.sub > ${GITHUB_WORKSPACE}/oricutron/sdcard/ETC/AUTOBOOT
cat tests/unit_test/xrm.sub >> ${GITHUB_WORKSPACE}/oricutron/sdcard/ETC/AUTOBOOT
cd ${GITHUB_WORKSPACE}/oricutron
timeout --preserve-status 5 ./xvfb.sh || exit 0
- name: Check unit-test
run: |
ls -l ${GITHUB_WORKSPACE}/oricutron/sdcard/
bash tests/unit_test/verify.sh ${GITHUB_WORKSPACE}/oricutron/sdcard/
- name: Upload Artifact
uses: actions/upload-artifact@v2
with:
name: ${{ steps.job_vars.outputs.REPO_NAME }}
path: |
build/**/*
!build/obj/*
- name: Post compilation
run: |
mv ../cc65 . && mv ../orix-software . && mv ../orix-sdk . && mv ../md2hlp .
ls -l
upload:
needs: build
runs-on: ubuntu-22.04
defaults:
run:
shell: bash
env:
hash: ${{ secrets.HASH }}
version: ${{ needs.build.outputs.version }}
repo_name: ${{ needs.build.outputs.repo_name }}
steps:
- name: Get branch name
if: github.event_name != 'pull_request'
run: echo "BRANCH_NAME=${GITHUB_REF##*/}" >> $GITHUB_ENV
# run: echo "::set-env name=BRANCH_NAME::$(echo ${GITHUB_REF##*/})"
- name: Get branch name on pull request
if: github.event_name == 'pull_request'
run: echo "BRANCH_NAME=${GITHUB_HEAD_REF}" >> GITHUB_ENV
#run: echo "::set-env name=BRANCH_NAME::$(echo ${GITHUB_HEAD_REF})"
- name: Get archive name
run: echo "ARCHIVE_NAME=${repo_name}.tgz" >> $GITHUB_ENV
# On pourrait faire l'extraction directement à la racine si VERSION est dans l'artifact
- name: Download Artifact
id: download
uses: actions/download-artifact@v2
with:
name: ${{ needs.build.outputs.repo_name }}
path: artifact
- name: Make archive
working-directory: ${{steps.download.outputs.download-path}}
run: tar -zcvf $GITHUB_WORKSPACE/$ARCHIVE_NAME *
- name: Upload to oric
run: |
if [ "$BRANCH_NAME" = "master" -o "$BRANCH_NAME" = "main" ]; then VERSION="$version"; else VERSION=alpha ; fi
curl -X POST --data-binary "@${ARCHIVE_NAME}" "https://cdn.oric.org/publish.php?hash=$hash&path=/home/oricoujr/www/ftp/orix/dists/$VERSION/tgz/6502/${ARCHIVE_NAME}"