Skip to content

Commit b0eddbf

Browse files
committed
Merging Microsoft main
2 parents b501799 + 3c130a6 commit b0eddbf

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+3307
-27
lines changed

.devcontainer/devcontainer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"ghcr.io/devcontainers-contrib/features/mocha:2": {
1313
"version": "latest"
1414
},
15-
"ghcr.io/devcontainers/features/docker-in-docker:1": {
15+
"ghcr.io/devcontainers/features/docker-in-docker:2": {
1616
"version": "latest"
1717
},
1818
"ghcr.io/devcontainers/features/java:1": {
@@ -38,7 +38,7 @@
3838
]
3939
}
4040
},
41-
"postCreateCommand": "cd ./completesolution/node; npm install; cd ../../; dotnet restore ./completesolution/dotnet/MinimalAPI.sln; dotnet restore ./exercisefiles/dotnet/MinimalAPI.sln"
41+
"postCreateCommand": "sudo ./.devcontainer/scripts/install-cmake.sh; cd ./completesolution/node; npm install; cd ../../; dotnet restore ./completesolution/dotnet/MinimalAPI.sln; dotnet restore ./exercisefiles/dotnet/MinimalAPI.sln"
4242
// Features to add to the dev container. More info: https://containers.dev/features.
4343
// "features": {},
4444
// Use 'forwardPorts' to make a list of ports inside the container available locally.
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/usr/bin/env bash
2+
#-------------------------------------------------------------------------------------------------------------
3+
# Copyright (c) Microsoft Corporation. All rights reserved.
4+
# Licensed under the MIT License. See https://go.microsoft.com/fwlink/?linkid=2090316 for license information.
5+
#-------------------------------------------------------------------------------------------------------------
6+
7+
set -e
8+
9+
echo "Installing apt packages..."
10+
apt-get update
11+
export DEBIAN_FRONTEND=noninteractive
12+
apt-get -y install build-essential cmake cppcheck valgrind clang lldb llvm gdb
13+
apt-get autoremove -y
14+
apt-get clean -y
15+
rm -rf /var/lib/apt/lists/*
16+
17+
echo "Installing vcpkg..."
18+
export VCPKG_ROOT=/usr/local/vcpkg
19+
export VCPKG_DOWNLOADS=/usr/local/vcpkg-downloads
20+
export PATH="${PATH}:${VCPKG_ROOT}"
21+
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
22+
"${DIR}/install-vcpkg.sh" vscode
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
#!/usr/bin/env bash
2+
#-------------------------------------------------------------------------------------------------------------
3+
# Copyright (c) Microsoft Corporation. All rights reserved.
4+
# Licensed under the MIT License. See https://go.microsoft.com/fwlink/?linkid=2090316 for license information.
5+
#-------------------------------------------------------------------------------------------------------------
6+
7+
set -e
8+
9+
USERNAME=${1:-"vscode"}
10+
11+
. /etc/os-release
12+
13+
# Add to bashrc/zshrc files for all users.
14+
updaterc() {
15+
echo "Updating /etc/bash.bashrc and /etc/zsh/zshrc..."
16+
if [[ "$(cat /etc/bash.bashrc)" != *"$1"* ]]; then
17+
echo -e "$1" >> /etc/bash.bashrc
18+
fi
19+
if [ -f "/etc/zsh/zshrc" ] && [[ "$(cat /etc/zsh/zshrc)" != *"$1"* ]]; then
20+
echo -e "$1" >> /etc/zsh/zshrc
21+
fi
22+
}
23+
24+
# Run apt-get if needed.
25+
apt_get_update_if_needed() {
26+
if [ ! -d "/var/lib/apt/lists" ] || [ "$(ls /var/lib/apt/lists/ | wc -l)" = "0" ]; then
27+
echo "Running apt-get update..."
28+
apt-get update
29+
else
30+
echo "Skipping apt-get update."
31+
fi
32+
}
33+
34+
# Check if packages are installed and installs them if not.
35+
check_packages() {
36+
if ! dpkg -s "$@" > /dev/null 2>&1; then
37+
apt_get_update_if_needed
38+
apt-get -y install --no-install-recommends "$@"
39+
fi
40+
}
41+
42+
export DEBIAN_FRONTEND=noninteractive
43+
export VCPKG_FORCE_SYSTEM_BINARIES=1
44+
45+
# Install additional packages needed by vcpkg: https://github.com/microsoft/vcpkg/blob/master/README.md#installing-linux-developer-tools
46+
check_packages build-essential tar curl zip unzip pkg-config bash-completion ninja-build
47+
48+
# Setup group and add user
49+
umask 0002
50+
if ! cat /etc/group | grep -e "^vcpkg:" > /dev/null 2>&1; then
51+
groupadd -r "vcpkg"
52+
fi
53+
usermod -a -G "vcpkg" "${USERNAME}"
54+
55+
# Start Installation
56+
# Clone repository with ports and installer
57+
mkdir -p "${VCPKG_ROOT}"
58+
mkdir -p "${VCPKG_DOWNLOADS}"
59+
git clone --depth=1 \
60+
-c core.eol=lf \
61+
-c core.autocrlf=false \
62+
-c fsck.zeroPaddedFilemode=ignore \
63+
-c fetch.fsck.zeroPaddedFilemode=ignore \
64+
-c receive.fsck.zeroPaddedFilemode=ignore \
65+
https://github.com/microsoft/vcpkg "${VCPKG_ROOT}"
66+
67+
## Run installer to get latest stable vcpkg binary
68+
## https://github.com/microsoft/vcpkg/blob/7e7dad5fe20cdc085731343e0e197a7ae655555b/scripts/bootstrap.sh#L126-L144
69+
"${VCPKG_ROOT}"/bootstrap-vcpkg.sh
70+
71+
# Add vcpkg to PATH
72+
updaterc "$(cat << EOF
73+
export VCPKG_ROOT="${VCPKG_ROOT}"
74+
if [[ "\${PATH}" != *"\${VCPKG_ROOT}"* ]]; then export PATH="\${PATH}:\${VCPKG_ROOT}"; fi
75+
EOF
76+
)"
77+
78+
# Give read/write permissions to the user group.
79+
chown -R ":vcpkg" "${VCPKG_ROOT}" "${VCPKG_DOWNLOADS}"
80+
chmod g+r+w+s "${VCPKG_ROOT}" "${VCPKG_DOWNLOADS}"
81+
chmod -R g+r+w "${VCPKG_ROOT}" "${VCPKG_DOWNLOADS}"
82+
83+
# Enable tab completion for bash and zsh
84+
VCPKG_FORCE_SYSTEM_BINARIES=1 su "${USERNAME}" -c "${VCPKG_ROOT}/vcpkg integrate bash"
85+
VCPKG_FORCE_SYSTEM_BINARIES=1 su "${USERNAME}" -c "${VCPKG_ROOT}/vcpkg integrate zsh"

.github/workflows/codeql.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: "CodeQL Advanced"
2+
3+
on:
4+
push:
5+
branches: [ "main" ]
6+
pull_request:
7+
branches: [ "main" ]
8+
schedule:
9+
- cron: '26 17 * * 6'
10+
11+
jobs:
12+
analyze:
13+
name: Analyze (${{ matrix.language }})
14+
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
15+
permissions:
16+
security-events: write
17+
packages: read
18+
actions: read
19+
contents: read
20+
21+
strategy:
22+
fail-fast: false
23+
matrix:
24+
include:
25+
- language: c-cpp
26+
build-mode: manual
27+
- language: csharp
28+
build-mode: none
29+
- language: java-kotlin
30+
build-mode: none
31+
- language: javascript-typescript
32+
build-mode: none
33+
steps:
34+
- name: Checkout repository
35+
uses: actions/checkout@v4
36+
37+
- name: Initialize CodeQL
38+
uses: github/codeql-action/init@v3
39+
with:
40+
languages: ${{ matrix.language }}
41+
build-mode: ${{ matrix.build-mode }}
42+
43+
# this is necessary because autobuild does not work
44+
- if: matrix.language == 'c-cpp'
45+
shell: bash
46+
run: |
47+
cd exercisefiles/c++
48+
cmake -S . -B build
49+
cmake --build build
50+
cd ../../completesolution/c++
51+
cmake -S . -B build
52+
cmake --build build
53+
54+
- name: Perform CodeQL Analysis
55+
uses: github/codeql-action/analyze@v3
56+
with:
57+
category: "/language:${{matrix.language}}"

.gitignore

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ build/Release
4343
node_modules/
4444
jspm_packages/
4545

46+
# NPM lock file
47+
package-lock.json
48+
4649
# Snowpack dependency directory (https://snowpack.dev/)
4750
web_modules/
4851

@@ -530,6 +533,45 @@ FodyWeavers.xsd
530533
*.sln.iml
531534
.idea/
532535

536+
<<<<<<< HEAD
537+
=======
538+
# C++ excludes
539+
540+
# Prerequisites
541+
*.d
542+
543+
# Compiled Object files
544+
*.slo
545+
*.lo
546+
*.o
547+
*.obj
548+
549+
# Precompiled Headers
550+
*.gch
551+
*.pch
552+
553+
# Compiled Dynamic libraries
554+
*.so
555+
*.dylib
556+
*.dll
557+
558+
# Fortran module files
559+
*.mod
560+
*.smod
561+
562+
# Compiled Static libraries
563+
*.lai
564+
*.la
565+
*.a
566+
*.lib
567+
568+
# Executables
569+
*.exe
570+
*.out
571+
*.app
572+
573+
build
574+
533575
# C++ specific ignores
534576
# Object files
535577
*.o
@@ -552,4 +594,4 @@ CTestTestfile.cmake
552594

553595
# Build directories
554596
build/
555-
bin/
597+
bin/

README.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,11 @@ Install the Copilot Extension for you IDE:
4848
- [Visual Studio 2022 Copilot Chat Extension](https://learn.microsoft.com/en-us/visualstudio/ide/visual-studio-github-copilot-chat?view=vs-2022)
4949
- [JetBrains Copilot Extension](https://docs.github.com/en/copilot/using-github-copilot/getting-code-suggestions-in-your-ide-with-github-copilot?tool=jetbrains)
5050

51+
### Install Copilot CLI
52+
53+
Follow the instructions for your operating system:
54+
- [Copilot CLI](https://github.com/cli/cli#installation)
55+
5156
### Work locally
5257

5358
**VisualStudio Code**
@@ -88,6 +93,7 @@ Run:
8893
## Labs instructions
8994

9095
- [Node Server](./exercisefiles/node/README.md)
96+
- [Node Server Typescript](./exercisefiles/node_typescript/README.md)
9197
- [.NET Web API](./exercisefiles/dotnet/README.md)
9298
- [Java Spring Boot](./exercisefiles/springboot/README.md)
9399
- [Java Quarkus](./exercisefiles/quarkus/README.md)
@@ -115,4 +121,6 @@ Run:
115121

116122
5. [Enabling GitHub Copilot in the CLI](https://docs.github.com/en/copilot/github-copilot-in-the-cli/enabling-github-copilot-in-the-cli)
117123

118-
6. [GitHub Copilot Badges and Certifications](https://learn.microsoft.com/en-us/training/browse/?terms=github%20copilot)
124+
6. [GitHub Copilot MS Learn Modules](https://learn.microsoft.com/en-us/training/browse/?terms=github%20copilot)
125+
126+
7. [GitHub Copilot Certifications](https://resources.github.com/learn/certifications/)
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
cmake_minimum_required(VERSION 3.14)
2+
3+
project(OctoConverter
4+
VERSION 1.0.0
5+
LANGUAGES CXX)
6+
7+
set(CMAKE_CXX_STANDARD 20)
8+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
9+
10+
enable_testing()
11+
12+
add_subdirectory(src)
13+
add_subdirectory(test)
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
add_subdirectory(converters)
2+
add_executable(main main.cpp)
3+
target_link_libraries(main PRIVATE converters)
4+
5+
set_target_properties(
6+
main
7+
PROPERTIES
8+
RUNTIME_OUTPUT_DIRECTORY
9+
"${CMAKE_BINARY_DIR}"
10+
)
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
## Build a library "converters" with all included files
2+
add_library(
3+
converters
4+
distance.cpp
5+
distance.h
6+
temperature.cpp
7+
temperature.h
8+
weight.cpp
9+
weight.h
10+
types.h
11+
)

0 commit comments

Comments
 (0)