commit bf7c75466817062e9bb62b47d98d1647959f24fe from: Sergey Bronnikov via: Sergey Bronnikov date: Wed Feb 08 15:16:04 2023 UTC ci: add Github Actions commit - 9da5762c1d4d33ded214eacd8c1c26a2bdc84531 commit + bf7c75466817062e9bb62b47d98d1647959f24fe blob - /dev/null blob + 36f2e4f409eb71f66d40d5c01aabe6c2b9dc7f42 (mode 644) --- /dev/null +++ .github/workflows/check.yaml @@ -0,0 +1,28 @@ +name: Static analysis + +on: + push: + pull_request: + +jobs: + static-analysis: + if: | + github.event_name == 'push' || + github.event_name == 'pull_request' && + github.event.pull_request.head.repo.full_name != github.repository + + runs-on: ubuntu-22.04 + + steps: + - uses: actions/checkout@v3 + + - name: Setup luarocks + run: sudo apt install -y luarocks + + - run: echo $(luarocks path --lr-bin) >> $GITHUB_PATH + + - name: Setup luacheck + run: luarocks --local install luacheck + + - name: Run static analysis + run: luacheck . blob - /dev/null blob + c4c24b9e43167a26e32a52c15033e8c7a241146e (mode 644) --- /dev/null +++ .github/workflows/publish.yaml @@ -0,0 +1,44 @@ +name: Publish + +on: + push: + branches: [master] + tags: ['*'] + +jobs: + publish-scm-1: + if: github.ref == 'refs/heads/master' + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v3 + + - name: Setup luarocks + run: sudo apt install -y luarocks + + - name: Setup cjson (required for upload) + run: luarocks install --local lua-cjson + + - name: Upload rockspec scm-1 + run: luarocks upload --force --api-key=${{ secrets.LUAROCKS_API_KEY }} afl-lua-scm-1.rockspec + + publish-tag: + if: startsWith(github.ref, 'refs/tags/') + runs-on: ubuntu-22.04 + steps: + # https://github.com/luarocks/luarocks/wiki/Types-of-rocks + - uses: actions/checkout@v3 + + - name: Setup luarocks + run: sudo apt install -y luarocks + + # Make a release. + - run: | + echo TAG=${GITHUB_REF##*/} >> $GITHUB_ENV + luarocks new_version --tag ${{ env.TAG }} + luarocks install afl-lua-${{ env.TAG }}-1.rockspec + luarocks pack afl-lua-${{ env.TAG }}-1.rockspec + + - name: Upload .rockspec and .src.rock ${{ env.TAG }} + run: | + luarocks upload --api-key=${{ secrets.LUAROCKS_API_KEY }} afl-lua-${{ env.TAG }}-1.rockspec + luarocks upload --api-key=${{ secrets.LUAROCKS_API_KEY }} afl-lua-${{ env.TAG }}-1.src.rock blob - /dev/null blob + 5e93cc234f54824cea302a71b7529cbec95893bc (mode 644) --- /dev/null +++ .github/workflows/test.yaml @@ -0,0 +1,45 @@ +name: Testing + +on: + push: + pull_request: + +jobs: + testing: + if: | + github.event_name == 'push' || + github.event_name == 'pull_request' && + github.event.pull_request.head.repo.full_name != github.repository + strategy: + matrix: + LIBLUA: + - "5.4" + - "5.3" + - "5.2" + - "5.1" + fail-fast: false + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v3 + + - name: Setup packages (${{ matrix.LIBLUA }} + run: sudo apt install -y lua5.1 liblua5.1-0-dev + if: ${{ matrix.LIBLUA == '5.1' }} + + - name: Setup packages (${{ matrix.LIBLUA }} + run: sudo apt install -y lua5.2 liblua5.2-dev + if: ${{ matrix.LIBLUA == '5.2' }} + + - name: Setup packages (${{ matrix.LIBLUA }} + run: sudo apt install -y lua5.3 liblua5.3-dev + if: ${{ matrix.LIBLUA == '5.3' }} + + - name: Setup packages (${{ matrix.LIBLUA }} + run: sudo apt install -y lua5.4 liblua5.4-dev + if: ${{ matrix.LIBLUA == '5.4' }} + + - name: Running CMake + run: cmake -S . -B build + + - name: Building + run: cmake --build build --parallel $(nproc)