Skip to content
This repository was archived by the owner on Dec 24, 2022. It is now read-only.

Commit abc8b9f

Browse files
committed
Add GitHub Actions workflow to auto-build TinyCore .tcz extensions
1 parent 8189f80 commit abc8b9f

File tree

5 files changed

+72
-24
lines changed

5 files changed

+72
-24
lines changed

.github/workflows/main.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Extensions
2+
3+
on: [push]
4+
5+
jobs:
6+
build:
7+
8+
runs-on: ubuntu-latest
9+
10+
strategy:
11+
matrix:
12+
extension: [ 'ifupdown', 'cloud-init-deps', 'cloud-init' ]
13+
tc_version: [ '10.0-x86_64' ]
14+
15+
container: tatsushid/tinycore:${{ matrix.tc_version }}
16+
17+
steps:
18+
- name: Checkout the repo
19+
uses: actions/checkout@v1
20+
21+
- name: Build the extension (${{ matrix.extension }})
22+
id: tcz
23+
run: |
24+
tce-load -wicl git compiletc coreutils
25+
cd ${GITHUB_WORKSPACE}/extensions/${{ matrix.extension }}
26+
make TC_VERSION=${{ matrix.tc_version }}
27+
28+
- uses: actions/upload-artifact@v1
29+
with:
30+
name: ${{ matrix.extension }}-tc${{ matrix.tc_version }}
31+
path: ${{ runner.temp }}/_github_home/artifacts/${{ matrix.extension }}-tc${{ matrix.tc_version }}

extensions/build.make

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,30 @@ CFLAGS = -mtune=generic -Os -pipe
44
CXXFLAGS = -mtune=generic -Os -pipe -fno-exceptions -fno-rtti
55
PKG_CONFIG_PATH = /usr/local/lib/pkgconfig:/usr/lib/pkgconfig
66

7-
.PHONY: deps tcz clean
7+
TC_VERSION ?= 9.0-x86_64
8+
artifact := $(HOME)/artifacts/$(package)-tc$(TC_VERSION)
9+
10+
.PHONY: deps tcz perms clean
811

912
deps:
10-
su - tc -c "tce-load -il $(compile_deps)"
13+
tce-load -wicl $(compile_deps)
1114

12-
tcz:
13-
cd /tmp && \
15+
perms:
16+
cd $(artifact) && \
1417
find $(package) -type d | xargs -r chmod -v 755 && \
1518
find $(package) | xargs file | grep ELF | cut -f 1 -d : | xargs -r chmod -v 755 && \
1619
find $(package) | xargs file | grep ELF | cut -f 1 -d : | xargs -r strip --strip-unneeded && \
17-
mksquashfs $(package) $(package).tcz -b 4096
20+
sudo chown -R 0:0 $(package)
21+
22+
tcz:
23+
$(MAKE) perms
24+
cd $(artifact) && \
25+
sudo mksquashfs $(package) $(package).tcz -b 4096 && \
26+
md5sum $(package).tcz > $(package).tcz.md5.txt && \
27+
sha256sum $(package).tcz > $(package).tcz.sha256.txt && \
28+
find $(package) -not -type d -printf '%P\n' | sort > $(package).tcz.list && \
29+
echo "Version: $(VERSION)" > $(package).tcz.info
30+
$(MAKE) clean
1831

1932
clean:
20-
rm -rf $(package) $(package_name) /tmp/$(package)
33+
sudo rm -rf $(package) $(package_name) $(artifact)/$(package)

extensions/cloud-init-deps/Makefile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,18 @@ package := cloud-init-deps
55
package_name := $(package)-$(VERSION).tar.gz
66
compile_deps := python3.6 squashfs-tools curl libffi
77

8-
.PHONY: all deps setup build tcz clean
8+
.PHONY: all deps setup build tcz
99

10-
all: deps setup build tcz clean
10+
all: deps setup build tcz
1111

1212
setup:
13-
rm -rf /tmp/$(package) /tmp/$(package).tcz
13+
rm -rf $(artifact)
1414
curl -L -o $(package_name) https://github.com/canonical/cloud-init/archive/$(VERSION).tar.gz
1515
tar -xzf $(package_name)
1616

1717
build:
1818
mv cloud-init-$(VERSION) $(package)
1919
cd $(package) && \
20-
pip3 install -r ./requirements.txt --root /tmp/$(package)
20+
pip3 install -r ./requirements.txt --root $(artifact)/$(package)
2121

2222
include ../build.make

extensions/cloud-init/Makefile

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,21 @@
33
VERSION ?= 19.3
44
package := cloud-init
55
package_name := $(package)-$(VERSION).tar.gz
6-
compile_deps := python3.6 squashfs-tools curl libffi cloud-init-deps
6+
compile_deps := python3.6 squashfs-tools curl libffi
77

8-
.PHONY: all deps setup build tcz clean
8+
.PHONY: all deps setup build tcz
99

10-
all: deps setup build tcz clean
10+
all: deps setup build tcz
1111

1212
setup:
13-
rm -rf /tmp/$(package) /tmp/$(package).tcz
13+
rm -rf $(artifact)
1414
curl -L -o $(package_name) https://github.com/canonical/cloud-init/archive/$(VERSION).tar.gz
1515
tar -xzf $(package_name)
1616

1717
build:
1818
cd $(package)-$(VERSION) && \
19-
pip3 install --root /tmp/$(package) .
19+
sudo pip3 install -r ./requirements.txt && \
20+
pip3 install --root $(artifact)/$(package) .
21+
cp -v $(package).tcz.dep $(artifact)
2022

2123
include ../build.make

extensions/ifupdown/Makefile

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,26 @@ package := ifupdown
55
package_name := $(package)_$(VERSION).tar.xz
66
compile_deps := perl5 squashfs-tools curl
77

8-
.PHONY: all deps setup build tcz clean
8+
.PHONY: all deps setup build tcz
99

10-
all: deps setup build tcz clean
10+
all: deps setup build tcz
1111

1212
setup:
13-
ln -sf /usr/local/bin/perl /usr/bin/perl
14-
rm -rf /tmp/$(package) /tmp/$(package).tcz
15-
cp -a dpkg-architecture /usr/local/bin
13+
sudo rm -rf $(artifact)
14+
sudo ln -sf /usr/local/bin/perl /usr/bin/perl
15+
sudo cp -a dpkg-architecture /usr/local/bin
1616
curl -L -o $(package_name) https://deb.debian.org/debian/pool/main/i/ifupdown/$(package_name)
1717
tar -xJf $(package_name)
1818

1919
build:
20+
mkdir -p $(artifact)
2021
cd ifupdown && \
2122
patch -p1 < ../ifupdown.patch && \
2223
$(MAKE) all && \
23-
$(MAKE) install DESTDIR=/tmp/$(package)
24-
mkdir -p /tmp/$(package)/sbin
25-
ln -sf /usr/local/sbin/ip /tmp/$(package)/sbin/ip
26-
rm -f /usr/local/bin/dpkg-architecture /usr/bin/perl
24+
$(MAKE) install DESTDIR=$(artifact)/$(package)
25+
cp -v $(package).tcz.dep $(artifact)
26+
mkdir -p $(artifact)/$(package)/sbin
27+
ln -sf /usr/local/sbin/ip $(artifact)/$(package)/sbin/ip
28+
sudo rm -f /usr/local/bin/dpkg-architecture /usr/bin/perl
2729

2830
include ../build.make

0 commit comments

Comments
 (0)