Skip to content

Commit

Permalink
Merge pull request #3 from fancycode/ci-actions
Browse files Browse the repository at this point in the history
CI: Migrate to GitHub actions.
  • Loading branch information
fancycode authored Apr 16, 2024
2 parents 875388c + d435d05 commit d25e63d
Show file tree
Hide file tree
Showing 6 changed files with 114 additions and 78 deletions.
6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
28 changes: 28 additions & 0 deletions .github/workflows/sdk.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: sdk

on:
push:
branches: [ master ]
paths:
- '.github/workflows/sdk.yml'
- 'sdk/**'
- 'scripts/check-sdk.py'
pull_request:
branches: [ master ]
paths:
- '.github/workflows/sdk.yml'
- 'sdk/**'
- 'scripts/check-sdk.py'

permissions:
contents: read

jobs:
check-latest:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Check SDK version
run: |
./scripts/check-sdk.py
68 changes: 68 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: test

on:
push:
branches: [ master ]
paths:
- '.github/workflows/fuzzer.yml'
- '**.c'
- '**.cc'
- '**.h'
- 'Makefile'
pull_request:
branches: [ master ]
paths:
- '.github/workflows/fuzzer.yml'
- '**.c'
- '**.cc'
- '**.h'
- 'Makefile'

permissions:
contents: read

jobs:
fuzzer:
env:
CC: "clang"
CXX: "clang++"
CFLAGS: "-fsanitize=fuzzer,address"
CXXFLAGS: "-fsanitize=fuzzer,address"
LIB_FUZZING_ENGINE: "-fsanitize=fuzzer"

strategy:
matrix:
fuzzer:
- "7z_fuzzer"
- "filters_fuzzer"
- "lzma2dec_fuzzer"
- "lzma2enc_fuzzer"
- "lzmadec_fuzzer"
- "lzmaenc_fuzzer"
- "ppmdenc_fuzzer"
- "xzdec_fuzzer"
- "xzenc_fuzzer"

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: ccache
uses: hendrikmuhs/[email protected]
with:
create-symlink: true

- name: Build fuzzer
run: |
make ${{ matrix.fuzzer }}
- name: Run fuzzer against corpus
run: |
if [ -d "corpus/${{ matrix.fuzzer }}" ]; then
echo "Running ${{ matrix.fuzzer }} against corpus ..."
./${{ matrix.fuzzer }} corpus/${{ matrix.fuzzer }}/*
fi
- name: Run fuzzer
run: |
./${{ matrix.fuzzer }} -max_total_time=10
31 changes: 0 additions & 31 deletions .travis.yml

This file was deleted.

24 changes: 12 additions & 12 deletions scripts/check-sdk.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python -u
#!/usr/bin/python3 -u

##
## @copyright Copyright (c) 2019 Joachim Bauch <[email protected]>
Expand All @@ -22,7 +22,7 @@
import os.path
import re
import sys
import urllib2
from urllib.request import urlopen

URL = 'https://www.7-zip.org/sdk.html'

Expand All @@ -44,36 +44,36 @@ def normalize_version(s):
try:
version = int(s)
except ValueError:
print >> sys.stderr, 'Not a valid version: %s' % (s)
print('Not a valid version: %s' % (s), file=sys.stderr)
sys.exit(1)

return '%.2d.%.2d' % (version / 100, version % 100)

def main():
with file(VERSIONS_FILE, 'rb') as fp:
with open(VERSIONS_FILE, 'r') as fp:
match = GET_SDK_VERSION(fp.read())
if match is None:
print >> sys.stderr, 'No version number found in %s' % (VERSIONS_FILE)
print('No version number found in %s' % (VERSIONS_FILE), file=sys.stderr)
sys.exit(1)

sdk_version = match.group(1)

print 'Checking for update of SDK version', sdk_version
print('Checking for update of SDK version', sdk_version)

fp = urllib2.urlopen(URL)
data = fp.read()
fp = urlopen(URL)
data = fp.read().decode('utf-8')
versions = SEARCH_SDK_DOWNLOADS(data)
if not versions:
print >> sys.stderr, 'No downloads found, check script.'
print('No downloads found, check script.', file=sys.stderr)
sys.exit(1)

versions = sorted(map(normalize_version, versions))[::-1]
print 'Found downloads for versions %s' % (', '.join(versions))
print('Found downloads for versions %s' % (', '.join(versions)))
if sdk_version < versions[0]:
print >> sys.stderr, 'Found newer version %s' % (versions[0])
print('Found newer version %s' % (versions[0]), file=sys.stderr)
sys.exit(1)

print 'Already using the latest version'
print('Already using the latest version')

if __name__ == '__main__':
main()
35 changes: 0 additions & 35 deletions scripts/run-travis.sh

This file was deleted.

0 comments on commit d25e63d

Please sign in to comment.