Skip to content

Commit

Permalink
Optimize CI configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
metopa committed Nov 30, 2019
1 parent fa4e1f4 commit f1b2506
Show file tree
Hide file tree
Showing 3 changed files with 152 additions and 13 deletions.
77 changes: 72 additions & 5 deletions .github/workflows/test_cpp_cmake.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,77 @@
name: Test C++ programs
# source: https://github.com/actions/starter-workflows/pull/47

on:
- push
- pull_request
paths-ignore:
- 'epi_judge_java*/**'
- 'epi_judge_python*/**'
- pull_request:
- 'epi_judge_java*/**'
- 'epi_judge_python*/**'

env:
BUILD_TYPE: Debug

jobs:
build:
fast_test:
name: Fast Test
runs-on: ubuntu-latest

strategy:
matrix:
mode: [stub, solution]
include:
- mode: stub
folder: epi_judge_cpp
- mode: solution
folder: epi_judge_cpp_solutions

steps:
- uses: actions/checkout@v1

- name: Set up Python 3.7
uses: actions/setup-python@v1
with:
python-version: 3.7

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install click
- name: Create Build Environment
# Some projects don't allow in-source building, so create a separate build directory
# We'll use this as our working directory for all subsequent commands
run: cmake -E make_directory ${{runner.workspace}}/build

- name: Configure CMake
# Use a bash shell so we can use the same syntax for environment variable
# access regardless of the host operating system
shell: bash
working-directory: ${{runner.workspace}}/build
# Note the current convention is to use the -S and -B options here to specify source
# and build directories, but this is only available with CMake 3.13 and higher.
# The CMake binaries on the Github Actions machines are (as of this writing) 3.12
run: cmake $GITHUB_WORKSPACE/${{matrix.folder}} -DCMAKE_BUILD_TYPE=$BUILD_TYPE

- name: Build
working-directory: ${{runner.workspace}}/build
shell: bash
run: cmake --build . --config $BUILD_TYPE -- -j 8

- name: Test
shell: bash
run: python epijudge_ci_test_tool.py --build-dir ${{runner.workspace}}/build cpp ${{matrix.mode}} .

- full_test:
name: Full Test
needs: fast_test
runs-on: ${{ matrix.os }}

strategy:
max-parallel: 1
max-parallel: 2
matrix:
os: [ubuntu-latest, macOS-latest, windows-latest]
os: [windows-latest, macOS-latest]
mode: [stub, solution]
include:
- mode: stub
Expand Down Expand Up @@ -51,10 +108,20 @@ jobs:
run: cmake $GITHUB_WORKSPACE/${{matrix.folder}} -DCMAKE_BUILD_TYPE=$BUILD_TYPE

- name: Build
if: runner.os == 'macOS'
working-directory: ${{runner.workspace}}/build
shell: bash
run: cmake --build . --config $BUILD_TYPE -- -j 8

- name: Build Windows
# Windows doesn't support -j switch
if: runner.os == 'Windows'
working-directory: ${{runner.workspace}}/build
shell: bash
run: cmake --build . --config $BUILD_TYPE --

- name: Test
# Mac build should be identical to ubuntu, skip to save resources
if: runner.os == 'Windows'
shell: bash
run: python epijudge_ci_test_tool.py --build-dir ${{runner.workspace}}/build cpp ${{matrix.mode}} .
47 changes: 43 additions & 4 deletions .github/workflows/test_java_make.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,19 @@ name: Run Java programs

on:
- push
- pull_request
paths-ignore:
- 'epi_judge_cpp*/**'
- 'epi_judge_python*/**'
- pull_request:
- 'epi_judge_cpp*/**'
- 'epi_judge_python*/**'

jobs:
build:

fast_test:
name: Fast test
runs-on: ubuntu-latest

strategy:
max-parallel: 2
matrix:
mode: [stub, solution]
include:
Expand Down Expand Up @@ -37,3 +42,37 @@ jobs:
run: make -C ${{ matrix.folder }} all
- name: Test
run: python epijudge_ci_test_tool.py java ${{ matrix.mode }} .

full_test:
name: Full test
needs: fast_test
runs-on: windows-latest

strategy:
matrix:
mode: [stub, solution]
include:
- mode: stub
folder: epi_judge_java
- mode: solution
folder: epi_judge_java_solutions

steps:
- uses: actions/checkout@v1
- name: Set up Python 3.7
uses: actions/setup-python@v1
with:
python-version: 3.7
- name: Set up Java 11
uses: actions/setup-java@v1
with:
java-version: '11.0.4'
java-package: jdk
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install click
- name: Compile
run: make -C ${{ matrix.folder }} all
- name: Test
run: python epijudge_ci_test_tool.py java ${{ matrix.mode }} .
41 changes: 37 additions & 4 deletions .github/workflows/test_python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,47 @@ name: Run Python programs

on:
- push
- pull_request
paths-ignore:
- 'epi_judge_cpp*/**'
- 'epi_judge_java*/**'
- pull_request:
- 'epi_judge_cpp*/**'
- 'epi_judge_java*/**'

jobs:
build:

fast_test:
name: Fast test
runs-on: ubuntu-latest

strategy:
max-parallel: 2
matrix:
python-version: [3.6, 3.8]

steps:
- uses: actions/checkout@v1
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install bintrees click
- name: Test stubs
run: |
python epijudge_ci_test_tool.py python stub .
- name: Test solutions
run: |
python epijudge_ci_test_tool.py python solution .
full_test:
name: Full Test
needs: fast_test
runs-on: windows-latest

strategy:
max-parallel: 4
max-parallel: 2
matrix:
python-version: [3.6, 3.7, 3.8]

Expand Down

0 comments on commit f1b2506

Please sign in to comment.