Skip to content

Update CI

Update CI #2

Workflow file for this run

---
name: Test & release
'on':
- pull_request
- push
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
# yamllint disable-line rule:line-length
cancel-in-progress: ${{ github.ref != format('refs/heads/{0}', github.event.repository.default_branch) }}
jobs:
should-run:
name: Prep / Should run
runs-on: ubuntu-latest
timeout-minutes: 5
outputs:
should-run: ${{ steps.action.outputs.should-run }}
steps:
- id: action
uses:
# yamllint disable-line rule:comments rule:line-length
techneg-it/should-workflow-run@dcbb88600d59ec2842778ef1e2d41f680f876329 # v1.0.0
gtp:
name: Prep / Get platforms
needs:
- should-run
if: fromJSON(needs.should-run.outputs.should-run)
runs-on: ubuntu-latest
timeout-minutes: 5
outputs:
test-platforms: ${{ steps.get-test-platforms.outputs.test-platforms }}
steps:
# yamllint disable-line rule:comments
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- id: get-test-platforms
run: |
PLATFORMS=$(
yq '[keys | .[] | select(test("^default-(deb|ubu)"))]' \
-o=json -I=0 .gitlab-ci.yml
)
OUTPUT="test-platforms=$PLATFORMS"
echo "Setting '$OUTPUT'"
echo "$OUTPUT" >> $GITHUB_OUTPUT
pre-commit:
name: Lint / `pre-commit`
needs: should-run
if: fromJSON(needs.should-run.outputs.should-run)
container: techneg/ci-pre-commit:v2.3.3
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
# yamllint disable-line rule:comments
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Export `CI_CACHE_ID` from container
run: echo "CI_CACHE_ID=$(cat /.ci_cache_id)" >> $GITHUB_ENV
# yamllint disable-line rule:comments
- uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
with:
path: ~/.cache/pre-commit
key: "${{ env.CI_CACHE_ID }}|\
${{ hashFiles('.pre-commit-config.yaml') }}"
- name: Run `pre-commit`
run: |
git config --global --add safe.directory $(pwd)
pre-commit run --all-files --color always --verbose
test:
name: Test / Kitchen
needs:
- gtp
- pre-commit
- should-run
if: fromJSON(needs.should-run.outputs.should-run)
runs-on: ubuntu-latest
timeout-minutes: 5
strategy:
fail-fast: false
matrix:
platform: ${{ fromJSON(needs.gtp.outputs.test-platforms) }}
steps:
# yamllint disable-line rule:comments
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
# yamllint disable-line rule:comments
- uses: ruby/setup-ruby@2a18b06812b0e15bb916e1df298d3e740422c47e # v1.203.0
with:
bundler-cache: true
ruby-version: 3.1.2
- run: |
bin/kitchen test ${{ matrix.platform }}
test-conversion:
name: Test / Conversion
needs:
- pre-commit
- should-run
if: fromJSON(needs.should-run.outputs.should-run)
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
# yamllint disable-line rule:comments
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Convert the formula
run: |
export CONVERTED=test-the-use_this_template-button
git config user.email "[email protected]"
git config user.name "Test Name"
# Run the conversion script with debug output
DEBUG=true bin/convert-formula.sh "${CONVERTED}"
[ $(git rev-list HEAD --count) -eq 2 ]
# Quick visual check that correct files have been updated
git show --pretty="" --name-status
echo Done!
# yamllint disable-line rule:comments
- uses: ruby/setup-ruby@2a18b06812b0e15bb916e1df298d3e740422c47e # v1.203.0
with:
bundler-cache: true
ruby-version: 3.1.2
- name: Test / Kitchen
run: |
bin/kitchen list
bin/kitchen test default-debian-11-master-py3
results:
name: Release / Collect results
permissions:
contents: write
issues: write
pull-requests: write
checks: read
runs-on: ubuntu-latest
steps:
# yamllint disable-line rule:comments rule:line-length
- uses: poseidon/wait-for-status-checks@899c768d191b56eef585c18f8558da19e1f3e707 # v0.6.0
with:
ignore: Release / Collect results
token: ${{ secrets.GITHUB_TOKEN }}
# yamllint disable-line rule:comments
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
# yamllint disable-line rule:comments rule:line-length
- uses: codfish/semantic-release-action@b621d34fabe0940f031e89b6ebfea28322892a10 # v3.5.0
with:
branches: '"ma(in|ster)"'
dry-run: true
plugins: |
[
[
"@semantic-release/commit-analyzer",
{
"releaseRules": "./release-rules.js"
}
],
"@semantic-release/release-notes-generator",
"@semantic-release/github"
]
repository-url: ${{ github.repository }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}