-
Notifications
You must be signed in to change notification settings - Fork 0
62 lines (55 loc) · 2.09 KB
/
pipeline.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
name: Build, Test, and Release
on:
push:
branches:
- main
pull_request:
merge_group:
env:
REGISTRY_USER: ${{ github.actor }}
REGISTRY_PASSWORD: ${{ github.token }}
IMAGE_REGISTRY: ghcr.io/${{ github.repository }}
TEST_IMAGE: ghcr.io/${{ github.repository }}:${{ github.sha }}
jobs:
build-and-test:
runs-on: ubuntu-latest
steps:
- name: Clone repository
uses: actions/checkout@v4
- name: Configure
run: |
sudo apt update
sudo apt install -y fuse-overlayfs podman containernetworking-plugins containers-storage
sudo cp /usr/share/containers/storage.conf /etc/containers/storage.conf
sudo sed -i 's/#mount_program/mount_program/' /etc/containers/storage.conf
sudo podman system reset --force
sudo mkdir -p /etc/systemd/system/[email protected]/
sudo touch /etc/systemd/system/[email protected]/delegate.conf
echo [Service] | sudo tee -a /etc/systemd/system/[email protected]/delegate.conf
echo Delegate=yes | sudo tee -a /etc/systemd/system/[email protected]/delegate.conf
sudo systemctl daemon-reload
- name: Build Image
run: podman build --format docker -f image/Containerfile -t ${{ env.TEST_IMAGE }} ./image
- name: Execute Tests
run: >
podman run --rm
-v $(pwd)/test:/test
--privileged
--security-opt="label=disable" ${{ env.TEST_IMAGE }}
/bin/sh -c "/usr/bin/kind create cluster -v 2147483647 --config ./test/kind-in-podman.yaml --wait 60s
&& kubectl get no -o wide
&& kubectl get ns
&& cd ./test && go test . -v"
release:
runs-on: ubuntu-latest
needs: build-and-test
if: ${{ always() && format('refs/heads/{0}', github.event.repository.default_branch) == github.ref }}
steps:
- name: Log in to ghcr.io
uses: redhat-actions/podman-login@v1
with:
username: ${{ env.REGISTRY_USER }}
password: ${{ env.REGISTRY_PASSWORD }}
registry: ${{ env.IMAGE_REGISTRY }}
- name: Push image
run: podman push ${{ env.TEST_IMAGE }} docker://${{ env.IMAGE_REGISTRY }}:latest