Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
flc1125 committed Sep 17, 2023
1 parent afcd248 commit 563e373
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 6 deletions.
67 changes: 61 additions & 6 deletions pages/practice.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,28 +54,83 @@ layout: default

## 最佳实践 <small>容器化服务</small>


<div class="flex gap-4">

<div v-click class="overflow-auto h-100 w-100">

```yaml
name: Redis
on: push

jobs:
runner-job:
runs-on: ubuntu-latest
containers:
- image: redis

services:
redis:
image: redis
ports:
- 6379:6379

steps:
- name: Run Redis
run: |
redis-cli ping
- name: Checkout code
uses: actions/checkout@v3

- name: Install Go
uses: actions/setup-go@v3
- run: go version

- name: Run main.go
run: cd redis && go run main.go
```
</div>
<div v-click class="overflow-auto h-100 w-100">
```go
package main

import (
"context"
"time"

redis "github.com/redis/go-redis/v9"
)

var ctx = context.Background()

func main() {
rdb := redis.NewClient(&redis.Options{
Addr: "localhost:6379",
})

if err := rdb.Set(ctx, "test", time.Now().String(), time.Second*10).Err(); err != nil {
panic(err)
}

if result := rdb.Get(ctx, "test"); result.Err() != nil {
panic(result.Err())
} else {
println(result.Val())
}
}
```

</div>

</div>

---

<img v-click src="assets/images/practice-3.png" class="h-90"/>

<v-click>

[案例地址](https://github.com/github-actions-templates/example/blob/main/.github/workflows/redis.yml)

</v-click>

---

## 最佳实践 <small>版本控制和代码审查</small>
Expand Down
Binary file added public/assets/images/practice-3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 563e373

Please sign in to comment.