refactor(testutil): refactor registrytest #1236
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: ci | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
workflow_dispatch: | |
permissions: | |
actions: none | |
checks: none | |
contents: read | |
deployments: none | |
issues: none | |
pull-requests: none | |
repository-projects: none | |
security-events: none | |
statuses: none | |
# Necessary to push docker images to ghcr.io. | |
packages: write | |
# Cancel in-progress runs for pull requests when developers push | |
# additional changes | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: ${{ github.event_name == 'pull_request' }} | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- uses: actions/setup-go@v5 | |
with: | |
go-version: "~1.22" | |
- name: Download Go modules | |
run: go mod download | |
- name: Lint | |
run: make -j lint | |
- name: Test | |
run: make test | |
docs: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- uses: actions/setup-go@v5 | |
with: | |
go-version: "~1.22" | |
- name: Generate env vars docs | |
run: make docs/env-variables.md | |
- name: Check for unstaged files | |
run: git diff --exit-code | |
fmt: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- uses: actions/setup-go@v5 | |
with: | |
go-version: "~1.22" | |
- name: Check format | |
run: ./scripts/check_fmt.sh | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
# Needed to get older tags | |
fetch-depth: 0 | |
- uses: actions/setup-go@v5 | |
with: | |
go-version: "~1.22" | |
- name: Login to GitHub Container Registry | |
if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
# do not push images for pull requests | |
- name: Build | |
if: github.event_name == 'pull_request' | |
run: | | |
./scripts/build.sh \ | |
--arch=amd64 | |
./scripts/build.sh \ | |
--arch=arm64 | |
./scripts/build.sh \ | |
--arch=arm | |
- name: Build and Push | |
if: github.ref == 'refs/heads/main' | |
run: | | |
BASE=ghcr.io/coder/envbuilder-preview | |
./scripts/build.sh \ | |
--arch=amd64 \ | |
--arch=arm64 \ | |
--arch=arm \ | |
--base=$BASE \ | |
--push |