Skip to content

Commit 69312bc

Browse files
committed
ci(github/workflows): build & release pipelines created
1 parent f7d29b5 commit 69312bc

6 files changed

Lines changed: 79 additions & 1 deletion

File tree

.bazelrc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
build --cxxopt='-std=c++20'
1+
build --cxxopt=-std=c++20
2+
build --host_cxxopt=-std=c++20
3+
build --features=layering_check

.bazelversion

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
8.3.0

.github/workflows/build.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Bazel Build
2+
3+
on:
4+
push:
5+
tags:
6+
- "v**"
7+
8+
jobs:
9+
build:
10+
runs-on: ${{ matrix.platform }}
11+
strategy:
12+
fail-fast: true
13+
matrix:
14+
platform: [ubuntu-latest, windows-latest, macos-latest]
15+
steps:
16+
- name: Setup Go
17+
uses: actions/setup-go@v6
18+
with:
19+
go-version: "1.26"
20+
21+
- name: Install Bazelisk
22+
run: |
23+
go install github.com/bazelbuild/bazelisk@latest
24+
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
25+
export USE_BAZEL_VERSION=8.3.0
26+
bazel version
27+
28+
- name: Checkout code
29+
uses: actions/checkout@v3
30+
31+
- name: Build with Bazel
32+
run: |
33+
bazel build //tetris:tetris --verbose_failures
34+
echo "binary_path=$(bazel info bazel-bin)/tetris/tetris" >> $GITHUB_ENV
35+
36+
- name: Upload Artifacts
37+
uses: actions/upload-artifact@v4
38+
with:
39+
name: tetris-artifact-${{ matrix.platform }}
40+
path: |
41+
${{ env.binary_path }}
42+
${{ env.binary_path }}.runfiles/

.github/workflows/release.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Create Release
2+
3+
on:
4+
workflow_run:
5+
workflows: ["Bazel Build"]
6+
types:
7+
- completed
8+
9+
jobs:
10+
release:
11+
if: ${{ github.event.workflow_run.conclusion == 'success' }}
12+
runs-on: ubuntu-slim
13+
permissions:
14+
contents: write
15+
16+
steps:
17+
- name: Download Artifacts
18+
uses: actions/download-artifact@v4
19+
with:
20+
path: ./artifacts
21+
22+
- name: Create Release
23+
uses: ncipollo/release-action@v1
24+
with:
25+
tag: ${{ github.event.workflow_run.head_branch }}
26+
name: ${{ github.event.workflow_run.head_branch }}
27+
body: "Automated release"
28+
artifacts: ./artifacts/**/*
29+
draft: false
30+
prerelease: false

tetris/BUILD.bazel

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ cc_library(
44
hdrs = glob(["include/**/*.h"]),
55
includes = ["include"],
66
visibility = ["//visibility:public"],
7+
copts = ["-std=c++20"]
78
)
89

910
filegroup(
@@ -17,4 +18,5 @@ cc_binary(
1718
srcs = ["src/main.cc"],
1819
deps = [":mylib"],
1920
data = [":textures"],
21+
copts = ["-std=c++20"]
2022
)

tetris/src/core/rng.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#include <chrono>
12
#include <cstdint>
23

34
#include "core/rng.h"

0 commit comments

Comments
 (0)