forked from andrewwutw/build-djgpp
-
Notifications
You must be signed in to change notification settings - Fork 9
139 lines (124 loc) · 4.7 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
name: Test builds
on:
push:
branches-ignore: djgpp-ppa
pull_request:
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest, macos-latest ]
build-type: [ clean ]
env:
-
TARGET: i386-pc-msdosdjgpp
PACKAGES: binutils gcc djgpp-2.05 watt32
-
TARGET: i386-pc-msdosdjgpp
PACKAGES: binutils gcc djgpp-cvs watt32
-
TARGET: i386-pc-msdosdjgpp
PACKAGES: gdb
-
TARGET: arm-eabi
PACKAGES: binutils gcc newlib
-
TARGET: arm-eabi
PACKAGES: gdb
-
TARGET: avr
PACKAGES: binutils gcc avr-libc
-
TARGET: avr
PACKAGES: gdb avarice simulavr avrdude
-
TARGET: ia16-elf
PACKAGES: binutils gcc newlib
steps:
- uses: actions/checkout@v3
- name: Clear brew package cache
if: contains(matrix.os, 'macos')
run: |
rm -rf $(brew --cache)
- name: Cache brew package cache
uses: jwt27/cache@dist
if: contains(matrix.os, 'macos')
with:
path: ~/Library/Caches/Homebrew
key: testbuild-brew-cache-${{ github.sha }}
restore-keys: |
testbuild-brew-cache-
- name: Install dependencies (ubuntu)
if: contains(matrix.os, 'ubuntu')
run: |
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install bison flex curl make texinfo zlib1g-dev tar bzip2 gzip xz-utils unzip dos2unix libtool-bin gcc-11 g++-11 cmake help2man python2-dev nasm libslang2-dev ccache
echo "CC=gcc-12" >> $GITHUB_ENV
echo "CXX=g++-12" >> $GITHUB_ENV
mkdir -p ~/.ccache
echo "CCACHE_DIR=~/.ccache" >> $GITHUB_ENV
echo "/usr/lib/ccache" >> $GITHUB_PATH
- name: Install dependencies (macos)
if: contains(matrix.os, 'macos')
run: |
brew update
brew install bash bison flex curl make texinfo zlib bzip2 gzip xz unzip dos2unix libtool cmake help2man nasm s-lang ccache
mkdir -p ~/.ccache
echo "CCACHE_DIR=~/.ccache" >> $GITHUB_ENV
echo "$(brew --prefix)/opt/ccache/libexec" >> $GITHUB_PATH
- name: Cache sources
uses: actions/cache@v3
with:
path: download
key: testbuild-sources-${{ matrix.os }}-${{ matrix.env.TARGET }}-${{ matrix.env.PACKAGES }}-${{ github.sha }}
restore-keys: |
testbuild-sources-${{ matrix.os }}-${{ matrix.env.TARGET }}-${{ matrix.env.PACKAGES }}-
- name: Cache ccache
uses: actions/cache@v3
with:
path: ~/.ccache
key: testbuild-ccache-${{ matrix.os }}-${{ matrix.env.TARGET }}-${{ matrix.env.PACKAGES }}-${{ github.sha }}
restore-keys: |
testbuild-ccache-${{ matrix.os }}-${{ matrix.env.TARGET }}-${{ matrix.env.PACKAGES }}-
- name: Download sources
env:
TARGET: ${{ matrix.env.TARGET }}
PACKAGES: ${{ matrix.env.PACKAGES }}
run: ./script/select-script.sh --only-download
- name: Cache build output
uses: actions/cache@v3
if: matrix.build-type == 'rebuild'
id: cache-build
with:
path: build
key: testbuild-build-${{ matrix.os }}-${{ matrix.env.TARGET }}-${{ matrix.env.PACKAGES }}-${{ github.sha }}
restore-keys: |
testbuild-build-${{ matrix.os }}-${{ matrix.env.TARGET }}-${{ matrix.env.PACKAGES }}-
- name: Clean build
if: matrix.build-type == 'clean'
env:
TARGET: ${{ matrix.env.TARGET }}
run: ./script/select-script.sh --no-download --prefix=${{ github.workspace }}-${{ github.sha }} ${{ matrix.env.PACKAGES }}
- name: Rebuild
if: matrix.build-type == 'rebuild'
env:
TARGET: ${{ matrix.env.TARGET }}
run: ./script/select-script.sh --no-download --prefix=${{ github.workspace }} ${{ matrix.env.PACKAGES }}
- name: Rebuild if uncached
if: matrix.build-type == 'rebuild' && steps.cache-build.outputs.cache-hit != 'true'
env:
TARGET: ${{ matrix.env.TARGET }}
run: ./script/select-script.sh --no-download --prefix=${{ github.workspace }} ${{ matrix.env.PACKAGES }}
- name: Clear and pack git sources before caching
if: matrix.build-type == 'clean'
run: |
find download/*/* ! -wholename '*/.git/*' -delete || true
cd download
for DIR in */; do
DIR=${DIR%/}
tar -c -f $DIR-git.tar $DIR
done
rm -rf */