Skip to content

ci: Use env vars for specifying actions versions #4

ci: Use env vars for specifying actions versions

ci: Use env vars for specifying actions versions #4

Workflow file for this run

name: Integration tests
on:
push:
branches:
- 'main'
pull_request:
branches:
- 'main'
env:
# Golang version to use across CI steps
GOLANG_VERSION: '1.21'
# Version for actions/checkout
CHECKOUT_VERSION: b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
# Version for actions/setup-go
SETUP_GO_VERSIOM: 0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
permissions:
contents: read
jobs:
check-go:
runs-on: ubuntu-22.04
steps:
- name: Checkout code
uses: actions/checkout@${{ env.CHECKOUT_VERSION }}

Check failure on line 25 in .github/workflows/ci.yaml

View workflow run for this annotation

GitHub Actions / Integration tests

Invalid workflow file

The workflow is not valid. .github/workflows/ci.yaml (Line: 25, Col: 15): Unrecognized named-value: 'env'. Located at position 1 within expression: env.CHECKOUT_VERSION .github/workflows/ci.yaml (Line: 27, Col: 15): Unrecognized named-value: 'env'. Located at position 1 within expression: env.SETUP_GO_VERSION
- name: Setup Golang
uses: actions/setup-go@${{ env.SETUP_GO_VERSION }}
with:
go-version: ${{ env.GOLANG_VERSION }}
- name: Download all Go modules
run: |
go mod download
- name: Check for tidyness of go.mod and go.sum
run: |
go mod tidy
git diff --exit-code -- .
build-go:
name: Build & cache Go code
runs-on: ubuntu-22.04
steps:
- name: Checkout code
uses: actions/checkout@${{ env.CHECKOUT_VERSION }}
- name: Setup Golang
uses: actions/setup-go@${{ env.SETUP_GO_VERSION }}
with:
go-version: ${{ env.GOLANG_VERSION }}
- name: Restore go build cache
uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3.3.2
with:
path: ~/.cache/go-build
key: ${{ runner.os }}-go-build-v1-${{ github.run_id }}
- name: Download all Go modules
run: |
go mod download
- name: Compile all packages
run: make build
test:
name: Run unit tests
runs-on: ubuntu-22.04
steps:
- name: Checkout code
uses: actions/checkout@${{ env.CHECKOUT_VERSION }}
- name: Setup Golang
uses: actions/setup-go@${{ env.SETUP_GO_VERSION }}
with:
go-version: ${{ env.GOLANG_VERSION }}
- name: Restore go build cache
uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3.3.2
with:
path: ~/.cache/go-build
key: ${{ runner.os }}-go-build-v1-${{ github.run_id }}
- name: Download all Go modules
run: |
go mod download
- name: Run all unit tests
run: make test