krahets/hello-algo
13 workflows · maturity 33% · 3 patterns · GitHub ↗
Practices
✓ Matrix✓ Permissions○ Security scan○ AI review○ Cache○ Concurrency○ Reusable workflows
Detected patterns
Security dimensions
Workflows (13)
c matrix .github/workflows/c.yml
View raw YAML
# This starter workflow is for a CMake project running on multiple platforms. There is a different starter workflow if you just want a single platform.
# See: https://github.com/actions/starter-workflows/blob/main/ci/cmake-single-platform.yml
name: C
on:
push:
branches: ["main"]
paths:
- "codes/c/**/*.c"
- "codes/c/**/*.h"
- "en/codes/c/**/*.c"
- "en/codes/c/**/*.h"
pull_request:
branches: ["main"]
paths:
- "codes/c/**/*.c"
- "codes/c/**/*.h"
- "en/codes/c/**/*.c"
- "en/codes/c/**/*.h"
workflow_dispatch:
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
# Set fail-fast to false to ensure that feedback is delivered for all matrix combinations. Consider changing this to true when your workflow is stable.
fail-fast: true
# Set up a matrix to run the following 3 configurations:
# 1. <Windows, Release, latest MSVC compiler toolchain on the default runner image, default generator>
# 2. <Linux, Release, latest GCC compiler toolchain on the default runner image, default generator>
# 3. <Linux, Release, latest Clang compiler toolchain on the default runner image, default generator>
#
# To add more build types (Release, Debug, RelWithDebInfo, etc.) customize the build_type list.
matrix:
os: [ubuntu-latest, windows-latest]
build_type: [Release]
c_compiler: [gcc, clang, cl]
code-dir: ["codes/c", "en/codes/c"]
include:
- os: windows-latest
c_compiler: cl
cpp_compiler: cl
- os: ubuntu-latest
c_compiler: gcc
cpp_compiler: g++
- os: ubuntu-latest
c_compiler: clang
cpp_compiler: clang++
exclude:
- os: windows-latest
c_compiler: gcc
- os: windows-latest
c_compiler: clang
- os: ubuntu-latest
c_compiler: cl
steps:
- uses: actions/checkout@v4
- name: Configure CMake
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
run: >
cmake -B ${{ github.workspace }}/${{ matrix.code-dir }}/build
-DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }}
-DCMAKE_C_COMPILER=${{ matrix.c_compiler }}
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
-S ${{ github.workspace }}/${{ matrix.code-dir }}
- name: Build
# Build your program with the given configuration. Note that --config is needed because the default Windows generator is a multi-config generator (Visual Studio generator).
run: cmake --build ${{ github.workspace }}/${{ matrix.code-dir }}/build --config ${{ matrix.build_type }}
- name: Test
working-directory: ${{ github.workspace }}/${{ matrix.code-dir }}/build
# Execute tests defined by the CMake configuration. Note that --build-config is needed because the default Windows generator is a multi-config generator (Visual Studio generator).
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: ctest --build-config ${{ matrix.build_type }}
cpp matrix .github/workflows/cpp.yml
View raw YAML
# This starter workflow is for a CMake project running on multiple platforms. There is a different starter workflow if you just want a single platform.
# See: https://github.com/actions/starter-workflows/blob/main/ci/cmake-single-platform.yml
name: C++
on:
push:
branches: ["main"]
paths:
- "codes/cpp/**/*.cpp"
- "codes/cpp/**/*.hpp"
- "en/codes/cpp/**/*.cpp"
- "en/codes/cpp/**/*.hpp"
pull_request:
branches: ["main"]
paths:
- "codes/cpp/**/*.cpp"
- "codes/cpp/**/*.hpp"
- "en/codes/cpp/**/*.cpp"
- "en/codes/cpp/**/*.hpp"
workflow_dispatch:
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
# Set fail-fast to false to ensure that feedback is delivered for all matrix combinations. Consider changing this to true when your workflow is stable.
fail-fast: true
# Set up a matrix to run the following 3 configurations:
# 1. <Windows, Release, latest MSVC compiler toolchain on the default runner image, default generator>
# 2. <Linux, Release, latest GCC compiler toolchain on the default runner image, default generator>
# 3. <Linux, Release, latest Clang compiler toolchain on the default runner image, default generator>
#
# To add more build types (Release, Debug, RelWithDebInfo, etc.) customize the build_type list.
matrix:
os: [ubuntu-latest, windows-latest]
build_type: [Release]
c_compiler: [gcc, clang, cl]
code-dir: ["codes/cpp", "en/codes/cpp"]
include:
- os: windows-latest
c_compiler: cl
cpp_compiler: cl
- os: ubuntu-latest
c_compiler: gcc
cpp_compiler: g++
- os: ubuntu-latest
c_compiler: clang
cpp_compiler: clang++
exclude:
- os: windows-latest
c_compiler: gcc
- os: windows-latest
c_compiler: clang
- os: ubuntu-latest
c_compiler: cl
steps:
- uses: actions/checkout@v4
- name: Configure CMake
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
run: >
cmake -B ${{ github.workspace }}/${{ matrix.code-dir }}/build
-DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }}
-DCMAKE_C_COMPILER=${{ matrix.c_compiler }}
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
-S ${{ github.workspace }}/${{ matrix.code-dir }}
- name: Build
# Build your program with the given configuration. Note that --config is needed because the default Windows generator is a multi-config generator (Visual Studio generator).
run: cmake --build ${{ github.workspace }}/${{ matrix.code-dir }}/build --config ${{ matrix.build_type }}
- name: Test
working-directory: ${{ github.workspace }}/${{ matrix.code-dir }}/build
# Execute tests defined by the CMake configuration. Note that --build-config is needed because the default Windows generator is a multi-config generator (Visual Studio generator).
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: ctest --build-config ${{ matrix.build_type }}
dart matrix perms .github/workflows/dart.yml
View raw YAML
# This workflow will install Dart SDK, run format, analyze and build with Dart
name: Dart
on:
push:
branches: ["main"]
paths:
- "codes/dart/**/*.dart"
- "en/codes/dart/**/*.dart"
pull_request:
branches: ["main"]
paths:
- "codes/dart/**/*.dart"
- "en/codes/dart/**/*.dart"
workflow_dispatch:
permissions:
contents: read
jobs:
build:
name: Dart ${{ matrix.dart-sdk }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
dart-sdk: [stable]
code-dir: ["codes/dart", "en/codes/dart"]
steps:
- uses: actions/checkout@v4
- name: Set up Dart ${{ matrix.dart-sdk }}
uses: dart-lang/setup-dart@v1
with:
sdk: ${{ matrix.dart-sdk}}
- name: Run format
run: dart format ${{ matrix.code-dir }}
- name: Run analyze
run: dart analyze ${{ matrix.code-dir }}
- name: Run build
run: dart ${{ matrix.code-dir }}/build.dart
dotnet matrix .github/workflows/dotnet.yml
View raw YAML
# This workflow will build a .NET project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net
name: .NET
on:
push:
branches: ["main"]
paths:
- "codes/csharp/**/*.cs"
- "en/codes/csharp/**/*.cs"
pull_request:
branches: ["main"]
paths:
- "codes/csharp/**/*.cs"
- "en/codes/csharp/**/*.cs"
workflow_dispatch:
jobs:
build:
name: .NET ${{ matrix.dotnet-version }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
defaults:
run:
working-directory: ${{ matrix.code-dir }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
dotnet-version: ["8.0.x"]
code-dir: ["codes/csharp", "en/codes/csharp"]
steps:
- uses: actions/checkout@v4
- name: Setup .NET ${{ matrix.dotnet-version }}
uses: actions/setup-dotnet@v3
with:
dotnet-version: ${{ matrix.dotnet-version }}
- name: Restore dependencies
run: dotnet restore hello-algo.csproj
- name: Build
run: dotnet build --no-restore hello-algo.csproj
- name: Test with dotnet
run: dotnet test hello-algo.csproj
go matrix .github/workflows/go.yml
View raw YAML
name: Go
on:
push:
branches: ["main"]
paths:
- "codes/go/**/*.go"
- "en/codes/go/**/*.go"
pull_request:
branches: ["main"]
paths:
- "codes/go/**/*.go"
- "en/codes/go/**/*.go"
workflow_dispatch:
jobs:
build:
name: Go ${{ matrix.go-version }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
defaults:
run:
working-directory: ${{ matrix.code-dir }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
go-version: ["1.19.x"]
code-dir: ["codes/go", "en/codes/go"]
steps:
- uses: actions/checkout@v4
- name: Setup Go ${{ matrix.go-version }}
uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go-version }}
- name: Check out code into the Go module directory
run: go get -v -t -d ./...
- name: Build
run: go build -v ./...
- name: Test with Go
run: go test -v ./...
java matrix .github/workflows/java.yml
View raw YAML
# # This workflow will install OpenJDK and build the Java project
# For more information see: https://github.com/actions/setup-java
name: Java
on:
push:
branches: ["main"]
paths:
- "codes/java/**/*.java"
- "en/codes/java/**/*.java"
pull_request:
branches: ["main"]
paths:
- "codes/java/**/*.java"
- "en/codes/java/**/*.java"
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-20.04
strategy:
matrix:
java: ["11", "17"]
code-dir: ["codes/java", "en/codes/java"]
name: Java ${{ matrix.Java }} sample
steps:
- uses: actions/checkout@v4
- name: Setup java
uses: actions/setup-java@v3
with:
distribution: "temurin"
java-version: ${{ matrix.java }}
- run: javac -d ${{ matrix.code-dir }}/build ${{ matrix.code-dir }}/**/*.java
javascript matrix .github/workflows/javascript.yml
View raw YAML
name: JavaScript
on:
push:
branches: ["main"]
paths:
- "codes/javascript/**/*.js"
- "en/codes/javascript/**/*.js"
pull_request:
branches: ["main"]
paths:
- "codes/javascript/**/*.js"
- "en/codes/javascript/**/*.js"
workflow_dispatch:
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
code-dir: ["codes/javascript", "en/codes/javascript"]
steps:
- uses: actions/checkout@v5
- uses: actions/setup-node@v6
with:
node-version: 24.x
- uses: denoland/setup-deno@v2
with:
deno-version: v2.x
- name: Run JavaScript Code
run: deno run -A ${{ matrix.code-dir }}/test_all.js
kotlin matrix .github/workflows/kotlin.yml
View raw YAML
name: Kotlin
on:
push:
branches: ["main"]
paths:
- "codes/kotlin/**/*.kt"
- "en/codes/kotlin/**/*.kt"
pull_request:
branches: ["main"]
paths:
- "codes/kotlin/**/*.kt"
- "en/codes/kotlin/**/*.kt"
workflow_dispatch:
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
code-dir: ["codes/kotlin", "en/codes/kotlin"]
name: Kotlin on ${{ matrix.os }}
steps:
- uses: actions/checkout@v4.1.2
- name: Build JAR
run: kotlinc ${{ matrix.code-dir }}/**/*.kt -include-runtime -d ${{ matrix.code-dir }}/build/test.jar
python matrix perms .github/workflows/python.yml
View raw YAML
# This workflow will install Python dependencies, run tests and lint with Python
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
name: Python
on:
push:
branches: ["main"]
paths:
- "codes/python/**/*.py"
- "en/codes/python/**/*.py"
pull_request:
branches: ["main"]
paths:
- "codes/python/**/*.py"
- "en/codes/python/**/*.py"
workflow_dispatch:
permissions:
contents: read
jobs:
build:
name: Python ${{ matrix.python-version }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.10"]
code-dir: ["codes/python", "en/codes/python"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install black
- name: Lint with black
run: |
black ${{ matrix.code-dir }}
- name: Test python code
run: |
cd ${{ matrix.code-dir }} && python test_all.py
ruby matrix perms .github/workflows/ruby.yml
View raw YAML
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by separate terms of service, privacy policy, and support documentation.
# This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake。
# For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
name: Ruby
on:
push:
branches: ["main"]
paths:
- "codes/ruby/**/*.rb"
- "en/codes/ruby/**/*.rb"
pull_request:
branches: ["main"]
paths:
- "codes/ruby/**/*.rb"
- "en/codes/ruby/**/*.rb"
workflow_dispatch:
permissions:
contents: read
jobs:
test:
name: Ruby ${{ matrix.ruby-version }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
ruby-version: ["3.3"]
code-dir: ["codes/ruby", "en/codes/ruby"]
steps:
- uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby-version }}
- name: Run tests
run: ruby ${{ matrix.code-dir }}/test_all.rb
rust matrix .github/workflows/rust.yml
View raw YAML
name: Rust
on:
push:
branches: ["main"]
paths:
- "codes/rust/**/*.rs"
- "codes/rust/Cargo.toml"
- "en/codes/rust/**/*.rs"
- "en/codes/rust/Cargo.toml"
pull_request:
branches: ["main"]
paths:
- "codes/rust/**/*.rs"
- "codes/rust/Cargo.toml"
- "en/codes/rust/**/*.rs"
- "en/codes/rust/Cargo.toml"
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
code-dir: ["codes/rust", "en/codes/rust"]
steps:
- uses: brndnmtthws/rust-action-rustup@v1
with:
toolchain: nightly
- uses: actions/checkout@v4
- name: Build
run: cargo build --manifest-path=${{ matrix.code-dir }}/Cargo.toml && cargo build --manifest-path=${{ matrix.code-dir }}/Cargo.toml --release
swift matrix .github/workflows/swift.yml
View raw YAML
# This workflow will build a Swift project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-swift
name: Swift
on:
push:
branches: ["main"]
paths:
- "codes/swift/**/*.swift"
- "en/codes/swift/**/*.swift"
pull_request:
branches: ["main"]
paths:
- "codes/swift/**/*.swift"
- "en/codes/swift/**/*.swift"
workflow_dispatch:
jobs:
build:
name: Swift on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: ["ubuntu-22.04", "macos-14"]
code-dir: ["codes/swift", "en/codes/swift"]
steps:
- uses: actions/checkout@v4
- name: Build
run: swift build --package-path ${{ matrix.code-dir }}
typescript matrix .github/workflows/typescript.yml
View raw YAML
name: TypeScript
on:
push:
branches: ["main"]
paths:
- "codes/typescript/**/*.ts"
- "en/codes/typescript/**/*.ts"
pull_request:
branches: ["main"]
paths:
- "codes/typescript/**/*.ts"
- "en/codes/typescript/**/*.ts"
workflow_dispatch:
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
code-dir: ["codes/typescript", "en/codes/typescript"]
steps:
- uses: actions/checkout@v5
- uses: actions/setup-node@v6
with:
node-version: 24.x
- name: Install dependencies
run: cd ${{ matrix.code-dir }} && npm install
- name: Check TypeScript code
run: cd ${{ matrix.code-dir }} && npm run check