Skip to content

Commit 73cd63e

Browse files
Merge pull request #307 from ArangoGutierrez/githubactions
Add GitHub Actions
2 parents 03cbf9c + 6857f53 commit 73cd63e

File tree

9 files changed

+193
-196
lines changed

9 files changed

+193
-196
lines changed

.common-ci.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ default:
1919

2020
variables:
2121
GIT_SUBMODULE_STRATEGY: recursive
22-
BUILDIMAGE: "${CI_REGISTRY_IMAGE}/build:${CI_COMMIT_SHORT_SHA}"
2322
BUILD_MULTI_ARCH_IMAGES: "true"
2423

2524
stages:

.github/dependabot.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Please see the documentation for all configuration options:
2+
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
3+
4+
version: 2
5+
updates:
6+
- package-ecosystem: "gomod"
7+
target-branch: main
8+
directory: "/"
9+
schedule:
10+
interval: "weekly"
11+
day: "sunday"
12+
ignore:
13+
- dependency-name: k8s.io/*
14+
labels:
15+
- dependencies
16+
17+
- package-ecosystem: "github-actions"
18+
directory: "/"
19+
schedule:
20+
interval: "daily"

.github/workflows/blossom-ci.yml

Lines changed: 0 additions & 113 deletions
This file was deleted.

.github/workflows/golang.yaml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# Copyright 2024 NVIDIA CORPORATION
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
name: Golang
16+
17+
on:
18+
pull_request:
19+
branches:
20+
- main
21+
- release-*
22+
push:
23+
branches:
24+
- main
25+
- release-*
26+
27+
jobs:
28+
check:
29+
runs-on: ubuntu-latest
30+
steps:
31+
- uses: actions/checkout@v4
32+
33+
- name: Lint
34+
uses: golangci/golangci-lint-action@v3
35+
with:
36+
version: latest
37+
args: -v --timeout 5m
38+
skip-cache: true
39+
test:
40+
name: Unit test
41+
runs-on: ubuntu-latest
42+
steps:
43+
- name: Checkout code
44+
uses: actions/checkout@v4
45+
- name: Install Go
46+
uses: actions/setup-go@v5
47+
with:
48+
go-version: '1.20'
49+
- run: make test
50+
build:
51+
runs-on: ubuntu-latest
52+
steps:
53+
- uses: actions/checkout@v4
54+
55+
- name: Build
56+
run: make docker-build

.github/workflows/image.yaml

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
# Copyright 2024 NVIDIA CORPORATION
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
# Run this workflow on pull requests
16+
name: image
17+
18+
on:
19+
push:
20+
branches:
21+
- main
22+
- release-*
23+
24+
jobs:
25+
packages:
26+
runs-on: ubuntu-latest
27+
strategy:
28+
matrix:
29+
package:
30+
- ubuntu18.04-arm64
31+
- ubuntu18.04-amd64
32+
- ubuntu18.04-ppc64le
33+
- centos7-aarch64
34+
- centos7-x86_64
35+
- centos8-ppc64le
36+
fail-fast: false
37+
steps:
38+
- uses: actions/checkout@v4
39+
name: Check out code
40+
- name: Set up QEMU
41+
uses: docker/setup-qemu-action@v3
42+
- name: Set up Docker Buildx
43+
uses: docker/setup-buildx-action@v3
44+
- name: build ${{ matrix.package }} packages
45+
run: |
46+
sudo apt-get install -y coreutils build-essential sed git bash make
47+
echo "Building packages"
48+
./scripts/build-packages.sh ${{ matrix.package }}
49+
- name: 'Upload Artifacts'
50+
uses: actions/upload-artifact@v4
51+
with:
52+
compression-level: 0
53+
name: toolkit-container-${{ matrix.package }}-${{ github.run_id }}
54+
path: ${{ github.workspace }}/dist/*
55+
56+
image:
57+
runs-on: ubuntu-latest
58+
strategy:
59+
matrix:
60+
image: [ubuntu20.04, centos7, ubi8, packaging]
61+
needs: packages
62+
steps:
63+
- uses: actions/checkout@v4
64+
name: Check out code
65+
- name: Calculate build vars
66+
id: vars
67+
run: |
68+
echo "COMMIT_SHORT_SHA=${GITHUB_SHA:0:8}" >> $GITHUB_ENV
69+
echo "LOWERCASE_REPO_OWNER=$(echo "${GITHUB_REPOSITORY_OWNER}" | awk '{print tolower($0)}')" >> $GITHUB_ENV
70+
REPO_FULL_NAME="${{ github.event.pull_request.head.repo.full_name }}"
71+
echo "${REPO_FULL_NAME}"
72+
echo "LABEL_IMAGE_SOURCE=https://github.com/${REPO_FULL_NAME}" >> $GITHUB_ENV
73+
74+
GENERATE_ARTIFACTS="false"
75+
if [[ "${{ github.actor }}" == "dependabot[bot]" ]]; then
76+
GENERATE_ARTIFACTS="false"
77+
elif [[ "${{ github.event_name }}" == "pull_request" && "${{ github.event.pull_request.head.repo.full_name }}" == "${{ github.repository }}" ]]; then
78+
GENERATE_ARTIFACTS="true"
79+
elif [[ "${{ github.event_name }}" == "push" ]]; then
80+
GENERATE_ARTIFACTS="true"
81+
fi
82+
echo "PUSH_ON_BUILD=${GENERATE_ARTIFACTS}" >> $GITHUB_ENV
83+
echo "BUILD_MULTI_ARCH_IMAGES=${GENERATE_ARTIFACTS}" >> $GITHUB_ENV
84+
85+
- name: Set up QEMU
86+
uses: docker/setup-qemu-action@v3
87+
- name: Set up Docker Buildx
88+
uses: docker/setup-buildx-action@v3
89+
- name: Get built packages
90+
uses: actions/download-artifact@v4
91+
with:
92+
path: ${{ github.workspace }}/dist/
93+
pattern: toolkit-container-*
94+
merge-multiple: true
95+
96+
- name: Login to GitHub Container Registry
97+
uses: docker/login-action@v3
98+
with:
99+
registry: ghcr.io
100+
username: ${{ github.actor }}
101+
password: ${{ secrets.GITHUB_TOKEN }}
102+
- name: Build image
103+
env:
104+
IMAGE_NAME: ghcr.io/${LOWERCASE_REPO_OWNER}/container-toolkit
105+
VERSION: ${COMMIT_SHORT_SHA}
106+
run: |
107+
echo "${VERSION}"
108+
make -f build/container/Makefile build-${{ matrix.image }}

.github/workflows/pre-sanity.yml

Lines changed: 0 additions & 22 deletions
This file was deleted.

.gitlab-ci.yml

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -15,40 +15,6 @@
1515
include:
1616
- .common-ci.yml
1717

18-
build-dev-image:
19-
stage: image
20-
script:
21-
- apk --no-cache add make bash
22-
- make .build-image
23-
- docker login -u "${CI_REGISTRY_USER}" -p "${CI_REGISTRY_PASSWORD}" "${CI_REGISTRY}"
24-
- make .push-build-image
25-
26-
.requires-build-image:
27-
image: "${BUILDIMAGE}"
28-
needs:
29-
- job: build-dev-image
30-
31-
check:
32-
extends:
33-
- .requires-build-image
34-
stage: go-checks
35-
script:
36-
- make check
37-
38-
go-build:
39-
extends:
40-
- .requires-build-image
41-
stage: go-build
42-
script:
43-
- make build
44-
45-
unit-tests:
46-
extends:
47-
- .requires-build-image
48-
stage: unit-tests
49-
script:
50-
- make coverage
51-
5218
# Define the package build helpers
5319
.multi-arch-build:
5420
before_script:
@@ -288,4 +254,3 @@ test-docker-ubuntu20.04:
288254
- .dist-ubuntu20.04
289255
needs:
290256
- image-ubuntu20.04
291-

0 commit comments

Comments
 (0)