Skip to content

Bump Go version inside Nix environment #114

Bump Go version inside Nix environment

Bump Go version inside Nix environment #114

Workflow file for this run

name: QA
on:
- push
- pull_request
jobs:
generate:
name: "${{ github.event_name }} / generate"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: diamondburned/cache-install@main
with:
shell-file: shell.nix
- run: go generate
- name: Git dirty check
run: |
git add .
if [[ -n "$(git status --porcelain)" ]]; then
PAGER= git diff --cached
exit 1
fi
lint:
name: "${{ github.event_name }} / lint"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: diamondburned/cache-install@main
with:
shell-file: shell.nix
- name: Run goimports
run: |
goimports -w .
git add .
if [[ -n "$(git status --porcelain)" ]]; then
PAGER= git diff --cached
exit 1
fi
test:
name: "${{ github.event_name }} / test"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: diamondburned/cache-install@main
with:
shell-file: shell.nix
- name: Setup Go build cache
uses: actions/cache@v3
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: go-build-nix-${{ github.run_id }}
restore-keys: |
go-build-nix-
go-build-
- run: go test ./...
- run: cd pkg && go test ./...
docker:
name: "${{ github.event_name }} / docker"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: docker/setup-buildx-action@v2
- name: Setup Go build cache
uses: actions/cache@v3
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: go-build-docker-${{ github.run_id }}
restore-keys: |
go-build-docker-
go-build-
- run: mkdir -p ~/.cache/go-build
# Check that the instructions for using Docker in CONTRIBUTING.md work.
# Use docker/build-push-action@v4 instead of plain `docker build` to get caching.
- name: docker build -t gotk4 .
uses: docker/build-push-action@v4
with:
# Build but don't push
load: true
push: false
# Caching
cache-from: type=gha
cache-to: type=gha,mode=max
# Normal `docker build` arguments
tags: gotk4
#context: . # commented out to use Git directly instead of the filesystem
- run: |
docker run \
--rm \
--volume "$PWD:/gotk4/" \
-u "$(id -u):$(id -g)" \
gotk4 \
go generate
- name: Git dirty check
run: |
git add .
if [[ -n "$(git status --porcelain)" ]]; then
PAGER= git diff --cached
exit 1
fi
# Also add extra `--volume "$HOME/.cache/go-build:/user/.cache/go-build"`
# arguments to do caching.
- run: |
docker run \
--rm \
--volume "$PWD:/gotk4/" \
--volume "$HOME/.cache/go-build:/user/.cache/go-build" \
-u "$(id -u):$(id -g)" \
gotk4 \
bash -c "cd pkg && go test ./..."