forked from NicolasT/static-container-registry
-
Notifications
You must be signed in to change notification settings - Fork 0
101 lines (84 loc) · 3.05 KB
/
actions.yaml
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
name: static-container-registry
on: push
env:
DOCKER_IMAGE: ghcr.io/${{ github.repository }}
jobs:
pylint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: "3.10"
#TODO: add annotations
#- uses: cclauss/[email protected]
- name: Install dependencies
run: |
pip install pylint
- name: Analysing the code with pylint
run: |
pylint `ls -R|grep .py$|xargs`
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildk
uses: docker/setup-buildx-action@v3
- name: Login to Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ github.token }}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: "${{ env.DOCKER_IMAGE }}:${{ github.sha }}"
cache-from: type=gha
cache-to: type=gha,mode=max
test:
needs: build
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: |
OS=xUbuntu_20.04
CRIO_VERSION=1.21
KUBIC_REPO=https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable
sudo tee /etc/apt/sources.list.d/kubic-libcontainers.list <<< "deb $KUBIC_REPO/$OS/ /"
sudo tee -a /etc/apt/sources.list.d/kubic-libcontainers.list <<< "deb $KUBIC_REPO:/cri-o:/$CRIO_VERSION/$OS/ /"
curl -L $KUBIC_REPO/$OS/Release.key | sudo apt-key add -
curl -L $KUBIC_REPO:/cri-o:/$CRIO_VERSION/$OS/Release.key | sudo apt-key add -
sudo apt-get update
sudo apt-get -y install cri-o cri-o-runc cri-tools hardlink
# Fix libpcre2-posix2 package version, use the
sudo apt-get -y install --reinstall --allow-downgrades libpcre2-posix2/$(lsb_release -cs)
# Also need skopeo ; but it is already installed
bash <(curl -s https://raw.githubusercontent.com/pgrange/bash_unit/master/install.sh)
# Start cri-o service
sudo systemctl start crio
# TODO: cache the installed image?
- name: Downgrade Oras to 0.12.0
run: |
curl -LO https://github.com/oras-project/oras/releases/download/v${ORAS_VERSION}/oras_${ORAS_VERSION}_linux_amd64.tar.gz
tar -zxf oras_${ORAS_VERSION}_*.tar.gz -C /usr/local/bin/
rm -rf oras_${ORAS_VERSION}_*.tar.gz
env:
ORAS_VERSION: 0.12.0
- name: Unit testing with bash_unit
run: |
containerd --version || true
ctr --version || true
sudo ctr plugin ls
sudo cat /etc/containerd/config.toml
sleep 5
sudo ctr plugin ls
export IMAGE="${{ env.DOCKER_IMAGE }}:${{ github.sha }}"
sudo FORCE_COLOR=true ./bash_unit test.sh
# TODO: parse individual tests results (in TAP format)
# - uses: dorny/test-reporter@v1
# if: success() || failure()