Skip to content

Commit

Permalink
Migrate to golang-devtools
Browse files Browse the repository at this point in the history
  • Loading branch information
nhhagen committed Sep 26, 2023
1 parent acb5eae commit bb92ab0
Show file tree
Hide file tree
Showing 78 changed files with 112 additions and 33,457 deletions.
68 changes: 68 additions & 0 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
---
on:
pull_request: {}

jobs:
golang-ci:
name: Go Lang CI
runs-on: ubuntu-latest
env:
docker-compose-service: golang-devtools
XDG_CACHE_HOME: ${{ github.workspace }}/.cache/xdg
steps:
- uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- id: xdg_cache_hash
run: echo "xdg_cache_hash=${{hashFiles('./docker-compose.yml', './docker-compose/Dockerfile', './go.sum')}}" >> $GITHUB_OUTPUT
- name: Cache xdg
uses: actions/cache@v3
with:
path: ${{ env.XDG_CACHE_HOME }}
key: xdg-${{ github.repository }}-${{ github.job }}-${{ steps.xdg_cache_hash.outputs.xdg_cache_hash }}
restore-keys: |
xdg-${{ github.repository }}-${{ github.job }}-${{ steps.xdg_cache_hash.outputs.xdg_cache_hash }}
xdg-${{ github.repository }}-${{ github.job }}-
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Configure access to internal and private GitHub repos
run: git config --global url."https://${{ secrets.REVIEWBOT_GITHUB_TOKEN }}:[email protected]/coopnorge".insteadOf "https://github.com/coopnorge"
- name: Build devtools
run: docker compose build
- name: Validate
run: docker compose run --rm ${{ env.docker-compose-service }} validate VERBOSE=all

validate-old-go:
runs-on: ubuntu-latest
strategy:
matrix:
go: [ '1.16', '1.17', '1.18', '1.19', '1.20', '1.21' ]
name: Go ${{ matrix.go }} - validate
steps:
- uses: actions/checkout@v4
- name: Setup go
uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go }}
- name: Install toolchain
run: make toolchain
- name: Validate
run: make validate

build:
needs:
- golang-ci
- validate-old-go
if: always()
runs-on: ubuntu-latest
steps:
- run: exit 1
name: "Catch errors"
if: |
needs.golang-ci.result == 'failure'
43 changes: 0 additions & 43 deletions .github/workflows/pr.yml

This file was deleted.

2 changes: 2 additions & 0 deletions devtools.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
BUILD_OCI=false
GOFLAGS=-mod=readonly
40 changes: 40 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
services:
golang-devtools:
build:
context: docker-compose
target: golang-devtools
dockerfile: Dockerfile
privileged: true
security_opt:
- seccomp:unconfined
- apparmor:unconfined
volumes:
- .:/srv/workspace:z
- ${DOCKER_CONFIG:-~/.docker}:/root/.docker
- ${GIT_CONFIG:-~/.gitconfig}:${GIT_CONFIG_GUEST:-/root/.gitconfig}
- ${SSH_CONFIG:-~/.ssh}:/root/.ssh
- ${XDG_CACHE_HOME:-xdg-cache-home}:/root/.cache
# ${x:-y} explained here https://www.gnu.org/software/bash/manual/html_node/Shell-Parameter-Expansion.html#:~:text=3.5.3%20Shell%20Parameter%20Expansion
environment:
GOMODCACHE: /root/.cache/go-mod
techdocs:
build:
context: docker-compose
dockerfile: Dockerfile
target: techdocs
working_dir: /srv/workspace
environment:
GOOGLE_APPLICATION_CREDENTIALS: ${GOOGLE_APPLICATION_CREDENTIALS:-}
GCLOUD_PROJECT: ${GCLOUD_PROJECT:-}
volumes:
- .:/srv/workspace:z
- ${XDG_CACHE_HOME:-xdg-cache-home}:/root/.cache
- $HOME/.config/gcloud:/root/.config/gcloud
- ${GOOGLE_APPLICATION_CREDENTIALS:-nothing}:${GOOGLE_APPLICATION_CREDENTIALS:-/tmp/empty-GOOGLE_APPLICATION_CREDENTIALS}
ports:
- "127.0.0.1:3000:3000/tcp"
- "127.0.0.1:8000:8000/tcp"
command: serve
volumes:
xdg-cache-home: { }
nothing: { }
2 changes: 2 additions & 0 deletions docker-compose/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
FROM ghcr.io/coopnorge/engineering-docker-images/e0/devtools-golang-v1beta1:gitc-1f40b7aec2da97d51ed26c6f1d027bdee0458a0d@sha256:5abec21bdbd1fec9946a50e825692773a64e7db2ddd10d3446e1fc70cfcbca3b AS golang-devtools
FROM ghcr.io/coopnorge/engineering-docker-images/e0/techdocs:gitc-520957c8b01583b35d335a49bc9d46428d3cfc5e@sha256:3c480d1f43b0dc4f46c041518c94c2c58a08406135a7250eb0d6ea70bc15b8f1 as techdocs
15 changes: 0 additions & 15 deletions vendor/github.com/davecgh/go-spew/LICENSE

This file was deleted.

145 changes: 0 additions & 145 deletions vendor/github.com/davecgh/go-spew/spew/bypass.go

This file was deleted.

38 changes: 0 additions & 38 deletions vendor/github.com/davecgh/go-spew/spew/bypasssafe.go

This file was deleted.

Loading

0 comments on commit bb92ab0

Please sign in to comment.