build(deps): bump dawidd6/action-download-artifact from 6 to 7 #297
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: ['**'] | |
paths: | |
- "go.*" | |
- "**/*.go" | |
- "testdata/**" | |
- ".github/workflows/ci.yml" | |
pull_request: | |
branches: [main] | |
paths: | |
- "go.*" | |
- "**/*.go" | |
- "testdata/**" | |
workflow_dispatch: | |
inputs: | |
go-version: | |
required: false | |
type: string | |
workflow_call: | |
inputs: | |
go-version: | |
required: false | |
type: string | |
event-type: | |
required: true | |
type: string | |
jobs: | |
setup: | |
runs-on: ubuntu-latest | |
outputs: | |
go-version: ${{ steps.vars.outputs.go-version }} | |
steps: | |
- name: Checkout code to determine the minimum supported go version | |
if: ${{ inputs.go-version == '' }} | |
uses: actions/checkout@v4 | |
with: | |
repository: pkgcraft/pkgcraft-go | |
- name: Set golang versions to test against | |
id: vars | |
run: | | |
if [[ -n "${{ inputs.go-version }}" ]]; then | |
echo "go-version=$(jq 'split(",")' -Rc <(echo '${{ inputs.go-version }}'))" >> $GITHUB_OUTPUT | |
else | |
min_ver=$(sed -rn '/^go / s/^go ([0-9](.[0-9]+)*)/\1/p' go.mod) | |
if [[ -n ${min_ver} ]]; then | |
echo "go-version=['${min_ver}', 'stable']" >> $GITHUB_OUTPUT | |
else | |
exit 1 | |
fi | |
fi | |
test: | |
needs: setup | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest] | |
go-version: ${{ fromJson(needs.setup.outputs.go-version) }} | |
steps: | |
- name: Set pkgcraft dir env var | |
run: echo pkgcraft_dir=~/pkgcraft >> $GITHUB_ENV | |
- name: Download pkgcraft-c library from most recent run | |
if: ${{ inputs.event-type == '' }} | |
uses: dawidd6/action-download-artifact@v7 | |
with: | |
github_token: ${{ secrets.PKGCRAFT_CI_TOKEN }} | |
repo: pkgcraft/pkgcraft | |
branch: main | |
workflow: pkgcraft-c.yml | |
workflow_conclusion: "" | |
search_artifacts: true | |
name: pkgcraft-c-${{ runner.os }} | |
- name: Download pkgcraft-c library from running workflow | |
if: ${{ inputs.event-type != '' }} | |
uses: actions/download-artifact@v4 | |
with: | |
name: pkgcraft-c-${{ runner.os }} | |
- name: Unpack library | |
run: | | |
mkdir -p "${pkgcraft_dir}" | |
tar -Jxf pkgcraft-c.tar.xz -C "${pkgcraft_dir}" | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
repository: pkgcraft/pkgcraft-go | |
submodules: true | |
- name: Override build variables | |
run: | | |
echo "PKG_CONFIG_PATH=${pkgcraft_dir}" >> $GITHUB_ENV | |
echo "LD_LIBRARY_PATH=${pkgcraft_dir}" >> $GITHUB_ENV | |
echo "DYLD_LIBRARY_PATH=${pkgcraft_dir}" >> $GITHUB_ENV | |
- uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ matrix.go-version }} | |
- name: Build and test | |
run: | | |
go build | |
go test -v -race -coverprofile=coverage.out ./... | |
- name: Upload coverage to Codecov | |
if: ${{ inputs.event-type == '' && github.ref_name == 'main' && matrix.go-version == 'stable' }} | |
uses: codecov/codecov-action@v5 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
files: ./coverage.out |