Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
121 changes: 121 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
name: CI

on:
push:
branches:
- main
- feature/lab3
paths:
- "app/**"
- ".github/workflows/ci.yml"

pull_request:
branches:
- main
paths:
- "app/**"
- ".github/workflows/ci.yml"

permissions:
contents: read

env:
GOFLAGS: -buildvcs=false

concurrency:
group: ci-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
vet:
name: Vet / Go ${{ matrix.go }}
runs-on: ubuntu-24.04

strategy:
fail-fast: false
matrix:
go:
- "1.23"
- "1.24"

steps:
- name: Checkout repository
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.2.2
with:
sparse-checkout: app

- name: Set up Go
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
with:
go-version: ${{ matrix.go }}
cache: true
cache-dependency-path: app/go.mod

- name: Run go vet
working-directory: ./app
run: go vet ./...

test:
name: Test / Go ${{ matrix.go }}
runs-on: ubuntu-24.04

strategy:
fail-fast: false
matrix:
go:
- "1.23"
- "1.24"

steps:
- name: Checkout repository
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.2.2
with:
sparse-checkout: app

- name: Set up Go
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
with:
go-version: ${{ matrix.go }}
cache: true
cache-dependency-path: app/go.mod

- name: Run tests
working-directory: ./app
run: go test -race -count=1 ./...

lint:
name: Lint
runs-on: ubuntu-24.04

steps:
- name: Checkout repository
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.2.2
with:
sparse-checkout: app

- name: Set up Go
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
with:
go-version: "1.23"
cache: true
cache-dependency-path: app/go.mod

- name: Run golangci-lint
uses: golangci/golangci-lint-action@971e284b6050e8a5849b72094c50ab08da042db8 # v6.1.1
with:
version: v2.5.0
working-directory: app

ci-ok:
name: CI OK
if: always()
needs:
- vet
- test
- lint
runs-on: ubuntu-24.04

steps:
- name: Verify all CI jobs passed
run: |
test "${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') }}" = "false"
2 changes: 1 addition & 1 deletion app/handlers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func TestCreateNote_RoundTrip(t *testing.T) {
})
if rec.Code != http.StatusCreated {
t.Fatalf("expected 201, got %d: %s", rec.Code, rec.Body.String())
}
}
var n Note
if err := json.NewDecoder(rec.Body).Decode(&n); err != nil {
t.Fatalf("decode: %v", err)
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added submissions/lab3-assets/branch-protection.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added submissions/lab3-assets/docs-only-skip.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added submissions/lab3-assets/failed-ci.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added submissions/lab3-assets/green-ci.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading