blob: 8de2f5f254e5356f04deaecd69272397519d4b00 [file]
# SPDX-License-Identifier: MPL-2.0
#
# libpathrs: safe path resolution on Linux
# Copyright (C) 2019-2025 SUSE LLC
# Copyright (C) 2026 Aleksa Sarai <cyphar@cyphar.com>
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
on:
push:
branches: [ main ]
tags:
- 'v*'
pull_request:
branches: [ main ]
release:
types: [ published ]
schedule:
- cron: '0 0 * * *'
workflow_dispatch:
name: bindings-go
permissions:
contents: read
env:
CARGO_TERM_COLOR: always
# renovate: datasource=golang-version depName=go versioning=npm
GO_VERSION: 1.27.x
jobs:
lint:
permissions:
contents: read
pull-requests: read
checks: write # to allow the action to annotate code in the pr.
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
# Build and install libpathrs.so.
- name: install rust toolchain
run: |-
rustup toolchain install --profile minimal --no-self-update stable
rustup default stable
- name: build libpathrs
run: make release
- name: install libpathrs
run: sudo ./install.sh --libdir=/usr/lib
# Run golangci-lint.
- uses: golangci/golangci-lint-action@ba0d7d2ec06a0ea1cb5fa41b2e4a3ab91d21278a # v9.3.0
with:
version: v2.14.0
working-directory: go-pathrs
go-fix:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 2
persist-credentials: false
# Build and install libpathrs.so.
- name: install rust toolchain
run: |-
rustup toolchain install --profile minimal --no-self-update stable
rustup default stable
- name: build libpathrs
run: make release
- name: install libpathrs
run: sudo ./install.sh --libdir=/usr/lib
# Run go-fix.
- uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version: "${{ env.GO_VERSION }}"
cache: false
- name: run go fix
run: |
cd go-pathrs
go fix ./...
git diff --exit-code
smoke-test:
strategy:
fail-fast: false
matrix:
go-version:
- "1.18"
- "oldstable"
- "stable"
# CGo's behaviour is somewhat compiler-dependent so do smoke tests
# using both clang and gcc to hopefully catch issues earlier.
cc:
- gcc
- clang
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
# Build and install libpathrs.so.
- name: install rust toolchain
run: |-
rustup toolchain install --profile minimal --no-self-update stable
rustup default stable
- name: build libpathrs
run: make release
- name: install libpathrs
run: sudo ./install.sh --libdir=/usr/lib
# Setup go.
- name: install go ${{ matrix.go-version }}
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version: ${{ matrix.go-version }}
check-latest: true
cache: false
# Run smoke-tests.
# NOTE: CC is only set here (and not for the whole job) so that we don't
# affect how libpathrs itself is built.
- run: make -C examples/go smoke-test
env:
CC: ${{ matrix.cc }}
go-complete:
needs:
- lint
- go-fix
- smoke-test
runs-on: ubuntu-latest
steps:
- run: echo "Go CI jobs completed successfully."