Release v0.10.0 (#539) #1248
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: [ '*' ] | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
env: | |
GOLANGCI_LINT_VERSION: v1.62.0 | |
GOTESTSUM_FORMAT: github-actions | |
jobs: | |
lint: | |
name: Lint | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
name: Check out repository | |
- uses: actions/setup-go@v5 | |
name: Set up Go | |
with: | |
go-version-file: go.mod | |
- uses: golangci/golangci-lint-action@v6 | |
name: Install golangci-lint | |
with: | |
version: ${{ env.GOLANGCI_LINT_VERSION }} | |
args: --help | |
- run: make lint | |
name: Lint | |
test: | |
runs-on: ${{ matrix.os }} | |
name: Test (${{ matrix.os}}, Git ${{ matrix.git-version }}) | |
strategy: | |
matrix: | |
os: ["ubuntu-latest", "windows-latest"] | |
git-version: ["system"] | |
include: | |
# On Linux, also test against specific versions built from source. | |
- {os: ubuntu-latest, git-version: "2.38.0"} | |
# On Windows, run without coverage. | |
- {os: windows-latest, no-cover: true} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version-file: go.mod | |
# TODO: extract into separate action | |
- name: Determine Git cache directory | |
shell: bash | |
if: matrix.git-version != 'system' | |
run: | | |
echo "GIT_VERSION=$GIT_VERSION" >> "$GITHUB_ENV" | |
echo "GIT_CACHE_DIR=$HOME/.cache/git/$GIT_VERSION" >> "$GITHUB_ENV" | |
env: | |
GIT_VERSION: ${{ matrix.git-version }} | |
- name: Fill Git cache | |
if: matrix.git-version != 'system' | |
uses: actions/cache@v4 | |
with: | |
path: ${{ env.GIT_CACHE_DIR }} | |
key: ${{ runner.os }}-git-${{ matrix.git-version }} | |
- name: Install Git | |
shell: bash | |
if: matrix.git-version != 'system' | |
run: | | |
if [[ ! -x "$GIT_CACHE_DIR/bin/git" ]]; then | |
URL=https://mirrors.edge.kernel.org/pub/software/scm/git/git-${GIT_VERSION}.tar.gz | |
echo "Downloading Git $GIT_VERSION from $URL" | |
sudo apt-get install \ | |
dh-autoreconf libcurl4-gnutls-dev libexpat1-dev gettext \ | |
libz-dev libssl-dev | |
GIT_SRC_DIR=$(mktemp -d) | |
( mkdir -p "$GIT_SRC_DIR" && | |
cd "$GIT_SRC_DIR" && | |
(curl -sSL "$URL" | tar -xz --strip-components=1) && | |
make prefix="$GIT_CACHE_DIR" && | |
make prefix="$GIT_CACHE_DIR" install ) | |
fi | |
if [[ ! -x "$GIT_CACHE_DIR/bin/git" ]]; then | |
echo "Failed to build Git $GIT_VERSION" | |
exit 1 | |
fi | |
echo "$GIT_CACHE_DIR/bin" >> "$GITHUB_PATH" | |
- name: Report Git version | |
shell: bash | |
run: | |
git --version | |
- name: Test | |
run: make ${{ (matrix.no-cover == true) && 'test' || 'cover' }} | |
shell: bash | |
- name: Upload coverage | |
uses: codecov/[email protected] | |
if: ${{ matrix.no-cover != true }} | |
with: | |
files: ./cover.out | |
token: ${{ secrets.CODECOV_TOKEN }} | |
# Depends on lint and test. | |
# Stable name for branch protection to require | |
# instead of adding lint and test there directly. | |
ok: | |
name: OK | |
runs-on: ubuntu-latest | |
needs: [lint, test] | |
# Workaround for GitHub marking this job as skipped, | |
# and allowing a bad PR to merge anyway. | |
if: always() | |
steps: | |
- run: exit 1 | |
if: >- | |
needs.lint.result != 'success' || | |
needs.test.result != 'success' | |
- run: exit 0 |