-
Notifications
You must be signed in to change notification settings - Fork 2
131 lines (110 loc) · 3.62 KB
/
container-image.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
name: Create and publish a container image
on:
push:
branches:
- "main"
tags:
- "v*"
pull_request:
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build-and-push-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
with:
config-inline: |
[worker.oci]
max-parallelism = 2
- name: Log in to the container registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Set SOURCE_SHA_SHORT variable
run: echo "SOURCE_SHA_SHORT=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
- name: Build and push Docker image
uses: docker/build-push-action@v3
with:
context: .
push: true
build-args: |
SOURCE_GIT_BRANCH=${{ github.ref_name }}
SOURCE_GIT_REV_SHORT=${{ env.SOURCE_SHA_SHORT }}
secrets: |
NODE_AUTH_TOKEN=${{ secrets.GITHUB_TOKEN }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64,linux/arm64
e2e-test:
needs: build-and-push-image
runs-on: ubuntu-latest
permissions:
contents: read
packages: read
env:
HOST: localhost
PORT: "3000"
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Node
uses: actions/setup-node@v3
with:
node-version: 14.15.5
cache: yarn
registry-url: 'https://npm.pkg.github.com'
scope: '@credativ'
- name: Install dependencies
run: yarn install --pure-lockfile --no-progress --network-concurrency 1
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Install cypress
run: node_modules/cypress/bin/cypress install
- name: Log in to the container registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Start server
run: >
docker run --detach
-p 3000:3000
-e PL_SECURITY_ADMIN_USER=admin -e PL_SECURITY_ADMIN_PASSWORD=admin
-v $(pwd)/devenv/datasources.yaml:/etc/plutono/provisioning/datasources/datasources.yaml:ro
-v $(pwd)/devenv/dashboards.yaml:/etc/plutono/provisioning/dashboards/dashboards.yaml:ro
-v $(pwd)/devenv:/usr/share/plutono/devenv:ro
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.meta.outputs.version }}
- name: Wait for server
run: e2e/wait-for-plutono
- name: Run E2E test
run: e2e/run-suite
- name: Upload E2E test recordings
uses: actions/upload-artifact@v3
with:
name: e2e-test-recordings
path: e2e/suite1/videos
retention-days: 1
if: success() || failure()