First cut at CI workflows (#6)
Co-authored-by: Shrukan <shrukan@shrukanslab.xyz> Reviewed-on: sl-devs/CppTemplate#6
This commit is contained in:
55
.gitea/workflows/build_and_test.yml
Normal file
55
.gitea/workflows/build_and_test.yml
Normal file
@ -0,0 +1,55 @@
|
||||
name: Build and Test Code
|
||||
run-name: ${{ gitea.ref }} Build
|
||||
on:
|
||||
push:
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
container: gitea.shrukanslab.xyz/CppTemplate/dev-environment:latest
|
||||
steps:
|
||||
- name: Check out repository code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Unit test
|
||||
run: just test
|
||||
|
||||
coverage:
|
||||
runs-on: ubuntu-latest
|
||||
container: gitea.shrukanslab.xyz/CppTemplate/dev-environment:latest
|
||||
steps:
|
||||
- name: Check out repository code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Coverage
|
||||
run: just coverage
|
||||
|
||||
- name: Compress coverage report
|
||||
run: tar -czf build/coverage.tar.gz build/meson-logs/coveragereport
|
||||
|
||||
- name: Archive coverage report
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: docs
|
||||
path: build/coverage.tar.gz
|
||||
retention-days: 5
|
||||
|
||||
static_analysis:
|
||||
runs-on: ubuntu-latest
|
||||
container: gitea.shrukanslab.xyz/CppTemplate/dev-environment:latest
|
||||
steps:
|
||||
- name: Check out repository code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Static analysis
|
||||
run: just check
|
||||
|
||||
sanitize:
|
||||
runs-on: ubuntu-latest
|
||||
container: gitea.shrukanslab.xyz/CppTemplate/dev-environment:latest
|
||||
steps:
|
||||
- name: Check out repository code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Sanitize
|
||||
run: just sanitize
|
||||
25
.gitea/workflows/build_docs.yml
Normal file
25
.gitea/workflows/build_docs.yml
Normal file
@ -0,0 +1,25 @@
|
||||
name: Build Docs
|
||||
run-name: ${{ gitea.ref }} Build
|
||||
on:
|
||||
push:
|
||||
|
||||
jobs:
|
||||
build-docs:
|
||||
runs-on: ubuntu-latest
|
||||
container: gitea.shrukanslab.xyz/CppTemplate/dev-environment:latest
|
||||
steps:
|
||||
- name: Check out repository code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Build docs
|
||||
run: just docs
|
||||
|
||||
- name: Compress docs
|
||||
run: tar -czf build/docs.tar.gz build/docs
|
||||
|
||||
- name: Archive docs
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: docs
|
||||
path: build/docs.tar.gz
|
||||
retention-days: 5
|
||||
36
.gitea/workflows/build_image.yml
Normal file
36
.gitea/workflows/build_image.yml
Normal file
@ -0,0 +1,36 @@
|
||||
name: Build Image
|
||||
run-name: ${{ gitea.ref }} Build
|
||||
on:
|
||||
push:
|
||||
|
||||
jobs:
|
||||
build-dev-image:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out repository code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Install Docker
|
||||
run: curl -fsSL https://get.docker.com | sh
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
|
||||
- name: Log into Gitea
|
||||
uses: docker/login-action@v1
|
||||
with:
|
||||
registry: gitea.shrukanslab.xyz
|
||||
username: ${{ secrets.ROBOT_USERNAME }}
|
||||
password: ${{ secrets.ROBOT_PASSWORD }}
|
||||
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v4
|
||||
with:
|
||||
context: .
|
||||
platforms: linux/amd64
|
||||
push: true
|
||||
tags: |
|
||||
gitea.shrukanslab.xyz/CppTemplate/dev-environment:latest
|
||||
|
||||
- name: Logout from Docker Registry
|
||||
run: docker logout gitea.shrukanslab.xyz
|
||||
@ -1,100 +0,0 @@
|
||||
resources:
|
||||
- name: build-image
|
||||
type: registry-image
|
||||
icon: docker
|
||||
source:
|
||||
repository: gitea.shrukanslab.xyz/sl-devs/meson-build
|
||||
|
||||
- name: cpp-src
|
||||
type: git
|
||||
icon: git
|
||||
source:
|
||||
uri: ((git-repo-url))
|
||||
branch: main
|
||||
username: ((gitea.username))
|
||||
password: ((gitea.password))
|
||||
|
||||
- name: dev-image
|
||||
type: registry-image
|
||||
icon: docker
|
||||
source:
|
||||
repository: gitea.shrukanslab.xyz/sl-devs/((image-name))
|
||||
tag: latest
|
||||
username: ((gitea.username))
|
||||
password: ((gitea.password))
|
||||
|
||||
jobs:
|
||||
- name: unit
|
||||
plan:
|
||||
- in_parallel:
|
||||
- get: build-image
|
||||
- get: cpp-src
|
||||
trigger: true
|
||||
- task: run-test
|
||||
image: build-image
|
||||
config:
|
||||
platform: linux
|
||||
inputs:
|
||||
- name: cpp-src
|
||||
path: "./"
|
||||
run:
|
||||
path: make
|
||||
args: ["test"]
|
||||
|
||||
- name: coverage
|
||||
plan:
|
||||
- in_parallel:
|
||||
- get: build-image
|
||||
- get: cpp-src
|
||||
trigger: true
|
||||
- task: run-test
|
||||
image: build-image
|
||||
config:
|
||||
platform: linux
|
||||
inputs:
|
||||
- name: cpp-src
|
||||
path: "./"
|
||||
run:
|
||||
path: make
|
||||
args: ["coverage"]
|
||||
|
||||
- name: docs
|
||||
plan:
|
||||
- in_parallel:
|
||||
- get: build-image
|
||||
- get: cpp-src
|
||||
trigger: true
|
||||
- task: run-test
|
||||
image: build-image
|
||||
config:
|
||||
platform: linux
|
||||
inputs:
|
||||
- name: cpp-src
|
||||
path: "./"
|
||||
run:
|
||||
path: make
|
||||
args: ["configure", "docs/html"]
|
||||
|
||||
- name: build-image
|
||||
plan:
|
||||
- get: cpp-src
|
||||
- task: build-image
|
||||
privileged: true # oci-build-task must run in a privileged container
|
||||
config:
|
||||
platform: linux
|
||||
image_resource:
|
||||
type: registry-image
|
||||
source:
|
||||
repository: concourse/oci-build-task
|
||||
inputs:
|
||||
- name: cpp-src
|
||||
outputs:
|
||||
- name: image
|
||||
params:
|
||||
CONTEXT: cpp-src
|
||||
run:
|
||||
path: build
|
||||
|
||||
- put: dev-image
|
||||
params:
|
||||
image: image/image.tar
|
||||
Reference in New Issue
Block a user