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

General improvements for CI and project versioning #30

Merged
merged 5 commits into from
Jun 6, 2023
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
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