Skip to content

Commit 0c72722

Browse files
Add GitHub Actions
1 parent b63e23d commit 0c72722

File tree

4 files changed

+123
-0
lines changed

4 files changed

+123
-0
lines changed
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Build
2+
3+
on: [push, pull_request]
4+
5+
env:
6+
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
7+
BUILD_TYPE: Debug
8+
9+
jobs:
10+
build:
11+
# The CMake configure and build commands are platform agnostic and should work equally
12+
# well on Windows or Mac. You can convert this to a matrix build if you need
13+
# cross-platform coverage.
14+
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
15+
runs-on: ${{matrix.os}}
16+
strategy:
17+
matrix:
18+
os: [ubuntu-latest, macos-latest]
19+
20+
steps:
21+
- uses: actions/checkout@v2
22+
23+
- name: Create Build Environment
24+
# Some projects don't allow in-source building, so create a separate build directory
25+
# We'll use this as our working directory for all subsequent commands
26+
run: cmake -E make_directory ${{github.workspace}}/build
27+
28+
- name: Configure CMake
29+
# Use a bash shell so we can use the same syntax for environment variable
30+
# access regardless of the host operating system
31+
shell: bash
32+
working-directory: ${{github.workspace}}/build
33+
# Note the current convention is to use the -S and -B options here to specify source
34+
# and build directories, but this is only available with CMake 3.13 and higher.
35+
# The CMake binaries on the Github Actions machines are (as of this writing) 3.12
36+
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE
37+
38+
- name: Build
39+
working-directory: ${{github.workspace}}/build
40+
shell: bash
41+
# Execute the build. You can specify a specific target with "--target <NAME>"
42+
run: cmake --build . --config $BUILD_TYPE
43+
44+
- name: Rename build files
45+
run: |
46+
mv ${{github.workspace}}/build/picoboot ${{github.workspace}}/build/picoboot-${{matrix.os}}
47+
48+
- name: Archive production artifacts
49+
uses: actions/upload-artifact@v2
50+
with:
51+
name: ${{matrix.os}} build artifact
52+
path: |
53+
${{github.workspace}}/build/picoboot-${{matrix.os}}
54+
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*.*.*'
7+
8+
env:
9+
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
10+
BUILD_TYPE: Release
11+
12+
jobs:
13+
build-release:
14+
# The CMake configure and build commands are platform agnostic and should work equally
15+
# well on Windows or Mac. You can convert this to a matrix build if you need
16+
# cross-platform coverage.
17+
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
18+
runs-on: ${{matrix.os}}
19+
strategy:
20+
matrix:
21+
os: [ubuntu-latest, macos-latest]
22+
23+
steps:
24+
- uses: actions/checkout@v2
25+
26+
- name: Create Build Environment
27+
# Some projects don't allow in-source building, so create a separate build directory
28+
# We'll use this as our working directory for all subsequent commands
29+
run: cmake -E make_directory ${{github.workspace}}/build
30+
31+
- name: Configure CMake
32+
# Use a bash shell so we can use the same syntax for environment variable
33+
# access regardless of the host operating system
34+
shell: bash
35+
working-directory: ${{github.workspace}}/build
36+
# Note the current convention is to use the -S and -B options here to specify source
37+
# and build directories, but this is only available with CMake 3.13 and higher.
38+
# The CMake binaries on the Github Actions machines are (as of this writing) 3.12
39+
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE
40+
41+
- name: Build
42+
working-directory: ${{github.workspace}}/build
43+
shell: bash
44+
# Execute the build. You can specify a specific target with "--target <NAME>"
45+
run: cmake --build . --config $BUILD_TYPE
46+
47+
- name: Rename build files
48+
run: |
49+
mv ${{github.workspace}}/build/picoboot ${{github.workspace}}/build/picoboot-release-${{matrix.os}}
50+
51+
- name: Archive production artifacts
52+
uses: actions/upload-artifact@v2
53+
with:
54+
name: ${{matrix.os}} build artifact
55+
path: |
56+
${{github.workspace}}/build/picoboot-release-${{matrix.os}}
57+
58+
- name: Release
59+
uses: softprops/action-gh-release@v1
60+
if: startsWith(github.ref, 'refs/tags/')
61+
with:
62+
files: |
63+
${{github.workspace}}/build/picoboot-release-${{matrix.os}}
64+
env:
65+
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
66+

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# PICoBoot Utility
22

3+
[![Build Status](https://github.com/SudoMaker/PICoBoot_Utility/workflows/Build/badge.svg)](https://github.com/SudoMaker/PICoBoot_Utility/actions/workflows/push_pr_build_cmake.yml) [![Release Status](https://github.com/SudoMaker/PICoBoot_Utility/workflows/Release/badge.svg)](https://github.com/SudoMaker/PICoBoot_Utility/actions/workflows/release_cmake.yml)
4+
35
Utility for the [PICoBoot bootloader](https://github.com/SudoMaker/PICoBoot).
46

57
## Usage

0 commit comments

Comments
 (0)