Skip to content

Commit 28697c1

Browse files
committed
ci(github/workflows): build & release pipelines created
1 parent b39e43f commit 28697c1

6 files changed

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