Skip to content

Commit

Permalink
Merge pull request #30 from gruberdev/fix/gha
Browse files Browse the repository at this point in the history
General improvements for CI and project versioning
  • Loading branch information
cedws committed Jun 6, 2023
2 parents 452e097 + 421e242 commit 833fb6b
Show file tree
Hide file tree
Showing 3 changed files with 206 additions and 42 deletions.
74 changes: 51 additions & 23 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,38 +2,66 @@ name: CI

on:
push:
branches: [ master ]
branches: [master]
pull_request:
branches: [ master ]
branches: [master]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Set up Python 3.x
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Set up python
id: setup-python
uses: actions/setup-python@v4
with:
python-version: '3.11.3'

- name: Setup Poetry
uses: abatilo/[email protected]
- name: Install and configure Poetry
uses: snok/install-poetry@v1
with:
version: 1.5.1
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true

- name: Install dependencies
run: poetry install
- name: Install dependencies
run: poetry install

- name: Run make all inside Poetry shell
run: poetry run make
- name: Run make all inside Poetry shell
run: poetry run make

- uses: ncipollo/release-action@v1
with:
artifacts: "release/*"
tag: ${{ github.run_number }}
token: ${{ secrets.GITHUB_TOKEN }}
- name: Check ACT environment variable
id: check_act
run: echo "::set-output name=act_not_set::${{ env.ACT == '' }}"

- uses: dev-drprasad/[email protected]
with:
keep_latest: 3
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Archive production artifacts
uses: actions/upload-artifact@v2
with:
name: release
path: release/*

release:
if: github.event_name == 'push' && needs.build.outputs.act_not_set == 'true'
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Download artifacts
uses: actions/download-artifact@v2
with:
name: release

- uses: ncipollo/release-action@v1
with:
artifacts: "release/*"
tag: ${{ github.run_number }}
token: ${{ secrets.GITHUB_TOKEN }}

- uses: dev-drprasad/[email protected]
with:
keep_latest: 3
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
12 changes: 12 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,18 @@ RELEASE_DIR=release

all: cleanup gen-lsrules gen-ip-blacklist gen-hosts gen-cloaking-rules

test-local:
@if [ ! -d "/tmp/artifacts" ]; then \
mkdir -p /tmp/artifacts && echo "Directory /tmp/artifacts created."; \
else \
echo "Directory /tmp/artifacts already exists."; \
fi && \
(command -v act-cli >/dev/null && exec act-cli --artifact-server-path /tmp/artifacts) || \
(command -v act >/dev/null && exec act --artifact-server-path /tmp/artifacts) || \
(command -v gh >/dev/null && exec gh extension exec act --artifact-server-path /tmp/artifacts) || \
echo "No available act command found"


cleanup:
sort -u -o $(BLACKLIST) $(BLACKLIST)

Expand Down
Loading

0 comments on commit 833fb6b

Please sign in to comment.