Skip to content

Commit a53f8ba

Browse files
authored
Merge pull request #17 from elfiesmelfie/gha/build_containers
Create a basic GHA job to replace travis
2 parents 3b13ddc + ba81149 commit a53f8ba

File tree

5 files changed

+133
-18
lines changed

5 files changed

+133
-18
lines changed

.github/workflows/daily-jobs.yml

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Daily container builds
2+
3+
on:
4+
# These push/pr options will be removed one they are proven to work (one PR/push ought to do it)
5+
pull_request:
6+
branches: main
7+
push:
8+
branches: main
9+
schedule:
10+
- cron: '0 0 * * *'
11+
12+
jobs:
13+
build:
14+
15+
runs-on: ubuntu-latest
16+
17+
strategy:
18+
# Don't stop other in-progress jobs when one fails
19+
fail-fast: false
20+
21+
matrix:
22+
branch:
23+
- sid_amd64
24+
- fedora_rawhide_x86_64
25+
26+
env:
27+
SLUG: "collectd/ci:${{ matrix.branch }}"
28+
29+
steps:
30+
- uses: actions/checkout@v2
31+
with:
32+
ref: ${{ matrix.branch }}
33+
- name: Build container
34+
run:
35+
docker build --pull -t "${SLUG}" .
36+
- run: docker inspect "${SLUG}"
37+
- run: docker history "${SLUG}"
38+
- name: Log into the container registry
39+
uses: docker/login-action@v1
40+
with:
41+
username: ${{ secrets.DOCKER_USERNAME }}
42+
password: ${{ secrets.DOCKER_PASSWORD }}
43+
- run: docker push "${SLUG}"

.github/workflows/docker-image.yml

-18
This file was deleted.

.github/workflows/merge-jobs.yml

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Merge jobs
2+
3+
on:
4+
push:
5+
branches-ignore:
6+
- main
7+
# topic branches (e.g. fix/something)
8+
- '**/**'
9+
10+
jobs:
11+
build_and_publish_container:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Get branch name
15+
run: |
16+
export BRANCH="$(${{ github.ref }} | rev | cut -d '/' -f1 | rev )
17+
- run:
18+
export SLUG="collectd/ci:${BRANCH}"
19+
- run: |
20+
echo "Eventually, this will build ${SLUG}, on merge to ${BRANCH}"

.github/workflows/pr-jobs.yml

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: PR jobs
2+
3+
on:
4+
pull_request:
5+
branches-ignore:
6+
- main
7+
8+
jobs:
9+
# Build and test container for each PR submitted to that branch
10+
build_and_test_container:
11+
12+
runs-on: ubuntu-latest
13+
env:
14+
SLUG: "collectd/ci:test"
15+
steps:
16+
- run: echo "Eventually, this will build and test the container for each PR"

.github/workflows/weekly-jobs.yml

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Weekly container builds
2+
3+
on:
4+
# These push/pr options will be removed one they are proven to work (one PR/push ought to do it)
5+
pull_request:
6+
branches: main
7+
push:
8+
branches: main
9+
schedule:
10+
- cron: '0 0 * * 0'
11+
12+
jobs:
13+
build:
14+
15+
runs-on: ubuntu-latest
16+
17+
strategy:
18+
# Don't stop other in-progress jobs when one fails
19+
fail-fast: false
20+
matrix:
21+
branch:
22+
# Debian
23+
# Debian 10
24+
- buster_amd64
25+
# Debian 9
26+
- stretch_amd64
27+
# Debian 8
28+
- jessie_amd64
29+
# Ubuntu
30+
# Ubuntu 16.04
31+
- xenial_amd64
32+
# Ubuntu 14.04
33+
- trusty_amd64
34+
# CentOS
35+
- el7_x86_64
36+
37+
env:
38+
SLUG: "collectd/ci:${{ matrix.branch }}"
39+
40+
steps:
41+
- uses: actions/checkout@v2
42+
with:
43+
ref: ${{ matrix.branch }}
44+
- name: Build container
45+
run:
46+
docker build --pull -t "${SLUG}" .
47+
- run: docker inspect "${SLUG}"
48+
- run: docker history "${SLUG}"
49+
- name: Log into the container registry
50+
uses: docker/login-action@v1
51+
with:
52+
username: ${{ secrets.DOCKER_USERNAME }}
53+
password: ${{ secrets.DOCKER_PASSWORD }}
54+
- run: docker push "${SLUG}"

0 commit comments

Comments
 (0)