Skip to content

Commit

Permalink
feat: bump deps and actions (#536)
Browse files Browse the repository at this point in the history
  • Loading branch information
cosmtrek authored Feb 25, 2024
1 parent ca162a8 commit 3164bee
Show file tree
Hide file tree
Showing 11 changed files with 242 additions and 469 deletions.
31 changes: 16 additions & 15 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: build
name: Build

on:
push:
Expand All @@ -10,49 +10,50 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
name: build
name: Build
runs-on: ${{ matrix.os }}
steps:
- name: check out code
- name: Check out code
uses: actions/checkout@v4
- name: setup Go 1.22
- name: Setup Go
id: go
uses: actions/setup-go@v4
with:
go-version: ^1.22
- name: build

- name: Build
run: make build
- name: install dependency
- name: Install dependency
run: if [ $(uname) == "Darwin" ]; then brew install gnu-sed ;fi
- name: run Unit tests.
run: go install github.com/go-delve/delve/cmd/dlv@latest && go test ./... -v -covermode=count -coverprofile=coverage.txt
- name: upload Coverage report to CodeCov
uses: codecov/codecov-action@v3
- name: Run unit tests
run: go install github.com/go-delve/delve/cmd/dlv@latest && go test ./... -v -covermode=count -coverprofile=coverage.txt
- name: Upload Coverage report to CodeCov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.txt
verbose: true

push_to_docker_latest:
name: push master code to docker latest image
name: Push master code to docker latest image
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: set up Docker Buildx
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: login to DockerHub
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: build and push
- name: Build and push
id: docker_build
uses: docker/build-push-action@v5
with:
push: true
platforms: linux/amd64,linux/arm64
tags: cosmtrek/air:latest
- name: show image digest
- name: Show image digest
run: echo ${{ steps.docker_build.outputs.digest }}
36 changes: 19 additions & 17 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: release
name: Release

on:
push:
Expand All @@ -7,46 +7,48 @@ on:

jobs:
release:
name: release
name: Release
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
steps:
- name: checkout code
uses: actions/checkout@v2
- name: setup Go
uses: actions/setup-go@v2
- name: Check out code
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: ^1.22
- name: set GOVERSION

- name: Set GOVERSION
run: echo "GOVERSION=$(go version | sed -r 's/go version go(.*)\ .*/\1/')" >> $GITHUB_ENV
- name: set AirVersion
- name: Set AirVersion
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
- name: show version
- name: Show version
run: echo ${{ env.GOVERSION }} ${{ env.VERSION }}

- name: run GoReleaser
uses: goreleaser/goreleaser-action@v2
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v5
with:
distribution: goreleaser
version: latest
args: release --rm-dist
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: set up Docker Buildx
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: login to DockerHub
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: push to docker hub
- name: Push to DockerHub
id: docker_build
uses: docker/build-push-action@v5
with:
push: true
platforms: linux/amd64,linux/arm64
tags: cosmtrek/air:${{ env.VERSION }}
- name: show docker image digest
run: echo ${{ steps.docker_build.outputs.digest }}
- name: Show docker image digest
run: echo ${{ steps.docker_build.outputs.digest }}
8 changes: 4 additions & 4 deletions .github/workflows/smoke_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ on:

jobs:
smoke_test_ubuntu:
uses: cosmtrek/air/.github/workflows/smoke_test_reuse_job.yml@add_smoke_test
uses: cosmtrek/air/.github/workflows/smoke_test_reuse_job.yml@master
with:
run_on: ubuntu-latest
smoke_test_macos:
uses: cosmtrek/air/.github/workflows/smoke_test_reuse_job.yml@add_smoke_test
uses: cosmtrek/air/.github/workflows/smoke_test_reuse_job.yml@master
with:
run_on: macos-latest
smoke_test_windows:
uses: cosmtrek/air/.github/workflows/smoke_test_window_reust_job.yml@fix_window_arg_bug
uses: cosmtrek/air/.github/workflows/smoke_test_window_reuse_job.yml@master
with:
run_on: windows-latest
run_on: windows-latest
16 changes: 8 additions & 8 deletions .github/workflows/smoke_test_reuse_job.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,26 +12,26 @@ jobs:
name: smoke_test
runs-on: ${{ inputs.run_on }}
steps:
- name: check out code
uses: actions/checkout@v2
- name: setup Go 1.22
- name: Check out code
uses: actions/checkout@v4
- name: Setup Go
id: go
uses: actions/setup-go@v2
uses: actions/setup-go@v4
with:
go-version: ^1.22
- name: install
- name: Install
run: make install
- name: check rebuild
- name: Check rebuild
id: check_rebuild
working-directory: ./smoke_test/check_rebuild
run: |
nohup air > nohup.out 2> nohup.err < /dev/null &
sleep 15
echo "" >> main.go
sleep 5
cat nohup.out
cat nohup.out
grep "running" nohup.out | wc -l | if [ "$(cat -)" -eq "2" ]; then echo "::set-output name=value::PASS"; else echo "::set-output name=value::FAIL"; fi
- uses: nick-invision/assert-action@v1
with:
expected: "PASS"
actual: ${{ steps.check_rebuild.outputs.value }}
actual: ${{ steps.check_rebuild.outputs.value }}
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,24 @@ jobs:
name: smoke_test
runs-on: ${{ inputs.run_on }}
steps:
- name: check out code
uses: actions/checkout@v2
- name: setup Go 1.22
- name: Check out code
uses: actions/checkout@v4
- name: Setup Go
id: go
uses: actions/setup-go@v2
uses: actions/setup-go@v4
with:
go-version: ^1.22

- name: Setup Python
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Install depend
run: |
python -m pip install pexpect
- name: install
- name: Install
run: make install
- name: check rebuild
- name: Check rebuild
id: check_rebuild
working-directory: ./smoke_test
run: |
Expand Down
2 changes: 1 addition & 1 deletion README-zh_cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ P.S. 非常感谢 mattn 的 [PR](https://github.com/cosmtrek/air/pull/1),使

### 使用 `go install`

使用 Go 的版本为 1.16 或更高:
使用 Go 的版本为 1.22 或更高:

```bash
go install github.com/cosmtrek/air@latest
Expand Down
2 changes: 1 addition & 1 deletion README-zh_tw.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Air 是一個另類的自動重新編譯執行命令列工具,用於開發 Go

### 使用 `go install` (推薦)

需要使用 go 1.18 或更高版本:
需要使用 go 1.22 或更高版本:

```bash
go install github.com/cosmtrek/air@latest
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Use a comma to separate items for arguments that take a list as input:

### Via `go install` (Recommended)

With go 1.18 or higher:
With go 1.22 or higher:

```bash
go install github.com/cosmtrek/air@latest
Expand Down
6 changes: 3 additions & 3 deletions air_example.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ post_cmd = ["echo 'hello air' > post_cmd.txt"]
bin = "tmp/main"
# Customize binary, can setup environment variables when run your app.
full_bin = "APP_ENV=dev APP_USER=air ./tmp/main"
# Add additional arguments when running binary (bin/full_bin). Will run './tmp/main hello world'.
args_bin = ["hello", "world"]
# Watch these filename extensions.
include_ext = ["go", "tpl", "tmpl", "html"]
# Ignore these filename extensions or directories.
Expand Down Expand Up @@ -48,10 +50,8 @@ send_interrupt = false
kill_delay = 500 # nanosecond
# Rerun binary or not
rerun = false
# Delay after each executions
# Delay after each execution
rerun_delay = 500
# Add additional arguments when running binary (bin/full_bin). Will run './tmp/main hello world'.
args_bin = ["hello", "world"]

[log]
# Show log time
Expand Down
36 changes: 21 additions & 15 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,33 @@ go 1.22

require (
dario.cat/mergo v1.0.0
github.com/creack/pty v1.1.18
github.com/fatih/color v1.14.1
github.com/fsnotify/fsnotify v1.6.0
github.com/gohugoio/hugo v0.111.3
github.com/creack/pty v1.1.21
github.com/fatih/color v1.16.0
github.com/fsnotify/fsnotify v1.7.0
github.com/gohugoio/hugo v0.123.3
github.com/pelletier/go-toml v1.9.5
github.com/stretchr/testify v1.8.1
github.com/stretchr/testify v1.8.4
)

require (
github.com/bep/godartsass v0.16.0 // indirect
github.com/bep/golibsass v1.1.0 // indirect
github.com/cli/safeexec v1.0.0 // indirect
github.com/bep/godartsass v1.2.0 // indirect
github.com/bep/godartsass/v2 v2.0.0 // indirect
github.com/bep/golibsass v1.1.1 // indirect
github.com/cli/safeexec v1.0.1 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/gobwas/glob v0.2.3 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.17 // indirect
github.com/pelletier/go-toml/v2 v2.0.6 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mitchellh/hashstructure v1.1.0 // indirect
github.com/pelletier/go-toml/v2 v2.1.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/spf13/afero v1.9.3 // indirect
github.com/tdewolff/parse/v2 v2.6.5 // indirect
golang.org/x/sys v0.5.0 // indirect
golang.org/x/text v0.7.0 // indirect
google.golang.org/protobuf v1.28.1 // indirect
github.com/spf13/afero v1.11.0 // indirect
github.com/spf13/cast v1.6.0 // indirect
github.com/tdewolff/parse/v2 v2.7.12 // indirect
github.com/tdewolff/test v1.0.11-0.20240106005702-7de5f7df4739 // indirect
golang.org/x/sys v0.17.0 // indirect
golang.org/x/text v0.14.0 // indirect
google.golang.org/protobuf v1.31.0 // indirect
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
Loading

0 comments on commit 3164bee

Please sign in to comment.