From d7f6b045fadcb5bfea3aec265c11da221293d6b0 Mon Sep 17 00:00:00 2001 From: Adam Shapiro Date: Sun, 22 Nov 2020 13:10:51 -0500 Subject: [PATCH] Added C support to the CI build. --- .github/workflows/release_build.yml | 50 +++++++++++++++++++++++------ c/Makefile | 4 +++ 2 files changed, 45 insertions(+), 9 deletions(-) diff --git a/.github/workflows/release_build.yml b/.github/workflows/release_build.yml index a941da6..b1a6520 100644 --- a/.github/workflows/release_build.yml +++ b/.github/workflows/release_build.yml @@ -11,9 +11,9 @@ on: - 'v*' jobs: - # Build the example applications. - build: - name: Build Applications + # Build the C++ example applications. + build_cpp: + name: Build C++ Applications runs-on: ubuntu-latest strategy: matrix: @@ -45,13 +45,41 @@ jobs: uses: actions/upload-artifact@v1 with: path: polaris_examples.tar.gz - name: polaris_examples.${{ matrix.arch }} + name: polaris_examples.cpp.${{ matrix.arch }} + + # Build the C example applications. + build_c: + name: Build C Applications + runs-on: ubuntu-latest + strategy: + matrix: + arch: [x64] + steps: + - uses: actions/checkout@v2 + + - name: Build (native x64) + if: matrix.arch == 'x64' + run: | + cd c/ + make + + - name: Create artifact + run: | + cd c/ + make print_applications | + xargs tar czfv polaris_examples.tar.gz --transform 's|^|polaris/c/|' + + - name: Upload artifact + uses: actions/upload-artifact@v1 + with: + path: c/polaris_examples.tar.gz + name: polaris_examples.c.${{ matrix.arch }} # Create a release only on a tag (not on a branch push). release: name: Create Release if: startsWith(github.ref, 'refs/tags/') - needs: [build] + needs: [build_cpp, build_c] runs-on: ubuntu-latest outputs: upload_url: ${{ steps.create_release.outputs.upload_url }} @@ -73,25 +101,29 @@ jobs: runs-on: ubuntu-latest strategy: matrix: + lang: [cpp, c] arch: [x64, armv7hf, aarch64] + exclude: + - {lang: c, arch: armv7hf} + - {lang: c, arch: aarch64} steps: - name: Download artifact uses: actions/download-artifact@v1 with: - name: polaris_examples.${{ matrix.arch }} + name: polaris_examples.${{ matrix.lang }}.${{ matrix.arch }} - name: Set asset filename id: release_info env: TAG_REF_NAME: ${{ github.ref }} run: | - # polaris_examples-v1.0.0.aarch64.tar.gz - echo ::set-output name=file_name::polaris_examples-${TAG_REF_NAME##*/v}.${{ matrix.arch }}.tar.gz + # polaris_examples-v1.0.0.cpp.aarch64.tar.gz + echo ::set-output name=file_name::polaris_examples-${TAG_REF_NAME##*/v}.${{ matrix.lang }}.${{ matrix.arch }}.tar.gz - name: Upload release asset uses: actions/upload-release-asset@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: upload_url: ${{ needs.release.outputs.upload_url }} - asset_path: polaris_examples.${{ matrix.arch }}/polaris_examples.tar.gz + asset_path: polaris_examples.${{ matrix.lang }}.${{ matrix.arch }}/polaris_examples.tar.gz asset_name: ${{ steps.release_info.outputs.file_name }} asset_content_type: application/tar+gzip diff --git a/c/Makefile b/c/Makefile index 0045133..f2710b8 100644 --- a/c/Makefile +++ b/c/Makefile @@ -18,6 +18,10 @@ clean: rm -f $(OBJECTS) rm -f $(APPLICATIONS) +.PHONY: print_applications +print_applications: + @echo $(APPLICATIONS) + examples/%: examples/%.c $(OBJECTS) gcc -o $@ -I$(SRC_DIR) $(CFLAGS) $^