-
Notifications
You must be signed in to change notification settings - Fork 164
98 lines (93 loc) · 3.11 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
name: Build docker CI images
on:
- workflow_dispatch
# Environment variables
env:
DOCKER_REPO: ${{ secrets.DOCKER_REPO }}
REPO_OWNER: ${{ github.repository_owner }}
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
change_detect:
name: "Detect code changes"
runs-on: ubuntu-22.04
outputs:
docker_repo: ${{ steps.changes.outputs.docker_repo }}
steps:
- name: Check for source code changes
id: changes
run: |
if [[ -n "${DOCKER_REPO}" ]]; then
echo "name=docker_repo::$REPO_OWNER"
echo "::set-output name=docker_repo::$REPO_OWNER"
else
echo "name=docker_repo::lnis-uofu"
echo "::set-output name=docker_repo::lnis-uofu"
fi
base_images:
name: Push Docker images
needs: [change_detect]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ needs.change_detect.outputs.docker_repo }}
password: ${{ secrets.CR_PAT }}
- name: Build base
uses: docker/build-push-action@v2
with:
context: .
file: ./docker/Dockerfile.base
push: ${{ (env.DOCKER_REPO) && (github.ref == 'refs/heads/master')}}
tags: ghcr.io/${{ needs.change_detect.outputs.docker_repo }}/openfpga-build-base:latest
- name: Build environment image
uses: docker/build-push-action@v2
with:
context: .
file: ./docker/Dockerfile.env
push: ${{ (env.DOCKER_REPO) && (github.ref == 'refs/heads/master')}}
tags: ghcr.io/${{ needs.change_detect.outputs.docker_repo }}/openfpga-env:latest
compiler_images:
name: Build ${{ matrix.compiler }} compiler image
needs: [base_images, change_detect]
runs-on: ubuntu-latest
strategy:
matrix:
compiler:
- gcc-9
- gcc-10
- gcc-11
- gcc-12
- clang-11
- clang-12
- clang-13
- clang-14
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ needs.change_detect.outputs.docker_repo }}
password: ${{ secrets.CR_PAT }}
- name: Build ${{ matrix.compiler }} image
uses: docker/build-push-action@v2
with:
context: .
file: ./docker/Dockerfile.${{ matrix.compiler }}
push: ${{ (env.DOCKER_REPO) && (github.ref == 'refs/heads/master')}}
tags: ghcr.io/${{ needs.change_detect.outputs.docker_repo }}/openfpga-build-${{ matrix.compiler }}:latest