From 3e0867c59352f1f36c92266bca0526d92a85f014 Mon Sep 17 00:00:00 2001 From: Shrukan Date: Sat, 17 Feb 2024 15:30:44 -0700 Subject: [PATCH] First cut at CI workflows --- .gitea/workflows/build_and_test.yml | 55 +++++++++++++++ .gitea/workflows/build_docs.yml | 25 +++++++ .gitea/workflows/build_image.yml | 36 ++++++++++ ci/build-and-test.yml | 100 ---------------------------- 4 files changed, 116 insertions(+), 100 deletions(-) create mode 100644 .gitea/workflows/build_and_test.yml create mode 100644 .gitea/workflows/build_docs.yml create mode 100644 .gitea/workflows/build_image.yml delete mode 100644 ci/build-and-test.yml diff --git a/.gitea/workflows/build_and_test.yml b/.gitea/workflows/build_and_test.yml new file mode 100644 index 0000000..e59e07b --- /dev/null +++ b/.gitea/workflows/build_and_test.yml @@ -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 diff --git a/.gitea/workflows/build_docs.yml b/.gitea/workflows/build_docs.yml new file mode 100644 index 0000000..7c779ae --- /dev/null +++ b/.gitea/workflows/build_docs.yml @@ -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 diff --git a/.gitea/workflows/build_image.yml b/.gitea/workflows/build_image.yml new file mode 100644 index 0000000..a6fbc2b --- /dev/null +++ b/.gitea/workflows/build_image.yml @@ -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 diff --git a/ci/build-and-test.yml b/ci/build-and-test.yml deleted file mode 100644 index 85df50a..0000000 --- a/ci/build-and-test.yml +++ /dev/null @@ -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 \ No newline at end of file