Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update CI to update rockspec for release #10

Merged
merged 2 commits into from
Nov 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions .github/workflows/prep-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Prepare for publish to LuaRocks

on:
workflow_dispatch:
inputs:
version:
description: 'New version number (tag name without the "v")'
required: true
type: string
commit_and_tag:
description: 'Commit the rockspec and create the new tag on success'
required: true
default: true
type: boolean

jobs:
prepare_for_publish:
name: Prepare for publish
runs-on: ubuntu-latest

env:
ROCKSPEC: "rockspecs/du-mocks-${{ inputs.version }}-1.rockspec"

steps:
- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0
with:
ref: main

- name: Create new rockspec file
run: |
cp du-mocks-scm-0.rockspec $ROCKSPEC
sed -i 's/scm-0/${{ inputs.version }}-1/g' $ROCKSPEC
sed -i 's/branch = "main"/tag = "v${{ inputs.version }}"/g' $ROCKSPEC

- uses: leafo/gh-actions-lua@d84e7d61946edb679210088bc1378c099fde51fe # v9.1.0

- uses: leafo/gh-actions-luarocks@e65774a6386cb4f24e293dca7fc4ff89165b64c5 # v4.3.0

- name: Verify new rockspec builds
run: luarocks make $ROCKSPEC

- name: Commit rockspec and tag
if: ${{ inputs.commit_and_tag }}
run: |
git config --global user.name 'Joe Rogers'
git config --global user.email '1337joe@users.noreply.github.com'
git add $ROCKSPEC
git commit -m "Prepare for release ${{ inputs.version }}"
git tag v${{ inputs.version }}
git push
git push --tags
49 changes: 43 additions & 6 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Tests
name: Test

on:
push:
Expand All @@ -7,8 +7,48 @@ on:
branches: [ main ]

jobs:
test:
name: Unit Tests
luarocks:
name: Test LuaRocks
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0

- uses: leafo/gh-actions-lua@d84e7d61946edb679210088bc1378c099fde51fe # v9.1.0

- uses: leafo/gh-actions-luarocks@e65774a6386cb4f24e293dca7fc4ff89165b64c5 # v4.3.0

- name: Setup
run: |
luarocks install --only-deps du-mocks-scm-0.rockspec

- name: Verify LuaRocks config
run: luarocks make

ldoc:
name: Test LDoc
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0

- uses: leafo/gh-actions-lua@d84e7d61946edb679210088bc1378c099fde51fe # v9.1.0

- uses: leafo/gh-actions-luarocks@e65774a6386cb4f24e293dca7fc4ff89165b64c5 # v4.3.0

- name: Setup
run: |
luarocks install --only-deps du-mocks-scm-0.rockspec
luarocks install ldoc

- name: Verify codex builds cleanly
run: ldoc . --fatalwarnings

- name: Verify PTS codex builds cleanly
run: ldoc -c config-pts.ld . --fatalwarnings

unit-test:
name: Run Unit Tests
runs-on: ubuntu-latest

strategy:
Expand All @@ -33,9 +73,6 @@ jobs:
luarocks install luacov
luarocks install luafilesystem

- name: Verify LuaRocks config
run: luarocks make

- name: Test
run: ./test/runTests.sh -o junit

Expand Down