Skip to content

Commit

Permalink
Added C support to the CI build.
Browse files Browse the repository at this point in the history
  • Loading branch information
adamshapiro0 committed Nov 22, 2020
1 parent e72becb commit d7f6b04
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 9 deletions.
50 changes: 41 additions & 9 deletions .github/workflows/release_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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 }}
Expand All @@ -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
4 changes: 4 additions & 0 deletions c/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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) $^

Expand Down

0 comments on commit d7f6b04

Please sign in to comment.