Skip to content

Commit

Permalink
Upgrade dependency and adjust tests
Browse files Browse the repository at this point in the history
  • Loading branch information
zhongjie-cai committed Nov 15, 2024
1 parent bafa24a commit c95c0ac
Show file tree
Hide file tree
Showing 34 changed files with 1,856 additions and 6,592 deletions.
55 changes: 31 additions & 24 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,33 +6,40 @@
"service": "jobrunner_code",
"shutdownAction": "stopCompose",

// Set *default* container specific settings.json values on container create.
"settings": {
"go.toolsManagement.checkForUpdates": "local",
"go.useLanguageServer": true,
"go.gopath": "/go",
"go.goroot": "/usr/local/go",
"go.toolsGopath": "/go/bin",
"go.buildOnSave": "package",
"go.testOnSave": true,
"go.coverOnTestPackage": true,
"go.coverageDecorator": {
"type": "gutter",
"coveredHighlightColor": "rgba(64,128,128,0.5)",
"uncoveredHighlightColor": "rgba(128,64,64,0.25)",
"coveredGutterStyle": "blockgreen",
"uncoveredGutterStyle": "blockred"
},
"go.coverOnSingleTest": true,
"go.coverOnSave": true,
"go.testFlags": ["-short"]
"customizations": {
"vscode": {
// Set *default* container specific settings.json values on container create.
"settings": {
"go.toolsManagement.checkForUpdates": "local",
"go.useLanguageServer": true,
"go.gopath": "/go",
"go.goroot": "/usr/local/go",
"go.toolsGopath": "/go/bin",
"go.testOnSave": true,
"go.coverOnTestPackage": true,
"go.coverageDecorator": {
"type": "gutter",
"coveredHighlightColor": "rgba(64,128,128,0.5)",
"uncoveredHighlightColor": "rgba(128,64,64,0.25)",
"coveredGutterStyle": "blockgreen",
"uncoveredGutterStyle": "blockred"
},
"go.coverOnSingleTest": true,
"go.coverOnSave": true,
"go.testFlags": ["-short", "-gcflags=all=-l"]
},

// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"golang.Go",
"eamodio.gitlens",
"yzhang.markdown-all-in-one"
]
}
},

// Mount to proper location
"workspaceFolder": "/go/src/github.com/zhongjie-cai/job-runner",

// Add the IDs of extensions you want installed when the container is created.
"extensions": ["golang.Go", "eamodio.gitlens", "yzhang.markdown-all-in-one"]
"workspaceFolder": "/go/src/github.com/zhongjie-cai/job-runner"

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],
Expand Down
8 changes: 3 additions & 5 deletions .devcontainer/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
version: '3.3'
version: "3.3"

services:
jobrunner_code:
build:
context: .
dockerfile: ./Dockerfile
container_name: 'jobrunner_code'
image: mcr.microsoft.com/vscode/devcontainers/go:1.23
container_name: "jobrunner_code"
volumes:
# Mounts the project folder to '/workspace'. The target path inside the container
# should match what your application expects. In this case, the compose file is
Expand Down
63 changes: 63 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: CI # The name of the workflow that will appear on Github

on:
push:
branches: [master]
pull_request:
branches: [master]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
go: [1.23]
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
fetch-depth: 0

- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go }}

- name: Build
run: go install

- name: Run Test
run: |
go test -gcflags=all=-l -v ./... -covermode=count -coverprofile='coverage.out'
go tool cover -func='coverage.out' -o='coverage.out'
- name: Go Coverage Badge # Pass the `coverage.out` output to this action
uses: tj-actions/coverage-badge-go@v2
if: ${{ runner.os == 'Linux' && matrix.go == '1.23' }} # Runs this on only one of the ci builds.
with:
green: 100
filename: coverage.out

- name: Verify Changed files
uses: tj-actions/verify-changed-files@v16
id: verify-changed-files
with:
files: README.md

- name: Commit changes
if: steps.verify-changed-files.outputs.files_changed == 'true'
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add README.md
git commit -m "chore: Updated coverage badge."
- name: Push changes
if: steps.verify-changed-files.outputs.files_changed == 'true'
uses: ad-m/github-push-action@master
with:
github_token: ${{ github.token }}
branch: ${{ github.head_ref }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@
*.dll
*.so
*.dylib
.vscode/

# Test binary, built with `go test -c`
*.test
coverage/

# Output of the go coverage tool, specifically when used with LiteIDE
*.out
vendor/
8 changes: 0 additions & 8 deletions .travis.yml

This file was deleted.

162 changes: 0 additions & 162 deletions 0_functionPointers.go

This file was deleted.

Loading

0 comments on commit c95c0ac

Please sign in to comment.