-
Notifications
You must be signed in to change notification settings - Fork 0
129 lines (120 loc) · 3.35 KB
/
build_test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
name: ci
on:
push:
branches:
- "main"
paths-ignore:
- "*.md"
pull_request:
branches:
- "main"
paths-ignore:
- "*.md"
jobs:
lint_websocket:
name: Lint WebSocket
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: '22.2.0'
check-latest: true
- name: yarn install
working-directory: ./websocketServer
run: yarn install --frozen-lockfile
- name: lint
working-directory: ./websocketServer
run: |
yarn prettier-check
yarn lint
build_svelte:
name: Build and lint Svelte
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: '22.2.0'
check-latest: true
- name: yarn install
working-directory: ./svelte
run: yarn install --frozen-lockfile
- name: svelte-check
working-directory: ./svelte
run: yarn check
- name: lint
working-directory: ./svelte
run: yarn lint
- name: build
working-directory: ./svelte
run: yarn build
build_test_rust:
name: Build and test Rust code
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Build
working-directory: ./rust
run: cargo build
- name: Run clippy
working-directory: ./rust
run: cargo clippy --all-targets --all-features
- name: Run tests
working-directory: ./rust
run: cargo test --all-targets --all-features
build_test_golang:
name: Build and test Golang code
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: 1.22.3
- name: Build
working-directory: ./golang
run: go build
- name: Run format check
working-directory: ./golang
run: gofmt -l .
- name: Run tests
working-directory: ./golang
run: go test ./...
build_and_publish:
name: Build and publish image
needs: [lint_websocket, build_svelte, build_test_rust, build_test_golang]
if: github.event_name != 'pull_request'
permissions:
contents: read
packages: write
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Get commit short
id: vars
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
# platforms: linux/amd64,linux/arm64 # todo: find how to build for arm64 in rust
platforms: linux/amd64
push: true
tags: |
ghcr.io/tbmc/brainfuck_interpreter:latest
ghcr.io/tbmc/brainfuck_interpreter:${{ steps.vars.outputs.sha_short }}