diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..72582452 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,94 @@ +name: CI + +on: + push: + branches: [ master ] + # run when tag received matching version format + pull_request: + branches: [ master ] + +jobs: + build: + name: ${{ matrix.friendlyName }} + env: + DISPLAY: ":99.0" + CC: "clang" + CXX: "clang++" + npm_config_clang: "1" + + strategy: + matrix: + node-version: [15.x] + os: [ubuntu-16.04, windows-latest, macos-latest] + include: + - os: ubuntu-16.04 + friendlyName: Ubuntu + - os: windows-latest + friendlyName: Windows + - os: macos-latest + friendlyName: macOS + + runs-on: ${{ matrix.os }} + + steps: + - uses: actions/checkout@v2 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node-version }} + - run: | + sudo apt-get install xvfb \ + gnome-keyring \ + libsecret-1-dev \ + dbus-x11 \ + python-gnomekeyring + if: ${{ matrix.os == 'ubuntu-16.04' }} + name: Install additional dependencies + + - run: npm install + name: Setup environment + + - run: | + echo "Initialize dbus..." + export NO_AT_BRIDGE=1; + eval $(dbus-launch --sh-syntax); + echo "Unlocking the keyring..." + eval $(echo -n "" | /usr/bin/gnome-keyring-daemon --login) + eval $(/usr/bin/gnome-keyring-daemon --components=secrets --start) + echo "Create a test key using script..." + python -c "import gnomekeyring;gnomekeyring.create_sync('login', '');" + npm test + if: ${{ matrix.os == 'ubuntu-16.04' }} + name: Run tests (Linux) + + - run: npm test + if: ${{ matrix.os != 'ubuntu-16.04' }} + name: Run tests (Windows/macOS) + + - run: | + npm run prebuild-node + npm run prebuild-electron + name: Prebuild (x64) + + - run: npm run prebuild-electron-arm64 + if: ${{ matrix.os != 'macos-latest' }} + name: Prebuild for Electron (ARM64) + + - run: | + docker build -t node-keytar/i386 docker/i386 + docker run --rm -v ${PWD}:/project node-keytar/i386 /bin/bash -c "cd /project && npm run prebuild-node-ia32 && npm run prebuild-electron-ia32" + if: ${{ matrix.os == 'ubuntu-16.04' }} + name: Prebuild (x86) + + - run: | + npm run prebuild-node-ia32 + npm run prebuild-electron-ia32 + if: ${{ matrix.os == 'windows-latest' }} + name: Prebuild (x86) + + - run: | + ls prebuilds/ + name: List prebuilds + + # only if tag found for release + #- if defined APPVEYOR_REPO_TAG_NAME (npm run upload) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 78acada7..f9bc01d6 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -1,4 +1,4 @@ -name: "Code Scanning - Action" +name: "Code Scanning" on: push: @@ -6,15 +6,22 @@ on: - cron: '0 0 * * 0' jobs: - CodeQL-Build: + CodeQL: + + name: ${{ matrix.friendlyName }} - # CodeQL runs on ubuntu-latest, windows-latest, and macos-latest runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: os: [ubuntu-latest, windows-latest, macos-latest] - + include: + - os: ubuntu-latest + friendlyName: Ubuntu + - os: windows-latest + friendlyName: Windows + - os: macos-latest + friendlyName: macOS steps: - name: Checkout repository uses: actions/checkout@v2 diff --git a/.travis.yml b/.travis.yml index 907695f6..257d48c6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,7 +4,7 @@ dist: trusty os: - linux - osx -node_js: 14 +node_js: 15 env: - CC=clang CXX=clang++ npm_config_clang=1 @@ -44,6 +44,9 @@ before_script: "import gnomekeyring;gnomekeyring.create_sync('login', '');" fi +install: + - npm install + script: - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then xvfb-run ./script/cibuild; fi - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then npm test; fi diff --git a/appveyor.yml b/appveyor.yml index 58d15e35..2a85a35a 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -5,7 +5,7 @@ platform: - x64 environment: - nodejs_version: "14" + nodejs_version: "15" cache: - node_modules @@ -17,7 +17,7 @@ branches: clone_depth: 10 install: - - ps: Install-Product node $env:nodejs_version x64 + - ps: Update-NodeJsInstallation (Get-NodeJsLatestBuild $env:nodejs_version) $env:PLATFORM - npm install build_script: diff --git a/package.json b/package.json index 4e68ec30..ce64cdea 100644 --- a/package.json +++ b/package.json @@ -33,8 +33,8 @@ "install": "prebuild-install || node-gyp rebuild", "lint": "npm run cpplint", "cpplint": "node-cpplint --filters legal-copyright,build-include,build-namespaces src/*.cc", - "test": "npm run lint && npm build . && mocha --require babel-core/register spec/", - "prebuild-node": "prebuild -t 8.9.0 -t 9.4.0 -t 10.11.0 -t 11.9.0 -t 12.0.0 -t 13.0.0 -t 14.0.0 --strip", + "test": "npm run lint && npm rebuild && mocha --require babel-core/register spec/", + "prebuild-node": "prebuild -t 8.9.0 -t 9.4.0 -t 10.11.0 -t 11.9.0 -t 12.0.0 -t 13.0.0 -t 14.0.0 -t 15.0.0 --strip", "prebuild-node-ia32": "prebuild -t 8.9.0 -t 9.4.0 -a ia32 --strip", "prebuild-electron": "prebuild -t 7.0.0 -t 8.0.0 -t 9.0.0 -t 10.0.0 -r electron --strip", "prebuild-electron-arm64": "prebuild -t 7.0.0 -t 8.0.0 -t 9.0.0 -t 10.0.0 -r electron -a arm64 --strip", diff --git a/spec/keytar-spec.js b/spec/keytar-spec.js index 53ba627a..f567d0bb 100644 --- a/spec/keytar-spec.js +++ b/spec/keytar-spec.js @@ -131,6 +131,8 @@ describe("keytar", function() { }) describe("findPassword(service)", function() { + this.timeout(5000); + it("yields a password for the service", async function() { await keytar.setPassword(service, account, password), await keytar.setPassword(service, account2, password2)