forked from mattgodbolt/xania
-
Notifications
You must be signed in to change notification settings - Fork 0
65 lines (62 loc) · 2.38 KB
/
Copy pathc-cpp.yml
File metadata and controls
65 lines (62 loc) · 2.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
name: C/C++ CI
on: [push, pull_request]
jobs:
check-code-format:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v1
- name: configure
run: make check-format
build-and-test:
runs-on: ${{ matrix.os }}
env:
CC: gcc-${{ matrix.gcc_version }}
CXX: g++-${{ matrix.gcc_version }}
strategy:
matrix:
gcc_version: [ 11 ]
os: [ ubuntu-22.04 ]
build_type: [ debug, release ]
steps:
- uses: actions/checkout@v1
- name: install-compiler
run : sudo apt-get update && sudo apt-get install ninja-build g++-${{ matrix.gcc_version }} -y
- name: configure
run: cmake -G Ninja -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DUSE_CONAN=TRUE -B cmake-build-${{ matrix.build_type }}
- name: build
run: cmake --build cmake-build-${{ matrix.build_type }}
- name: test
run: cd cmake-build-${{ matrix.build_type }} && ctest --verbose
deploy-code:
if: ${{ github.ref_name == 'main' }}
needs: build-and-test
runs-on: ubuntu-22.04
env:
CC: gcc-11
CXX: g++-11
steps:
- uses: actions/checkout@v1
- name: install-compiler
run : sudo apt-get update && sudo apt-get install ninja-build g++-11 -y
- name: configure
run: |
cmake -G Ninja -DCMAKE_BUILD_TYPE=release \
-DBUILD_VERSION="$GITHUB_RUN_NUMBER" \
-DBUILD_COMMIT_URL="$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/tree/$GITHUB_SHA" \
-DBUILD_FULL_VERSION="$GITHUB_RUN_NUMBER $GITHUB_SHA on $GITHUB_REF" \
-DUSE_CONAN=TRUE -B cmake-build-release
- name: build
run: cmake --build cmake-build-release
- name: package
run: cmake --install cmake-build-release --prefix cmake-build-install
- name: tarball # TODO probably branch name here?
run: tar Jcvf xania-$GITHUB_RUN_NUMBER.tar.xz --transform "s|^cmake-build-install|./xania-$GITHUB_RUN_NUMBER|" cmake-build-install
- name: Upload file to bucket
uses: zdurham/s3-upload-github-action@master
env:
FILE: xania-${{ github.run_number }}.tar.xz
AWS_REGION: 'us-east-1'
S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }}
S3_KEY: releases/xania-${{ github.run_number }}.tar.xz
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}