• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1name: Linux
2
3on:
4  pull_request:
5  push:
6  release:
7    types: published
8
9jobs:
10  build:
11    runs-on: [ubuntu-latest]
12    container:
13      image: centos:7
14    steps:
15    - uses: actions/checkout@v2
16    - name: Install dependencies
17      run: |
18        curl -L -O https://github.com/Kitware/CMake/releases/download/v3.16.4/cmake-3.16.4-Linux-x86_64.sh
19        chmod +x cmake-3.16.4-Linux-x86_64.sh
20        ./cmake-3.16.4-Linux-x86_64.sh --skip-license --prefix=/usr/local
21        curl -L -O https://www.mirrorservice.org/sites/dl.fedoraproject.org/pub/epel/7/x86_64/Packages/p/p7zip-16.02-10.el7.x86_64.rpm
22        curl -L -O https://www.mirrorservice.org/sites/dl.fedoraproject.org/pub/epel/7/x86_64/Packages/p/p7zip-plugins-16.02-10.el7.x86_64.rpm
23        rpm -U --quiet p7zip-16.02-10.el7.x86_64.rpm
24        rpm -U --quiet p7zip-plugins-16.02-10.el7.x86_64.rpm
25        yum install -y make gcc-c++
26
27    - name: Build ninja
28      shell: bash
29      run: |
30        cmake -DCMAKE_BUILD_TYPE=Release -B build
31        cmake --build build --parallel --config Release
32        strip build/ninja
33
34    - name: Test ninja
35      run: ./ninja_test
36      working-directory: build
37
38    - name: Create ninja archive
39      run: |
40        mkdir artifact
41        7z a artifact/ninja-linux.zip ./build/ninja
42
43    # Upload ninja binary archive as an artifact
44    - name: Upload artifact
45      uses: actions/upload-artifact@v1
46      with:
47        name: ninja-binary-archives
48        path: artifact
49
50    - name: Upload release asset
51      if: github.event.action == 'published'
52      uses: actions/upload-release-asset@v1.0.1
53      env:
54        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
55      with:
56        upload_url: ${{ github.event.release.upload_url }}
57        asset_path: ./artifact/ninja-linux.zip
58        asset_name: ninja-linux.zip
59        asset_content_type: application/zip
60