Skip to content

Conversation

Copy link

Copilot AI commented Jan 15, 2026

  • Create initial GitHub Actions workflow for test job
  • Simplify workflow to use go-version-file and remove unnecessary dependencies
  • Fix Go version to 1.24.11 (matching CircleCI) instead of using go.mod version
  • Add all CircleCI jobs (build, lint, test, test-e2e, generate) to GitHub Actions
  • Move Go version to environment variable
  • Keep jobs in same order as CircleCI
  • Add only required dependencies (xz-utils for lint, unzip for generate)
  • Add explicit permissions block for security (contents: read)
  • Fix test-e2e to explicitly build container before running tests
  • Simplify test-e2e to use make target instead of duplicating logic
Original prompt

Convert the CircleCI 'test' job into a GitHub Actions workflow equivalent. The CircleCI configuration can be found at this URL: https://github.com/observatorium/api/blob/ad02ec7e2b4e9f421981520c4e8e38c6592b1e2c/.circleci/config.yml.

In the CircleCI configuration, the 'test' job is as follows:

  test:
    machine:
      image: default
    steps:
      - checkout
      - run: |
          apt-get update && apt-get -y install xz-utils unzip openssl
          sudo rm -rf /usr/local/go
          wget -qO- https://dl.google.com/go/go1.24.11.linux-amd64.tar.gz | sudo tar -C /usr/local -xzf -
          export PATH=$PATH:/usr/local/go/bin
          go version
          make test --always-make

The workflow file for GitHub Actions should be named test-github-actions.yml. The contents of the file are:

name: CI

on:
  push:
    branches:
      - main
  pull_request:

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repository
        uses: actions/checkout@v3

      - name: Set up Go
        uses: actions/setup-go@v4
        with:
          go-version: 1.24

      - name: Update and Install necessary dependencies
        run: |
          sudo apt-get update
          sudo apt-get -y install xz-utils unzip openssl

      - name: Install Go 1.24.11
        run: |
          sudo rm -rf /usr/local/go
          wget -qO- https://dl.google.com/go/go1.24.11.linux-amd64.tar.gz | sudo tar -C /usr/local -xzf -
          echo "/usr/local/go/bin" >> $GITHUB_PATH
          go version

      - name: Run tests
        run: make test --always-make

Please create a pull request with this workflow added to the repository.

This pull request was created from Copilot chat.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI changed the title [WIP] Convert CircleCI test job to GitHub Actions workflow Add GitHub Actions workflow for test job (CircleCI equivalent) Jan 15, 2026
Copilot AI requested a review from philipgough January 15, 2026 15:54
Copy link
Author

Copilot AI commented Jan 15, 2026

@copilot maybe theres a better way instead of having to install go directly?

You're absolutely right! I've simplified the workflow to use actions/setup-go@v4 with go-version-file: 'go.mod' which automatically uses the Go version specified in go.mod (1.23.8). This removes the redundant manual Go installation.

I also investigated the dependencies and found that:

  • xz-utils - only needed for shellcheck download (not used in test target)
  • unzip - only needed for protoc installation (not used in test target)
  • openssl - not actually used anywhere in the codebase

Since make test only runs build + test-unit, none of these dependencies are required. The workflow is now much simpler and cleaner.

Commit: 9f8955f

@philipgough
Copy link
Contributor

@copilot Failing

Copy link
Author

Copilot AI commented Jan 15, 2026

@copilot Failing

Fixed in f475711. The issue was that the workflow was using Go 1.23.8 from go.mod, but the CircleCI test job uses Go 1.24.11, which is required for the build tooling (oapi-codegen needs Go 1.24.10+). Updated the workflow to explicitly use Go 1.24.11 to match the CircleCI configuration.

@philipgough
Copy link
Contributor

@copilot go ahead and add the other jobs from circle ci to gh actions. keep the order the same. only add deps as required to make them pass and keep as simple and minimla as possible. Can we move out the go version to an env file?

Copy link
Author

Copilot AI commented Jan 15, 2026

@copilot go ahead and add the other jobs from circle ci to gh actions. keep the order the same. only add deps as required to make them pass and keep as simple and minimla as possible. Can we move out ...

Done in 1950f01. Added all CircleCI jobs (build, lint, test, test-e2e, generate) in the same order. GO_VERSION moved to an env variable. Only added required dependencies: xz-utils for lint, unzip for generate. The test and build jobs don't need extra dependencies.

Copilot AI changed the title Add GitHub Actions workflow for test job (CircleCI equivalent) Add GitHub Actions workflow for all CircleCI jobs Jan 15, 2026
@philipgough
Copy link
Contributor

@copilot test-e2e fails

Copy link
Author

Copilot AI commented Jan 15, 2026

@copilot test-e2e fails

Fixed in b47bf8f. The e2e tests require building a Docker container first. Added an explicit make container-test step before running the tests to ensure the quay.io/observatorium/api:local_e2e_test image is built locally before the tests try to use it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants