Skip to content

switch to go

switch to go #172

Workflow file for this run

name: Continuous Integration
on:
pull_request:
push:
branches:
- main
- 'releases/*'
jobs:
test-go:
name: Go Tests
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.20'
cache: true
- name: Install dependencies
run: go mod download
- name: Build
run: go build -v ./...
- name: Run tests
run: go test -v -race -coverprofile=coverage.txt -covermode=atomic ./...
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
file: ./coverage.txt
fail_ci_if_error: true
test-action:
name: GitHub Actions Test
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
id: checkout
uses: actions/checkout@v4
- name: Test Local Action
id: test-action
uses: ./
with:
go-version: '1.20.0'
gop-version: '1.2.6'
- name: Print Output
id: output
run: echo "${{ steps.test-action.outputs.gop-version }}"
test-versions:
name: Gop Versions Test
strategy:
matrix:
gop-version: ['1.2.6', '', 'latest', 'main', 'v1.2']
include:
- gop-version: '1.2.6'
gop-version-verified: 'true'
- gop-version: ''
gop-version-verified: 'true'
- gop-version: 'latest'
gop-version-verified: 'true'
- gop-version: 'main'
gop-version-verified: 'false'
- gop-version: 'v1.2'
gop-version-verified: 'false'
runs-on: ubuntu-latest
steps:
- name: Checkout
id: checkout
uses: actions/checkout@v4
- name: Test Gop Version
id: test-gop-version
uses: ./
with:
gop-version: ${{ matrix.gop-version }}
- name: Test version verified
env:
VERIFIED: ${{ matrix.gop-version-verified }}
GOP_VERSION: ${{ matrix.gop-version }}
run: |
echo "gop-version: $GOP_VERSION"
echo "gop-version-verified: $VERIFIED"
if [[ "$VERIFIED" != "$VERIFIED" ]]; then
echo "gop-version-verified does not match expected value"
echo "expected: $VERIFIED, got: $VERIFIED"
exit 1
fi