-
Notifications
You must be signed in to change notification settings - Fork 3
140 lines (118 loc) · 4.49 KB
/
docker.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
name: Docker image
on:
push: { branches: [ develop ], tags: [ "*" ], paths: [ ".kraken.*", "Dockerfile", ".github/workflows/*.yml", "src/*", "formulae/*" ] }
pull_request: { branches: [ develop ] }
env:
COLUMNS: 160
jobs:
test-formulae:
runs-on: "arc-${{ matrix.arch }}-small"
strategy:
fail-fast: false
matrix:
arch: ["amd64", "arm64"]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Test Formulae
run: |
set -e
status_code=0
for formula in formulae/*.py; do
echo " :::: TEST FORMULA $formula"
if ! python3 src/main.py $formula -o install_to=bin; then
status_code=1
fi
done
exit $status_code
build:
runs-on: "arc-${{ matrix.arch }}-large"
needs: [ test-formulae ]
strategy:
fail-fast: false
matrix:
arch: ["amd64", "arm64"]
base_image: [ "ubuntu_22.04", "ubuntu_20.04" ]
steps:
# NOTE (@NiklasRosenstein): Need Git 2.18 available on the runner for the checkout action to use it; otherwise
# it falls back to the REST API and Git operations afterwards will fail because no repository is present.
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/setup-python@v5
if: "${{ matrix.arch == 'amd64' }}"
with:
python-version: "3.10"
- name: Create Python 3 virtualenv (arm64)
if: "${{ matrix.arch == 'arm64' }}"
run: python3.10 -m venv .venv
- name: Activate Python 3 virtualenv (arm64)
if: "${{ matrix.arch == 'arm64' }}"
run: source .venv/bin/activate && env >> $GITHUB_ENV
- name: Install kraken-wrapper
run: pip install --upgrade kraken-wrapper
# See https://github.com/orgs/community/discussions/42856#discussioncomment-7678867
- name: Adding required env vars for caching Docker build
uses: actions/github-script@v7
env:
github-token: ${{ secrets.GITHUB_TOKEN }}
with:
script: |
core.exportVariable('ACTIONS_CACHE_URL', process.env['ACTIONS_CACHE_URL'])
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env['ACTIONS_RUNTIME_TOKEN'])
# core.exportVariable('ACTIONS_RUNTIME_URL', process.env['ACTIONS_RUNTIME_URL'])
- run: |
krakenw r -s -v
krakenw q d --resume :docker-kraken-image/${{ matrix.base_image }}/linux/${{ matrix.arch }} -v
krakenw r --resume :docker-kraken-image/${{ matrix.base_image }}/linux/${{ matrix.arch }} -v --state-name "${{ matrix.base_image }}-${{ matrix.arch }}"
env:
GITHUB_USER: ${{ github.actor }}
GITHUB_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/upload-artifact@v3
with:
name: kraken-build-state
path: build/.kraken/buildenv/state*.dill
manifest-tool:
runs-on: "arc-amd64-small"
needs: [ build ]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/download-artifact@v3
with:
name: kraken-build-state
path: build/.kraken/buildenv/
- run: ls -la build/.kraken/buildenv/
- uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install kraken-wrapper
run: pip install kraken-wrapper
- name: Install manifest-tool
run: |
wget -q https://github.com/estesp/manifest-tool/releases/download/v2.0.5/binaries-manifest-tool-2.0.5.tar.gz
tar xvf binaries-manifest-tool-2.0.5.tar.gz manifest-tool-linux-amd64
mkdir -p ~/.local/bin/
mv manifest-tool-linux-amd64 ~/.local/bin/manifest-tool
chmod +x ~/.local/bin/manifest-tool
- run: |
export PATH="$PATH:$HOME/.local/bin"
krakenw q tree -v --all --resume :docker-kraken-image-multiarch
krakenw r --resume :docker-kraken-image-multiarch -v
env:
GITHUB_USER: ${{ github.actor }}
GITHUB_PASSWORD: ${{ secrets.GITHUB_TOKEN }}