-
Notifications
You must be signed in to change notification settings - Fork 23
90 lines (74 loc) · 2.45 KB
/
ci-on-pull-requset.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
name: CI on Pull Request
on:
pull_request:
env:
IMAGE: rancher/system-agent-installer-rke2
jobs:
test-build-linux:
runs-on: ubuntu-latest
permissions:
contents: read
strategy:
matrix:
os: [ linux ]
arch: [ amd64, arm64 ]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Fix the not-a-git-repository issue
run: |
git config --global --add safe.directory "$GITHUB_WORKSPACE"
- name: Set environment variables
run: |
echo "ARCH=${{ matrix.arch }}" >> "$GITHUB_ENV"
echo "OS=${{ matrix.os }}" >> "$GITHUB_ENV"
- name: Download installer
run: scripts/download
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build Docker image
id: build
uses: docker/build-push-action@v5
with:
context: .
file: package/Dockerfile
push: false
load: true
tags: "${{ env.IMAGE }}:${{ env.VERSION }}-${{ env.OS }}-${{ env.ARCH }}"
platforms: "${{ env.OS }}/${{ env.ARCH }}"
- name: Inspect image
run: docker inspect "${{ env.IMAGE }}:${{ env.VERSION }}-${{ env.OS }}-${{ env.ARCH }}"
test_build-windows:
strategy:
matrix:
include:
- NANOSERVER_VERSION: 1809
TAG_SUFFIX: windows-1809-amd64
RUNNER: windows-2019
- NANOSERVER_VERSION: ltsc2022
TAG_SUFFIX: windows-ltsc2022-amd64
RUNNER: windows-2022
runs-on: ${{ matrix.RUNNER }}
permissions:
contents: read
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Fix the not-a-git-repository issue
run: |
git config --global --add safe.directory "$GITHUB_WORKSPACE"
- name: Set environment variables
run: |
"ARCH=amd64" | Out-File -FilePath $env:GITHUB_ENV -Append
- name: Download installer
run: scripts/windows/download.ps1
- name: Build Docker image
run: |
docker image build `
-f package/Dockerfile.windows `
--build-arg NANOSERVER_VERSION=${{ matrix.NANOSERVER_VERSION }} `
-t ${{ env.IMAGE }}:${{ env.VERSION }}-${{ matrix.TAG_SUFFIX }} .
- name: Inspect image
run: docker inspect ${{ env.IMAGE }}:${{ env.VERSION }}-${{ matrix.TAG_SUFFIX }}