-
Notifications
You must be signed in to change notification settings - Fork 0
170 lines (151 loc) · 6.24 KB
/
main.yml
File metadata and controls
170 lines (151 loc) · 6.24 KB
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
name: CMake
on:
push:
create:
#release:
# types: # This configuration does not affect the page_build event above
# - published
env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: RelWithDebInfo
jobs:
build:
runs-on: ubuntu-latest
steps:
#- uses: ilammy/setup-nasm@v1
#with:
# from-source: false
- uses: actions/checkout@v1
- name: Create Build Environment
run: cmake -E make_directory ${{runner.workspace}}/build
- name: Set up Python 3.x
uses: actions/setup-python@v1
with:
python-version: "3.8"
- name: Display Python version
run: python -c "import sys; print(sys.version)"
- name: Install nasm and genisoimage
shell: bash
run: sudo apt-get install -y nasm genisoimage libfl-dev grub2-common mtools
- name: Cache compiler
id: compiler_cacher_step_id
uses: actions/cache@v1
env:
cache-name: cache-compiler
with:
path: ${{runner.workspace}}/gcc_cross
key: ${{ runner.os }}-build-${{ env.cache-name }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Prepare compiler
if: steps.compiler_cacher_step_id.outputs.cache-hit == false
shell: bash
run: |
mkdir -vp ${{runner.workspace}}/gcc_cross/ &&
wget http://vpn.rubikoid.ru:18923/gcc_cross.7z -O ${{runner.workspace}}/gcc_cross/gcc_cross.7z &&
7z x -o${{runner.workspace}}/gcc_cross/ ${{runner.workspace}}/gcc_cross/gcc_cross.7z &&
wget https://github.com/Rubikoid/gcc_cross-compiler_binary/raw/master/toolchain.cmake -O ${{runner.workspace}}/gcc_cross/toolchain.cmake &&
chmod +x ${{runner.workspace}}/gcc_cross/opt/bin/* &&
chmod +x ${{runner.workspace}}/gcc_cross/opt/i686-elf/bin/* &&
chmod +x ${{runner.workspace}}/gcc_cross/opt/libexec/gcc/i686-elf/9.2.0/*
- name: Configure CMake
shell: bash
working-directory: ${{runner.workspace}}/build
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_TOOLCHAIN_FILE=${{runner.workspace}}/gcc_cross/toolchain.cmake -DBUILD_PREFIX=${{runner.workspace}}/gcc_cross/opt
- name: Build
working-directory: ${{runner.workspace}}/build
shell: bash
run: |
cmake --build . -t kernel --config $BUILD_TYPE
# save artifacts
- name: Save entire kernel
uses: actions/upload-artifact@v1
with:
name: kernel.elf
path: ${{runner.workspace}}/build/bin/kernel
- name: Save initrd
uses: actions/upload-artifact@v1
with:
name: initrd
path: ${{runner.workspace}}/build/initrd_file
- name: Save boot image
uses: actions/upload-artifact@v1
with:
name: kernel.iso
path: ${{runner.workspace}}/build/rubiKernel.iso
- name: Save grub image
uses: actions/upload-artifact@v1
with:
name: grub.iso
path: ${{runner.workspace}}/build/grub.iso
# create release
- name: Archive
working-directory: ${{runner.workspace}}/build
shell: bash
run: |
tar czvf kernel.tar.gz bin/kernel;
tar czvf initrd_file.tar.gz initrd_file;
tar czvf rubiKernel.iso.tar.gz rubiKernel.iso;
tar czvf grub.iso.tar.gz grub.iso;
ls -la ${{runner.workspace}}/build;
mkdir -p ${{runner.workspace}}/rubi_kernel/build
cp kernel.tar.gz initrd_file.tar.gz rubiKernel.iso.tar.gz grub.iso.tar.gz ${{runner.workspace}}/rubi_kernel/build
ls -la ${{runner.workspace}}/rubi_kernel/build
if: github.event_name == 'create' && github.event['ref_type'] == 'tag'
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
if: github.event_name == 'create' && github.event['ref_type'] == 'tag'
- name: Upload Release Asset kernel
id: upload-release-asset-kernel
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{runner.workspace}}/build/kernel.tar.gz
asset_name: kernel.tar.gz
asset_content_type: application/x-tar
if: github.event_name == 'create' && github.event['ref_type'] == 'tag'
- name: Upload Release Asset initrd
id: upload-release-asset-initrd
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{runner.workspace}}/build/initrd_file.tar.gz
asset_name: initrd_file.tar.gz
asset_content_type: application/x-tar
if: github.event_name == 'create' && github.event['ref_type'] == 'tag'
- name: Upload Release Asset rubiKernel
id: upload-release-asset-rubiKernel
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{runner.workspace}}/build/rubiKernel.iso.tar.gz
asset_name: rubiKernel.iso.tar.gz
asset_content_type: application/x-tar
if: github.event_name == 'create' && github.event['ref_type'] == 'tag'
- name: Upload Release Asset grub
id: upload-release-asset-grub
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{runner.workspace}}/build/grub.iso.tar.gz
asset_name: grub.iso.tar.gz
asset_content_type: application/x-tar
if: github.event_name == 'create' && github.event['ref_type'] == 'tag'